Concept:
Two's complement is the standard way to represent signed integers in binary. To find the 2's complement of a negative number, we follow a specific three-step process:
• Find the binary representation of the positive version of the number.
• Find the 1's complement (invert all bits).
• Find the 2's complement (add 1 to the 1's complement).
Step 1: Represent +5 in 8-bit binary.
First, we write the binary for 5, which is $4 + 1$ ($2^2 + 2^0$).
In 8-bit format, this is:
\[
+5 = 00000101
\]
Step 2: Calculate the 1's complement.
Flip every bit (0 becomes 1, and 1 becomes 0):
\[
\text{1's complement of } 5 = 11111010
\]
Step 3: Calculate the 2's complement.
Add 1 to the result of
Step 2:
\[
\begin{array}{r@{\quad}l}
11111010 & (\text{1's complement})
+ 00000001 & (\text{Add 1})
\hline
11111011 &
\end{array}
\]
The result 11111011 represents -5 in 8-bit 2's complement.