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

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 by 3, Hence the number 546532 is not divisible by 3. Illustration 2:-  In  287286 sum of digits=2+8+7+2+8+6=33 33 is divisible by 3, Hence the number 287286 is divisibl

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 This can be clear understand by following diagram-   Explain – In this diagram, first we co

Hunters of the Animal World

    In the cycle of life, predators always occupy an important position. They are killers. But they kill, only to 'kill' their hunger. In fact, the story of the animal kingdom is full of predators trying to catch prey, and the prey trying to outwit predators. It is the balance between the two that takes the drama of life forward. In the wild, there is no place for the weak, whether it's the predator or the prey, and only the fittest survives. The hunters keep populations healthy by weeding out the old and the sick. Of course, there are also creatures that steal the prey caught by others, like hyenas.      We have collected information about some animals for which you must know. 1 . Bengal Tigers : The Bengal Tiger is found in the rainforests and grasslands of Bangladesh, Bhutan Burma, China, India and Nepal. Bengal tigers are extremely large, and the males are up to 3 meters in length. The Bengal tiger's fur is orange brown, with black stripes. It hunts deer, pigs, a