Posted August 27, 2014 By Presh Talwalkar. Read about me , or email me .

I have posted a video on YouTube about a weird way to multiply numbers. You can multiply any two whole numbers if you know how to divide numbers in half and double numbers.

Here is a link to the video.

The Egyptian Method / Russian Peasant Multiplication

In the remainder of this post, I offer a proof of why the method works.

.

.

"All will be well if you use your mind for your decisions, and mind only your decisions." Since 2007, I have devoted my life to sharing the joy of game theory and mathematics. MindYourDecisions now has over 1,000 free articles with no ads thanks to community support! Help out and get early access to posts with a pledge on Patreon. .

.



The Steps to Egyptian Method / Russian Peasant Multiplication

To multiply numbers X and Y, the steps are.

1. Divide X in half repeatedly, ignoring remainders, until you get to 1. 2. Correspondingly double Y repeatedly, writing each new value in a row next to the halved X values. 3. Cross out the rows where the halved X values have an even number. 4. Add up the remaining numbers in the Y column.

For example, to calculate 13 x 24, the first step is to divide 13 in half, ignoring remainders. So we get the following table.

13

6

3

1

The next step is to double the values of 24.

13 24

6 48

3 96

1 192

Now we remove any rows starting with an even number. The only row in this example is the one that starts with the number 6.

13 24

6 48

3 96

1 192

Finally we add up the remaining numbers in the second column. Adding up 24, 96, and 192 gets the result of 312. And in fact, 13 x 24 = 312.

Now we explore why this works.

Detailed Example of Egyptian Method / Russian Peasant Multiplication

To understand what is going on, we will go through the mechanics of why this method works. Since we are dividing numbers in half, and doubling numbers, it is natural that we consider how the numbers work in binary, or base 2 arithmetic.

Let’s consider the example of 13 x 24 in detail. First, let’s express 13 as the sum of powers of 2. By testing out some possibilities, you can figure out that 13 is equal to 8 + 4 + 1.

Now we can re-write these terms as powers of 2. Namely we have 1 = 20, 4 = 22, and 8 = 23. So we can write out the following.

13 = 8 + 4 + 1

13 = 23 + 22 + 20

In our summation we have powers of 0, 2, and 3, and we are skipping the power of 1, which is 21 = 2. This means we have 0 terms of 21. Let us write this missing term in our formula.

13 = 23 + 22 + (0)21 + 20

Now let’s emphasize we have 1 term of 23, 22, and 20 each.

13 = (1)23 + (1)22 + (0)21 + (1)20

The bolded coefficients are the binary representation of 13. That is, 13 = 1101.

What happens when we multiply 13 by 24? Let’s multiply both sides by 24.

13 x 24 = [(1)23 + (1)22 + (0)21 + (1)20] x 24

We can distribute the term 24 to get the following.

13 x 24 = 24(1)23 + 24(1)22 + 24(0)21 + 24(1)20

Let’s reverse the terms on the right side.

13 x 24 = 24(1)20 + 24(0)21 + 24(1)22 + 24(1)23

Now let’s write each term of the right-hand side in a table.

1 24(20)

0 24(21)

1 24(22)

1 24(23)

The terms in the right-hand column are found by doubling 24 repeatedly–as each time we are multiplying by 2. So that’s why we repeatedly double the numbers in the right hand column.

Let’s add back in the terms for 13 when we repeatedly half it.

1 13 24(20)

0 6 24(21)

1 3 24(22)

1 1 24(23)

This table explains what is going on. Dividing 13 in half repeatedly gets us the binary representation. The even numbers exactly correspond to the 0 terms, which we cross out and do not add.

1 13 24

0 6 48

1 3 96

1 1 192

This explains why the specific problem works. We’ll prove the method formally in the last part of this post.

Proof of Egyptian Method / Russian Peasant Multiplication

Let’s multiply X by Y.

First write X in binary, X = Σ c i 2i

When we multiply by Y, we have the following.

XY = (Σ c i 2i)Y

XY = Y c 0 20 + … + Y c k 2k

In other words, XY is equal to the sum of Y times powers of 2. The terms c i are either 1 or 0, and only the non-zero terms contribute something to the final sum.

If X is odd, then c 0 = 1. If X is even, then c 0 = 0. In other words, we retain the first row of our table if and only if X is odd.

Dividing X in half, we get

X/2 = c 1 + (c 2 21 + … + c k 2k – 1) + c 0 /2

The term c 0 /2 is a “remainder” in this process that we will discard. So we have

X/2 – remainder = c 1 + (c 2 21 + … + c k 2k – 1)

Notice that c 1 = 1 if and only if X/2 – remainder is odd, and it will be equal to 0 if and only if X/2 – remainder is even. In other words, we should retain the second row if and only if X/2 – remainder is odd.

If we divide in half once again and ignore the remainder, we can recover the term c 2 , which will be 1 if and only if that term is odd. We can continue dividing in half to recover more terms of the binary expression of X.

Putting it all together, we have:

1. Dividing X in half repeatedly, ignoring the remainder, gives the coefficients for the binary expression of X.

2. Multiplying the binary expression of X yields a sum of Y times powers of 2. We only need to add the non-zero terms, which correspond to the halved terms of X that are odd.