Find the additive inverse of binary number

3.8k Views Asked by At

My online assembly class doesn't really show us how to find the additive inverse of finding the additive inverse of binary, and I can't find much online. The question is: find the additive inverse of 0000 0000 1110 1111 1010 1101 0110 1100. Any insight on how to solve this or some steps would be great. Thanks.

2

There are 2 best solutions below

2
On BEST ANSWER

If we're dealing with $n$-bit binary numbers, i.e., only numbers in the range $0$--$2^n - 1$, and for a given $a$ we denote by $\bar a$ that $2^n$ bit number whose every bit is the opposite to that in the same position in $a$, then

$a + \bar a = \underset{\text{n bits}}{1 1 \ldots 1}; \tag 1$

then

$a + \bar a + 1 = \underset{\text{n bits}}{0 0 \ldots 0}; \tag 2$

thus

$-a \equiv \bar a + 1; \tag 3$

for example, with

$a = 1110, \tag 4$

we have

$\bar a = 0001, \tag 5$

$-a = \bar a + 1 = 0010; \tag 6$

it is easy to check that

$-a + a = a + \bar a + 1 = 1110 + 0010 = 0000; \tag 7$

again, with

$a = 1010, \tag 8$

$\bar a = 0101, \tag 9$

$-a = 1 + \bar a = 0110, \tag{10}$

and we see that

$1010 + 0110 = 0000. \tag{11}$

The reader may easily try this out/check it for larger values of $n$ than $4$.

It is important to remember that we are really dealing with arithmetic $\mod 2^n$, i.e., in $\Bbb Z_{2^n}$, where the elements are written in binary representation.

2
On

In mathematics, you just put a minus sign in front of it like you do a base $10$ number. In computer science, there are a number of ways to represent negative integers. I believe the most common is two's complement. You invert all the bits and add $1$. Another is sign-magnitude where you just change the first bit to $1$. Whoever is posing the question should define what format is being used. Without that, you cannot answer.