# Toom-Cook multiplication for dummies posted April 2014

We're learning a lot of algorithm in my **algebre et calcul formel** class. One of them is the **Toom-Cook algorithm** used for multiplication of large integers.

I found a super simple explanation of it on a forum, it helps:

Say, we want to multiply 23 times 35.

We write,

p(x) = 2x + 3,

q(x) = 3x + 5.

We are using our realization that any integer can be written as a polynomial.

Here, p(x), represents 23, and q(x), represents 35, when x equals 10.

We write,

p(x)q(x) = r(x).

That is, p(x) times q(x), equals r(x).

So,

(2x + 3)(3x + 5) = ax^2 + bx + c = r(x).

Now,

p(0)q(0) = r(0).

So,

(20 + 3)(30 + 5) = a0 + b0 + c.

Therefore,

c = 15.

Now,

p(1)q(1) = r(1).

Therefore, when we do the substitutions (for x and c),

a + b = 25.

Now,

p(-1)q(-1) = r(-1).

Therefore, when we do the substitutions (for x and c),

a - b = -13.

Now, we already know c, and we just need to find a and b.

We have two linear equations and two unknowns,

a + b = *25,

a - b = -13.

We just add the two equations and we get,

2a = 12.

Therefore,

a = 6.

Now, we can substitute 6 for a in,

a + b = 25,

and we get,

b = 19.

So,

r(x) = 6x^2 + 19x + 15.

Now, we substitute 10 for x in r(x), and we are done,

r(10) = 600 + 190 + 15 = 805.

Believe it or not!

## Chris

Isn't a, b and c more simply found by multiplying out (2x + 3)(3x + 5)= 6x^2 + 19x + 15 = r(x)?

## Mark

For a small number like this of course you can simply multiply the two polynomials. But for larger numbers it's more efficient to follow the above steps. (Nice article btw. More info can be found also on wikipedia with a bigger example: https://en.wikipedia.org/wiki/Toom%E2%80%93Cook_multiplication)