Multiplication


The example below shows multiplying 100010 by 100110. For reasons that will become clear shortly, we limit this decimal example to using only the digits 0 and 1. Multiplication takes the digits of the multiplier one at a time from right to left, multiplying the multiplicand by the single digit of the multiplier, and shifting the intermediate product one digit to the left of the earlier intermediate products.

The number of digits in the product is considerably larger than the number in either the multiplicand or the multiplier. In fact, if we ignore the sign bits, the length of the multiplication of an n-bit multiplicand and an m-bit multiplier is a product that is n+m bits long.
  Multiplicand      100010  
  Multiplier   ×    100110
              ————————————  
                    1000
                   0000
                  0000
               + 1000
              ————————————
  Product        100100010

That is, n+m bits are required to represent all possible products. Hence, like add, multiply must cope with overflow because we frequently want a 32-bit product as the result of multiplying two 32-bit numbers. In the above example, we restricted the decimal digits to 0 and 1. With only two choices, each step of the multiplication is simple:
  1. Just place a copy of the multiplicand (1 × multiplicand) in the proper place if the multiplier digit is a 1, or

  2. Place (0 × multiplicand) in the proper place if the digit is 0.
Although the decimal example above happens to use only 0 and 1, multiplication of binary numbers must always use 0 and 1, and thus always offers only these two choices.