# Binary multiplication and division

How to work with binary multiplication or division

Written by: Magnus Ferm

2009-05-17 15:37:02

# Binaries and multiplication

This article will show how to use multiplication and division with binaries. We'll begin with multiplication.

There are, as in adding and subtracting, a set of rules to follow:

Equation | Answer |
---|---|

0 * 0 | 0 |

1 * 0 | 0 |

0 * 1 | 0 |

1 * 1 | 1 |

Well, it's pretty much like normal multiplication here. If you multiply something with nothing you get nothing. The only way to get a value is to multiply two ones.

If you know how to subtract and add (which you should before trying anything else) multiplication is really easy, here is a picture showing how to multiply 110 with 10:

As we can see, it's done just like normal math. First we Multiply the 0 with 110 and then the 1 with 110, like this:

After we've done the multiplying it's a just the adding that's left:

And so we end up with this:

That's how easy it is!

Worth noticing is that when we multiply 1 with 110 it should only end up with 110 shifted one step to the left when we write up the equation, but we add a zero anyway since it doesn't change the equation but does make it easier to read.

Here is another example:

Let's multiply 101011 with 110 and see what happens:

We get three rows with answers, which seems right since the multiplier has three digits. We also get carried values since 1 + 1 = 10.

# Binary Division

Binary division works just as decimal division by repeating subtraction. Here is an example:

What we do is that we try to divide from the left to the right. 1 can't be divided by 110 and neither can 11, but 110 can be divided with 101 one time. So we add a one in the row above. We then multiply that 1 with the divisor (101) and get 101. We subtract 101 from 110 and get 1, add the next number to divide with (1) and we try to divide 11 with 101. That can't be done so we add a 0 to the roof and multiply that with the divident and get 0 (this doesn't really have to be written out).

We then add the last 0 in the dividend and divide 110 with 101 which goes one time. Multiply that 1 with 101 and subtract it from what remains and we get 1. The number at the top is the answer, the number at the bottom is the remainder.

That was not a very educational explanation so let's run through it step by step with a better picture:

**A:**The divisor

**B:**The quotient

**C:**The dividend

**D:**The remainder

Let's split this in to three steps. I've written three notes to the left of the equation that will hopefully explain each step. Each note has a number in red, so we'll go by the numbers:

## Step 1

We couldn't divide 1 by 101 nor 11, but 110 could be divided by 101 one time thus we add 1 to the quotient.

We multiply that 1 with the dividend (we get 101).

We subtract the answer from the above step from the part of the dividend that we've just used and add the next number from the dividend (we get 11)

## Step 2

We can't divide the answer from step 1 with 101 (11 can't be divided by 101) so add a 0 to the quotient.

Multiply that 0 with the divisor (we get 0).

Add the 0 to the table (we add three zeroes for improved visual effects) and subtract 0 from 11. We end up with the same number (of course). Add the next digit from the dividend (0).

## Step 3

Divide the remaining value (110) with 101 and add 1 to the quotient.

Multiply that 1 with the dividend (we get 101).

Subtract 101 from 110 and we end up with 1. Since we can't add anything more and 1 can't be divided by 101 that will have to be a remainder.

The answer is the quotient, 101 with a remainder of 1. If we take a look at this in decimal form we can verify it:

Binary | Decimal |
---|---|

11010 | 26 |

101 | 5 |

Thus the answer is

**26 / 5 = 5**(with a remainder of 1), and that is correct.

**Note**: The subtraction when working with division follows the rules of normal binary subtraction which means that 1-1 = 0 but 10 - 1 = 1.