# Algorithm for multiplying numbers

## Background

Today I had to explain to some kid how to multiply numbers with multiple digits in them. Then I recalled, that some other day I answered this question describing one of the numerous so-called vedic math methods.

Essentially, the method sets up a scheme for multiplying digits by drawing crossing lines so that for instance $2\cdot 3$ would be represented by two lines crossing three lines and then you count the number of intersections. Naturally there would be $2\cdot 3=6$ points of intersection - no magic in that!

But there I indicated, that maybe that algorithm was not so relevant for multiplying large numbers or numbers with larger digits in them, since for instance counting the $56$ points of intersection for $7$ and $8$ lines respectively one-by-one would seem a tedious task. Then rather learn or recreate a table of multiples of $8$ and apply that.

Then I reckoned, that maybe skipping the line-drawing thing and rotating the scheme a bit would render the method a nice way of structuring the steps of a multiplication:

## Method


where the gray numbers are diagonal sums so that numbers of the same color are summed. Then we can fill in an appropriate number of zeros to each sum and then add them together

      111                    111
--------               --------
100000                 10
17000    or even       17
5700    skipping       57
290    zeros for       29
56    simplicity       56
--------               --------
123046                 123046


which then yields the correct result $517\cdot 238=123046$.

## Binary version

In binary we have 517 as $1000000101$ and 238 as $11101110$ so $238\cdot 517$ becomes $$\begin{array}{c|c:c:c:c:c:c:c:c:c:c|c} \cdot&\bf1&\bf0&\bf0&\bf0&\bf0&\bf0&\bf0&\bf1&\bf0&\bf1&\\ \hline \bf0&\red0&0&\green0&\blue0&\red0&0&\green0&\blue0&\red0&0&\\ \hdashline \bf1&\blue1&\red0&0&\green0&\blue0&\red0&0&\green1&\blue0&\red1&\grey{0}\\ \hdashline \bf1&\green1&\blue0&\red0&0&\green0&\blue0&\red0&1&\green0&\blue1&\grey{1}\\ \hdashline \bf1&1&\green0&\blue0&\red0&0&\green0&\blue0&\red1&0&\green1&\grey{1}\\ \hline \bf0&\red0&0&\green0&\blue0&\red0&0&\green0&\blue0&\red0&0&\grey{10}\\ \hdashline \bf1&\blue1&\red0&0&\green0&\blue0&\red0&0&\green1&\blue0&\red1&\grey{1}\\ \hdashline \bf1&\green1&\blue0&\red0&0&\green0&\blue0&\red0&1&\green0&\blue1&\grey{10}\\ \hdashline \bf1&1&\green0&\blue0&\red0&0&\green0&\blue0&\red1&0&\green1&\grey{1}\\ \hline &&\grey{1}&\grey{1}&\grey{1}&\grey{0}&\grey{1}&\grey{1}&\grey{1}&\grey{1}&\grey{1}&\grey{10} \end{array}$$ and therefore we can add them like this:

                  11111 1 1
-----------------------
1  .   . . .
1 .   . . .
1.   . . .
0   . . .
.1  . . .
. 1 . . .
.  1. . .
.   1 . .
.    1. .
.    10 .
.      1.
.      10
.        1
.        10
.          1
.           1
.            0
-----------------------
11110000010100110


to get the result of the multiplication. You can check that 123046 has binary representation $11110000010100110$. So it worked out well!

## Questions

2. What are the best methods you know of for the task of multiplication, and what make them particularly good/practical?

NB: This question received a close vote. I tried to clarify what I am asking in order to prevent the question from being closed. I ask for qualified arguments, not just opinions. Answerers must back up their claims by arguing why specific method are practical or impractical.

• If you don't mind a suggestion, "what do you think of this method and why?" is not a very good question for the site and might attract some close votes. I think your question will highly benefit from a more direct question, because it has some good context written. – Ian Mateus Aug 9 '14 at 0:34
• @IanMateus: I don't mind! On the contrary. I will think it over again and see if I can be more direct! – String Aug 9 '14 at 0:38
• @IanMateus: Is it more direct now? – String Aug 9 '14 at 0:44
• Yes, it is now. – Ian Mateus Aug 9 '14 at 0:52

I've seen and use a similar notation:

   5  1  7
