Better to know some... than all 


1^{s} and 2^{s} ComplementTo perform a binary subtraction you first have to represent the number to be subtracted in its negative form. This is known as its two's complement. The two's complement of a binary number is obtained by: 1. Replacing all the 1^{s} with 0^{s} and the 0^{s} with 1^{s}. This is known as its one's complement. 2. Adding 1 to this number by the rules of binary addition. Now you have the two's complement. Example: The decimal subtraction 29  7 = 22 is the same as adding (29) + (7) = 22 1. Convert the number to be subtracted to its two's complement:
2. 11111001 now represents 7. 3. Add
4. Note that the final carry 1 is ignored. Subtracting using 1^{s} complementFor subtracting a smaller number from a larger number, the 1^{s} complement method is as follows: 1. Determine the 1^{s} complement of the smaller number. 2. Add the 1^{s} complement to the larger number. 3. Remove the final carry and add it to the result. This is called the endaround carry. Example: 1100110011 Result from Step1: 01100 Result from Step2: 100101 Result from Step3: 00110 To verify, note that 25  19 = 6 For subtracting a larger number from a smaller number, the 1^{s} complement method is as follows: 1. Determine the 1^{s} complement of the larger number. 2. Add the 1^{s} complement to the smaller number. 3. There is no carry. The result has the opposite sign from the answer and is the 1^{s} complement of the answer. 4. Change the sign and take the 1^{s} complement of the result to get the final answer. Example: 1001  1101 Result from Step1: 0010 Result from Step2: 1011 Result from Step3:  0100 To verify, note that 9  13 =  4 Subtracting using 2^{s} complementFor subtracting a smaller number from a larger number, the 2^{s} complement method is as follows: 1. Determine the 2^{s} complement of the smaller number. 2. Add the 2^{s} complement to the larger number. 3. Discard the final carry (there is always one in this case) Example: 11001  10011 Result from Step1: 01101 Result from Step2: 100110 Result from Step3: 00110 Again, to verify, note that 25  19 = 6 For subtracting a larger number from a smaller number, the 2^{s} complement method is as follows: 1. Determine the 2^{s} complement of the larger number. 2. Add the 2^{s} complement to the smaller number. 3. There is no carry from the leftmost column. The result is in 2^{s} complement form and is negative. 4. Change the sign and take the 2^{s} complement of the result to get the final answer. Example: 1001  1101 Result from Step1: 0011 Result from Step2: 1100 Result from Step3: 0100 Again to verify, note that 9  13 =  4 