How Do You Correctly Subtract Using 1's and 2's Complement in Binary?

In summary, the conversation discusses the process of subtracting binary numbers using the method of taking the 1's complement and then the 2's complement. The speaker shares an example of 11-1 and explains how to find the 1's and 2's complement. However, they realize they made a mistake in not having an equal number of bits for the 1's complement and correct it to get the correct answer of 10 (or 2 in decimal).
  • #1
ineedhelpnow
651
0
(Wave)
i have to subtract binary numbers using the method where you take the 1's complement and then the 2's complement. but I am doing something wrong.

say for example 11-1. take 1's complement of 1 which is 0 and then take the 2's complement by adding 1 so 0+1=1 and now you go back and add this number to 11.

11+1=100 and you ignore the first value (1) and you end up with 00 and i know its TOTALLY messed up i just don't know where i went wrong. i know the actual answer should be 10 (or 2 in decimal)

thanks for any help
 
Technology news on Phys.org
  • #2
oh i see what i did wrong. it needs to be of an equal number of bits so 1 becomes 01 AND THEN i take the 1's comp
 

Related to How Do You Correctly Subtract Using 1's and 2's Complement in Binary?

1. What is the process for subtracting binary numbers?

The process for subtracting binary numbers is similar to subtracting decimal numbers. Start by aligning the numbers vertically, with the subtrahend (number being subtracted) below the minuend (number being subtracted from). Then, starting from the rightmost digit, subtract each pair of digits. If the minuend digit is smaller than the subtrahend digit, "borrow" 1 from the next digit to the left. Repeat this process until all digits have been subtracted.

2. How do I know when to borrow when subtracting binary numbers?

You only need to borrow when the minuend digit is smaller than the subtrahend digit. In this case, you will borrow 1 from the next digit to the left. If the next digit is also 0, you may need to continue borrowing from the next digit until you reach a digit that is 1.

3. Can negative numbers be represented in binary?

Yes, negative numbers can be represented in binary using a system called "two's complement." This involves flipping all the bits in a positive number and adding 1 to the result. For example, to represent -5 in binary, we would start with the binary representation of 5 (0101), flip all the bits (1010), and add 1 (1011).

4. Is there a shortcut or trick for subtracting binary numbers?

One trick for subtracting binary numbers is to use the "complement and add 1" method. This involves converting the subtrahend to its "one's complement" (flipping all the bits) and then adding 1. Then, you can simply add the two numbers together. This method can be especially useful when dealing with larger binary numbers.

5. How do I check if my answer is correct when subtracting binary numbers?

To check if your answer is correct when subtracting binary numbers, you can add the subtrahend to your answer. The result should be equal to the minuend. If it is not, then there was likely an error in your subtraction process.

Similar threads

Replies
5
Views
1K
  • Programming and Computer Science
Replies
3
Views
967
  • Engineering and Comp Sci Homework Help
Replies
1
Views
632
  • Programming and Computer Science
Replies
1
Views
5K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Programming and Computer Science
2
Replies
57
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Programming and Computer Science
Replies
17
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Programming and Computer Science
Replies
12
Views
3K
Back
Top