cmathbinaryones-complement

How to show that two integers with a sum of zero have one's complement representations that are bit-complementary?


I've been stuck on this question for a while now:

Show mathematically that two integers that have a sum of zero have one’s complement representations that are bit-complementary.


Solution

  • Here is a simple proof and a counter example:

    One's complement representation by definition represents negative values with bit-complement. In other words -n is represented as ~n. If any two integers have a sum of zero, either they are both zero or one is the opposite of the other.