+--+--+--+
|1/| /|1/|
1|/0|/2|/4|2
+--+--+--+
|1/| /|2/|
2|/5|/3|/1|3
+--+--+--+
|4/| /|5/|
3|/0|/8|/6|8
+--+--+--+
0  4  6


• You are only adding single-digit numbers down the diagonals. It's easy enough to just add everything (complete with carries) right there in place.
• You read/write numbers left to right and top to bottom, which, in my opinion, is more natural (at least for an English speaker)
• That is extraordinary! This way of structuring it has all the advantages I could possibly ask for, I think. I will try it and see how it works! – String Aug 8 '14 at 23:33
• Napier's bones was a popular calculating device that automates the construction of this diagonal table. It was invented by John Napier, the inventor of logarithms. – MJD Aug 9 '14 at 1:33

May I ask what the purpose of a method like this is? I looked at the original post including the video and I have looked over your question, but I can't figure out why one would use this. It is clever and I can appreciate what goes on to make it work, but I can't figure out of what use it may be.

By the way, I apologize for having to ask this as an answer, but I don't have enough reputation to comment yet.

• Fair question! I think there are three main reasons for having algorithms like this: 1. If someone wants to do multiplication by hand, and 2. If in addition to that the numbers seem difficult to maneuvre so that this persons has a desire to have it broken down into simpler parts 3. It is also nice knowing there is a safe way to carry out any multiplication instead of having to invent ways to break it down for specific numbers by nearby numbers that are easier to handle. – String Aug 8 '14 at 10:11
• As I mentioned I do think it is clever. I also think it is a little heavy on computation. For multiplying two three-digit numbers you used 9 multiplication operations and 9 addition operations. The binary illustrates how many more operations will be needed for a larger number (80 multiplications alone). And you would definitely have to be careful setting up the last column of addition. That is a lot of places to go wrong. – Patrick A. Aug 8 '14 at 20:10
• I understand your thinking with reasons 2 & 3 and I agree that this method does a nice job of combating those two problems. To me, the problems in 2 & 3 arise when trying to do mental math, though and I'm pretty sure the algorithm is too complex to do without pencil and paper. – Patrick A. Aug 8 '14 at 20:21
• If I am going to do a problem by hand, I would use old-fashioned long multiplication. To me, it sets the problem up in a much more concise framework and you don't have to worry about adding down diagonals or making sure that you arrange the partial sums before adding for the final answer. All of that is built into the framework of the problem. (I had originally thought there would be fewer calculations, but now that I write one out, it is actually the same number. So maybe yours isn't as computational heavy as I thought. For your example I had 9Mult and 9add). – Patrick A. Aug 8 '14 at 20:37
• Being a math nerd, I could totally see using an algorithm like this, but it would be when I wanted to just play around doing multiplication. I don't think I would use a method like this to teach someone how to multiply large numbers, unless they totally could not get it using long multiplication. Nice method though. – Patrick A. Aug 8 '14 at 20:41

Thanks again to Patrick A. for so generously sharing his thoughts on this! Here are some thoughts I have:

## Regarding this "new" method

1. It takes up a lot of space on a sheet of paper
2. It can be hard to keep track when adding diagonally. When doing it with pencil and paper I draw a frame around every second diagonal to keep track of it
3. While adding diagonally you will have to keep track of the running sum mentally - unless maybe you want to use even more space on your paper and do a separate calculation for each diagonal
4. When adding at the end the uppermost numbers seem to hover

I just did $3527\cdot412357$ and it worked really well. In that I found a few major advantages of the method:

1. Each step is so extremely simple that I hardly felt that I was making any effort to get there. My brain was merely idle while doing it
2. If you get the diagonals right, the risk of making an error is relatively small
3. Errors can be fixed with almost surgical precision since the steps are so explicit

Possible improvements

Maybe one could stack the partial sums in a more convenient manner. The partial sums for the $517\cdot 238$ example were 10, 17, 57, 29, 56 and could have been added as follows:

                111
--------
07796
11525
--------
123046


to save space and avoid the hovering.

Possible improvements Well, some may not find this an improvement, but if I were to multiply the example alluded to earlier in this answer, namely $3527\cdot412357$, I would consider writing down a table of multiples $1,2,...,7$ of $412357$ first (the highest digit of $3527$ being $7$). This could be done by repeated adding which rarely goes wrong.