TExcelTAD
Home › Basic Math & Pre-Algebra › Multiplication

Multiplication

Multiplication is a fast way to add the same number many times: 4×64 \times 6 means six added four times, or four added six times. It also counts grids and areas, scales amounts up, and is the operation behind most of the arithmetic a computer does in graphics and machine learning.

Words and symbols

In 7×8=567 \times 8 = 56, the numbers being multiplied (7 and 8) are factors, and the result (56) is the product. Besides ×\times, you will see a centred dot (7⋅87 \cdot 8), brackets (7(8)7(8)), and in code an asterisk: 7 * 8.

Three pictures of the same idea:

  • Repeated addition: 3×5=5+5+5=153 \times 5 = 5 + 5 + 5 = 15.
  • Groups: 3 bags with 5 apples each hold 15 apples.
  • Arrays and area: a grid with 3 rows and 5 columns has 15 squares; a 3 cm by 5 cm rectangle has an area of 15 cm215\ \text{cm}^2.
text
● ● ● ● ●
● ● ● ● ●     3 rows × 5 columns = 15
● ● ● ● ●     turn it sideways: 5 rows × 3 columns = 15

The grid shows that order does not matter: 3×5=5×33 \times 5 = 5 \times 3.

Special factors

Rule Example Why
anything×1=itself\text{anything} \times 1 = \text{itself} 47×1=4747 \times 1 = 47 one group of 47
anything×0=0\text{anything} \times 0 = 0 47×0=047 \times 0 = 0 zero groups hold nothing
×10\times 10 adds a zero 47×10=47047 \times 10 = 470 every digit moves up one place
×100\times 100 adds two zeros 47×100=4 70047 \times 100 = 4\,700 every digit moves up two places
doubling twice =×4= \times 4 47×4=94×2=18847 \times 4 = 94 \times 2 = 188 4=2×24 = 2 \times 2

"×10\times 10 adds a zero" is place value: 4 tens and 7 ones become 4 hundreds and 7 tens.

Splitting a multiplication

The most useful trick in multiplication is to split one factor into easy parts, multiply each part, and add:

7×46=7×(40+6)=7×40+7×6=280+42=3227 \times 46 = 7 \times (40 + 6) = 7 \times 40 + 7 \times 6 = 280 + 42 = 322

This is the distributive property (more in Properties of Operations). Long multiplication on paper is just this trick done systematically, one digit of the second factor at a time:

text
        3 4 7
      ×   2 6
      -------
      2 0 8 2      347 × 6
    + 6 9 4 0      347 × 20
    ---------
      9 0 2 2

The second row ends in 0 because the 2 in 26 is really 20. The same computation in Python, one partial product per digit:

python · try it yourself
a, b = 347, 26
partials = []
place = 1
for digit in reversed(str(b)):
    p = a * int(digit) * place
    print(f"{a} x {int(digit) * place:>2} = {p}")
    partials.append(p)
    place *= 10
print("sum of partial products:", sum(partials))
print("check:", a * b)
347 x  6 = 2082
347 x 20 = 6940
sum of partial products: 9022
check: 9022

The times table

Knowing products up to 10×1010 \times 10 by heart makes everything else in this course faster. Python can print the table, and a nested loop shows how the rows are built:

python · try it yourself
size = 9
print("   " + "".join(f"{c:4d}" for c in range(1, size + 1)))
for r in range(1, size + 1):
    print(f"{r:2d} " + "".join(f"{r * c:4d}" for c in range(1, size + 1)))
      1   2   3   4   5   6   7   8   9
 1    1   2   3   4   5   6   7   8   9
 2    2   4   6   8  10  12  14  16  18
 3    3   6   9  12  15  18  21  24  27
 4    4   8  12  16  20  24  28  32  36
 5    5  10  15  20  25  30  35  40  45
 6    6  12  18  24  30  36  42  48  54
 7    7  14  21  28  35  42  49  56  63
 8    8  16  24  32  40  48  56  64  72
 9    9  18  27  36  45  54  63  72  81

