Skip to main content

Subtraction of Numbers

Complement of a Number   Octal and Hexadecimal Number   Convert Decimal to Binary

Subtraction of numbers by using complement


Subtraction with r’s Complements

The direct method of subtraction taught in elementary schools uses the borrow concept. In this method, we borrow a 1 from a higher significant position when the minuend digit is smaller than the corresponding subtrahend digit. This seems to be easiest when people perform subtraction with paper and pencil. When subtraction is implemented by means of digital components, this method is found to be less efficient than the method that uses complements and addition as stated below.

     The subtraction of two positive numbers (M - N), both of base r, may be done as follows:

1.       Add the minuend M to r’s complement of the subtrahend N.

2.       Inspect the result obtained in step 1 for an end carry:

a.       If the end carry occurs, discard it.

b.      If an end carry does not occur, take r’s complement of the number obtained in step 1 and place a negative sign in front.

If you don't understand about r's complement Click Complement of a Number

The following example illustrate the procedure:

Ex1. Using 10’s complement subtract 72532 – 3250

Sol. M = 72532, N = 03250

       10’s complement of N = 96750

       Now add M + 10’s complement of N

       72352 + 96750 = 1 69282, where 1 is end carry, discard it as per step 1

       Now the answer is 69282

Ex2. Subtract 3250 – 72352

Sol. M = 03250

        N = 72352

        10’s complement of N = 27468

        Now add M + 10’s complement of N

        03250 + 27468 = 30718, There we don’t have any carry then we find 10’s complement of result 30718

        Which is -69282

Ex3. Subtract binary numbers 1010100 – 1000100 using 2’s complement

Sol. M = 1010100, N = 1000100

       2’s complement of N = 0111100

       Now add M + 2’s complement of N

       1010100 + 0111100 = 1 0010000, where 1 is end carry, discard as per step 1

       Now the answer is 0010000 or 10000

Ex4. Subtract binary numbers 1000100 – 1010100

Sol.  M = 1000100, N = 1010100

         2’s complement of N = 0101100

        Now add M + 2’s complement of N

        1000100 + 0101100 = 1110000, here we don’t have any carry then we find 2’s complement of result 1110000

        Which is -10000

 

Subtraction with (r  -1)’s complement

The procedure for subtraction with the (r - 1)’s complement is exactly the same as the one used with the r’s complement except for one variation, called ‘end-around carry,’ as shown below. The subtraction of M-N, both positive numbers in base r, may be calculated in the following manner:

1.       Add the minuend M to (r - 1)’s complement of the subtrahend N.

2.       Inspect the result obtained in step 1 for an end carry.

a.       In an end carry occurs, add 1 to the least significant digit (end-around carry).

b.      If an end carry does not occur, take the (r - 1)’s complement of the number obtained in step 1 and place negative sign in front.

The following examples illustrate the procedure.

Note we are using same examples which we have discussed in r’s complement

Ex1. M = 72532, N = 03250

Sol. 9’s complement of N = 96749

        Now add M + 9’s complement of N

        72532 + 96749 = 1 69281, where 1 is end around carry, let’s add this 1 in 69281

        The answer is 69281 + 1 = 69282

Ex2. M = 03250, N = 72532

Sol. 9’s complement of N = 27467

        Now add M + 9’s complement of N

        03250 + 27467 = 30717, here we don’t have any carry, then we find 9’s complement of 30717

        9’s complement of 30717 is -69282

Ex3. M = 1010100, N = 1000100

Sol. 1’s complement of N = 0111011

        Now add M + 1’s complement of N

        1000100 + 0111011 = 1 0001111, where 1 is end-around carry, let’s add this 1 in 0001111

        The answer is 0001111 + 1 = 0010000

Ex4. M = 1000100, N = 1010100

Sol. 1’s complement of N = 0101011

        Now add M + 1’s complement of N

        1000100 + 0101011 = 1101111, here we don’t have any carry, then we find 1’s complement of 1101111

        1’s complement of 1101111 is -10000


Comments

Popular posts from this blog

Complement of a Number

Subtraction of Binary Numbers  ;  Octal and Hexadecimal Number  ;  Convert Decimal to Binary Complements Complements are used in digital computers for simplifying the subtraction operation and for logical manipulations. There are two types of complements for each base-r system: (1) the r’s complement and (2) the (r-1)’s complement. When the value of the base is substituted, the two types receive the names 2’s and 1’s complement for binary numbers,  10’s and 9’s complement for decimal numbers. The r’s Complement Given a positive number N in base r with an integer part of n digits, the r’s complement of N is defined as r n   - N for N is not equal to 0 and 0 for N = 0. The following numerical example will help clarify the definition. The 10’s complement of (52520) 10 is 10 5 – 52520 = 47480 The number of digits in the number is n= 5 The 10’s complement of (0.3267) 10 is 1 – 0.3267 = 0.6733 No integer part, so 10 n = 10 0 = 1 The 10’s...

Rules of divisibility part -1

Rules of divisibility In Vedic mathematics, it can be determined whether any part of any other number can be given completely without dividing it by several methods. These methods are based on the law of divisibility. By using these rules, calculations related to factors, parts etc. are simplified. Law of divisibility by number 2 :- If unit digit of given number is divisible by 2 then the given number is divisible by 2 also.                                                                 or  If unit digit of given number is 0,2,4,6 or 8 , then given number is divisible by 2. Example :- 10 ,32 ,74 ,108 ,2058 etc. Law of divisibility by number 3 :- If the sum of digits of given number is divisible by 3, then the number is divisible by 3 also. Illustration 1:-  In 546532 sum of digits=5+4+6+5+3+2=25 25 is not divisible...

Octal and Hexadecimal Number

Complement of a Number    Types of Number system    Convert Decimal to Binary If you are new to this article, I strongly recommend to read our previous article before preceding this. In our previous article, we had already seen that binary number has a base of 2. It means that binary number contains 2 1 = 2 combinations which are 0 and 1. Similarly, Octal and Hexadecimal number has a fixed number of combinations. As we earlier know that octal has a base 8, then it contains 8 digits through 0 to 7 which means 2 3 =8 combinations and Hexadecimal has a base 16 which means it has 2 4 =16 combinations.                 If you are focusing on a sequence i.e. octal, hexadecimal. They are the combinations of increasing power of 2. Octal – 2 3 , Hexadecimal - 2 4 This power indicates how many bits are in a number for a particular number system Octal has 3 bits Hexadecimal has 4 bits T...