# Math Help - 2s Complement

1. ## 2s Complement

Can someone explain 2s complement to me?

I need to know the 2s complement of the following 0 0000101 1101111000.

thanks

2. Hello, sjenkins!

Can someone explain 2s complement to me?

I need to know the 2s complement of the following: 0 0000101 1101111000.

We need a lot more information . . . but I'll take a wild guess . . .

The "2s complement" is found by subtracting each digit from 2.

The 2-complement of $0$ is $2$

The 2-complement of $0000101$ is $2222121$

The 2-complement of $1101111000$ is $1121111222$

3. Hello,

Originally Posted by Soroban
Hello, sjenkins!

We need a lot more information . . . but I'll take a wild guess . . .

The "2s complement" is found by subtracting each digit from 2.

The 2-complement of $0$ is $2$

The 2-complement of $0000101$ is $2222121$

The 2-complement of $1101111000$ is $1121111222$

Isn't that binary strings ?

So that the complement of 1 is 0 and the complement of 0 is 1 ? Like talking about the modulus, in sort of a way..

4. Yes, it is binary, I'm sorry I didn't say that in the original post. I thought I had but I guess not.

So, if a number is 1011011 the complement is 0100101 right?

But what if it ends in a 0 like 1011010, is the complement 0100100?

5. If we have a 8-bit representation of a number, for example 1001 0011. To find det complement you just flip the bits and add 1:

0110 1100 + 1 = 0110 1101.

Example: calculate 123 - 3 (8-bits representation)

123 = 0111 1011
3 = 0000 0011

Complement of 3: 1111 1100 + 1 = 1111 1101

Just add 123 with the complement of 3:
0111 1011 + 1111 1101 = 1 0111 1000

You see that we now have an overflow of 1 bit. We just remove the one bit to the left and get: 0111 1000 = 120

Hope this helps.