# Understanding Complements Arithmetic: One's & Nine's in Decimals & Binary

• King
In summary, WaterRain seems to be confused about what one's and two's complement are. She is also confused about the difference between one's and two's complement.

#### King

Hi all,
I'm working on some one's and two's complement questions and with the help of Wikipedia, am trying to understand it. However, I am quite confused as I seem to be getting wrong answers sometimes, thus I have come here for some clarification ;)

Take the following sum:
3694
2468 -
1226

Using nine's complement one would perform the following calculations:
9-2 = 7
9-4 = 5
9-6 = 3
9-8 = 1

then, I would perform the following calculation:
3694
7531
___1 +
11226

and then drop the 1.
That would result in 1226 being the answer which is correct. Now, that was nine's complement, and from further reading it states that ten's complement is nine's complement + 1...so I am assuming they don't mean +1 to 1226, but +1 during the calculation like what I did above. So why is it called ten's complement if it does not affect how I perform the calculation? If I were working in hexadecimals perhaps this would make sense to me, but I am working in decimal so why work out the ten's complement if you have worked out the nine's complement? Not just this, but why would I even go through the entire process if the answer was uncovered in the first step (I worked out 1226 on the 9th line of this post).

Next, moving onto binary, say I wish to perform the following calculation:
47 - 28 = 19
which in binary is 101111 - 11100 (I think)
Using one's complement, I would do the following:
101111
011100 -
110001

and then performing the one's complement act:
1-0 = 1
1-1 = 0
1-1 = 0
1-1 = 0
1-0 = 1
1-0 = 1

and then:
101111
100011 +
101100
111110 +
110010

but as far as I know, 19 in binary is 10011.
Thus, my answer is wrong, and I have no idea why

If you can explain these complement arithmetic problems to me I will be very grateful!

Thanks for any help

Hi King,

I'm very new to Complements as I just ask around recently - https://www.physicsforums.com/showthread.php?t=312168

Anyway, I would like to attempt on your problem.

In dec,
47 - 28 = 19

In bin,
101111
011100 -
010011

and then performing the one's complement act:
1-0 = 1
1-1 = 0
1-1 = 0
1-1 = 0
1-0 = 1
1-0 = 1

and then:
0101111
0100011 +
1010010
remove the MSB and add to the LSB
010010
000001 +
010011

I'm still new so it's better for the Gurus to clarify.

Hey WaterRain,
Thanks for having a go

I realized in my calculations here:
King said:
101111
100011 +
101100
111110 +
110010
That if I were to drop the 1 on the far left hand side and add it to the new byte then I would get the correct answer. However, what confuses me is the differences between one's and two's complement

King said:
Hey WaterRain,
Thanks for having a go

I realized in my calculations here:

That if I were to drop the 1 on the far left hand side and add it to the new byte then I would get the correct answer. However, what confuses me is the differences between one's and two's complement

I'm not too sure either.

To me, one's complement is simply the inversion of bits.
While two's complement can represent negative values and work in addition/subtraction.

I'm a little confused on what I wrote myself as well.
Sure there's a better explanation somewhere..

## 1. What is the significance of One's and Nine's in decimals and binary?

The One's and Nine's in decimals and binary are important because they represent the place value system used in these number systems. The One's place represents the units or ones, while the Nine's place represents the tens. This pattern continues as the digits move to the left, with each place representing a higher power of 10.

## 2. How do One's and Nine's complement arithmetic work in decimals?

In decimal numbers, the One's complement is found by subtracting each digit from 9. For example, the One's complement of 532 is 467, as 9-5 = 4, 9-3 = 7, and 9-2 = 8. The Nine's complement is found by adding 1 to the One's complement. In our example, the Nine's complement of 532 is 468. This arithmetic is used in subtraction, particularly when dealing with negative numbers.

## 3. Can One's and Nine's complement arithmetic be applied to binary numbers?

Yes, One's and Nine's complement arithmetic can also be applied to binary numbers. In binary, the One's complement is found by flipping the bits (changing 0 to 1 and 1 to 0). For example, the One's complement of 1011 is 0100. The Nine's complement is found by adding 1 to the One's complement, so in our example, the Nine's complement of 1011 is 0101.

## 4. When is it useful to use One's and Nine's complement arithmetic?

One's and Nine's complement arithmetic is useful in situations where we want to represent negative numbers in a binary system. It simplifies the process of subtraction and makes it easier to represent both positive and negative numbers using a fixed number of bits. It is also used in error checking and data encryption algorithms.

## 5. Are there any drawbacks to using One's and Nine's complement arithmetic?

One potential drawback of using One's and Nine's complement arithmetic is the possibility of overflow or underflow. In some cases, the result of the arithmetic may exceed the number of bits allocated for the number, leading to an incorrect result. This can be mitigated by using a larger number of bits or by using alternative methods such as Two's complement arithmetic.