Simple binary subtraction

2.8k Views Asked by At

$$101110 - 110111$$

Did the 2's complment and cannot get to the answer. The answer is apparently $$-1001$$

I did 2's complment on the $$110111$$ and performed addition but did not get to the answer. But I heard that I have to "zero-fill" before i do it or something

4

There are 4 best solutions below

10
On BEST ANSWER

$$101110 - 110111 = 101110 + 001001 = 110111$$ with $110111$ being in two's complement (since it has a leading $1$, hence, equivalent to binary $-001001 \; = \;-1001$

The trick I use to go back and forth from two's complement is to switch ALL digits (reverse $1\to 0, 0 \to 1$, then add one bit $1$ ($+000001$ in this case)

0
On

$110111$ is correct after performing the addition. The leftmost bit is a $1$, indicating that it's a negative number. Use the two's complement on $110111$ to get $001001$, then remove the leading $0$s and add the negative to get $-1001$.

2
On

Convert the subtacthend to two's complement and add:

101110−110111 = 101110 + 001001 = 110111

Now, we have a 1-bit as the MSB, telling us that this is a negative number in 2's complement form, so take the two's complement and keep the negative sign.

Thus, we have ( - 001000 + 1 ) = -1001.

2
On

Well, when I have to substract a bigger number from a smaller one I just flip over the numbers , make the substraction and change sign, say:

$$12-34 =-(34-12)=-22$$

Why not do the same here? Remember: in binary, $\,1-1=0\;,\;1-0=1\;,\;\,0-1=1$...and we carry one, etc. , so:

$$110111-101110 \Longrightarrow\begin{cases}110111\\-\\101110\\........\\001001\end{cases}$$

and now change sign: $\, 101110-110111 =-1001\,$ , and in decimal: $\,46-55=-9\,$