The table is symmetric across its diagonal (because r×c=c×rr \times c = c \times r), so there are only 45 facts to learn, not 81. The diagonal (1, 4, 9, 16, …) holds the square numbers, which return in Exponents.

Tip: For the 9s, the digits of each product add up to 9 (18, 27, 36, …), and the tens digit is one less than the number you multiply by: 9×7=639 \times 7 = 63.

Multiplying many numbers

Python's math.prod multiplies a whole list, just as sum adds one. Multiplying several choices together counts combinations: 3 shirts ×\times 4 trousers ×\times 2 pairs of shoes give 24 outfits.

python · try it yourself
import math

print("outfits:", math.prod([3, 4, 2]))
print("pixels in a 1920 x 1080 screen:", 1920 * 1080)
print("bytes in that screen at 4 bytes per pixel:", 1920 * 1080 * 4)
outfits: 24
pixels in a 1920 x 1080 screen: 2073600
bytes in that screen at 4 bytes per pixel: 8294400

In software

  • Sizes and memory: an image of width×height\text{width} \times \text{height} pixels, each with 4 colour bytes, needs width×height×4\text{width} \times \text{height} \times 4 bytes.
  • Grids: a 2D grid stored in one list puts cell (row, col) at index row * width + col. Games and spreadsheets use this constantly.
  • Nested loops run outer×inner\text{outer} \times \text{inner} times, which is how you estimate a program's running time (see Growth Rates and Big-O).
  • Neural networks spend almost all their time multiplying numbers and adding the results: a matrix multiplication is millions of small "multiply and add" steps.

Exercises

Exercise 1: Split it

Compute 8×578 \times 57 in your head by splitting 57.

Answer

456

Solution
8×57=8×(50+7)=400+56=4568 \times 57 = 8 \times (50 + 7) = 400 + 56 = 456

Exercise 2: Long multiplication

Multiply 238×47238 \times 47 by hand, showing the partial products.

Answer

11 186

Solution
238×7=1 666238×40=9 520sum=11 186\begin{aligned} 238 \times 7 &= 1\,666 \\ 238 \times 40 &= 9\,520 \\ \text{sum} &= 11\,186 \end{aligned}
python · try it yourself
print(238 * 7, 238 * 40, 238 * 7 + 238 * 40, 238 * 47)
1666 9520 11186 11186

Exercise 3: Grid index

A game map is 12 cells wide and stored in one list, row by row. At which index is the cell in row 3, column 5 (both counted from 0)? Which row and column is index 50?

Answer

Index 41; index 50 is row 4, column 2.

Solution

index=row×width+col=3×12+5=41\text{index} = \text{row} \times \text{width} + \text{col} = 3 \times 12 + 5 = 41. Going back uses division: row=⌊50/12⌋=4\text{row} = \lfloor 50 / 12 \rfloor = 4 and col=50 mod 12=2\text{col} = 50 \bmod 12 = 2 (check: 4×12+2=504 \times 12 + 2 = 50).

python · try it yourself
width = 12
print(3 * width + 5)
print(50 // width, 50 % width)
41
4 2

Exercise 4: Count the outfits

A sandwich shop offers 4 breads, 6 fillings and 3 sauces, and you pick one of each. How many different sandwiches are possible? Check by listing them all with nested loops and counting.

Answer

72

Solution

4×6×3=724 \times 6 \times 3 = 72. Each bread can go with each of 6 fillings (24 pairs), and each pair with each of 3 sauces.

python · try it yourself
count = 0
for bread in range(4):
    for filling in range(6):
        for sauce in range(3):
            count += 1
print(count, 4 * 6 * 3)
72 72

Test yourself

What is 6×486 \times 48?

  1. 248
  2. 288
  3. 268
  4. 308

Why does the second row of a long multiplication like 347×26347 \times 26 end in a zero?

  1. It is a placeholder because that digit of 26 means 20
  2. It is a mistake
  3. Every product ends in zero
  4. To make the numbers line up nicely, with no meaning

Any number multiplied by 0 gives…

  1. the number itself
  2. 1
  3. 0
  4. it depends on the number