Subtracting binary numbers - Calculator

required files are loaded...
URL copied

About the calculator

This calculator performs the subtraction for 2 binary numbers. You can select whether regrouping or the Austrian method should be used. The binary numbers may be negative, but must have the same sign.

Subtracting binary numbers using regrouping

To illustrate how 2 binary numbers are subtracted with regrouping, the following subtraction should be performed:

100010102 − 1110001012

The two binary numbers are written one below the other in such a way that the larger number is at the top. If the two binary numbers have no fractional digits, they are written one below the other so that the last digits are one below the other. If the two binary numbers have fractional digits, they are written one below the other so that the binary points are underneath each other. Above the two numbers some space is left blank.

          
 111000101
 10001010
          

Then, starting from the right, try to subtract the digit of the bottom number from the digit of the top number for each column. If the difference between the digits is 0 or 1, then the difference is written into the solution.

          
 111000101
 10001010
         1

If the difference is negative, the upper digit must be increased by 102 (corresponds to 2 in the decimal system). To do this, you can cross out the 0 and write a 10 above it. The 10 is to be read as a binary number.

          
 111000101
 10001010
         1
        10 
 111000101
 10001010
         1

To increase the upper digit in a column, 1 must be subtracted from the upper digit one column to the left. If the upper digit is 1, this is possible without any problems. The 1 is then crossed out and a 0 is written above it.

       010 
 111000101
 10001010
         1

The 102 now replaces the 0 of the upper number. The subtraction can now be performed for this column.

       010 
 111000101
 10001010
        11

If the upper digit of the current column must be increased, but the upper digit one column to the left is 0, then this 0 must be increased by 102 before 1 is subtracted from it. In this case, the upper digit must be reduced by 1 in the next column to the left. If this is not possible without creating a negative number, then it must also be increased by 102 before it is reduced by 1, and one further column to the left, the upper digit must be reduced by 1. This is done until a 1 has been reached in the upper digit.

      10010 
 111000101
 10001010
       011
     1010010 
 111000101
 10001010
       011
     1010010 
 111000101
 10001010
       011
    101010010 
 111000101
 10001010
       011
    101010010 
 111000101
 10001010
       011
   0101010010 
 111000101
 10001010
       011
   0101010010 
 111000101
 10001010
   0111011

If a number has more digits before or after the binary point than the other, then there are columns in which there is no digit for either the upper or the lower number. Either you write a 0 in these places or you imagine that there would be a 0 in these places.

   0101010010 
 111000101
 10001010
 100111011

If the minuend and the subtrahend had to be swapped for the calculation (i.e. if the subtrahend was greater than the minuend), then the solution is negative.

The minuend 100010102 is smaller than the subtrahend 1110001012. Therefore, the minuend and the subtrahend had to be swapped for the calculation. The solution of the subtraction is therefore negative.
100010102 − 1110001012 = −1001110112
advertisement

Subtracting binary numbers using Austrian method

To illustrate how 2 binary numbers are subtracted using the Austrian method, the following subtraction should be performed:

1011002 − 100101012

To subtract one binary number from another using the Austrian method, the two numbers are first written one below the other. Make sure that the larger number is at the top. If the two binary numbers have no fractional digits, then they are written one below the other so that their last digits are underneath each other. If they both have fractional digits, then they are written so that the binary points of both binary numbers are underneath each other. One line is left blank below the two numbers.

 10010101
  101100
         
         

Then, starting from the right, try to subtract the digit of the bottom number from the digit of the top number for each column. If the difference is 0 or 1, it is written to the solution.

 10010101
  101100
         
      001

If the difference is negative, the upper digit must be increased by 102 (i.e. 2 in the decimal system). The 1 is written one column to the left below the two numbers.

 10010101
  101100
         
      001
 10010101
  101100
    1    
      001

After the upper digit has been increased by 102, the subtraction can be performed.

 10010101
  101100
    1    
     1001

If there is another 1 under the two digits in a column, it is mentally added to the digit of the lower number before it is subtracted from the digit of the upper number.

 10010101
  101100
    1    
    01001

If a number has more digits before or after the binary point than the other, then there are columns in which there is no digit for either the upper or the lower number. Either you write a 0 in these places or you imagine a 0 in these places.

 10010101
  101100
 11 1    
 01101001

If the minuend and the subtrahend had to be swapped for the calculation (i.e. if the subtrahend was greater than the minuend), then the solution is negative.

The minuend 1011002 is smaller than the subtrahend 100101012. Therefore, the minuend and the subtrahend had to be swapped for the calculation. The solution of the subtraction is therefore negative.
1011002 − 100101012 = −11010012
advertisement

Subtraction with negative binary numbers

both binary numbers are negative:

If both binary numbers of the subtraction are negative, first perform the subtraction with the absolute values of the numbers and then change the sign.

For example, the following subtraction is to be performed:

−10012 − (−112)

First, the subtraction is performed with absolute values:

 01010 
 1001
  11
 0110

Then the sign is changed:

−10012 − (−112)=−(10012 − 112)
 =1102

subtrahend is negative:

If the minuend is positive and the subtrahend is negative, then the minuend must be added with the absolute value of the subtrahend.

For example, the following subtraction is to be performed:

10012 − (−112)

The calculation is made:

 1001
+  11
  11 
 1100

The following therefore applies:

10012 − (−112)=10012 + 112
 =11002

minuend ist negativ:

If the minuend is negative and the subtrahend is positive, the positive absolute values of the two binary numbers are added first and then a minus sign is written in front of the solution.

For example, the following subtraction is to be performed:

−10012 − 112

The calculation is made:

 1001
+  11
  11 
 1100

So the following applies:

−10012 − 112=−10012 + (−112)
 =−(10012 + 112)
 =−11002
advertisement

good explanatory videos on Youtube

Share:FacebookTwitter