Multiplying Fractions
Multiplying fractions is easier than adding them: multiply the tops, multiply the bottoms. This lesson explains why that works, how "of" means multiply, how to cancel before multiplying to keep numbers small, and how scaling by a fraction shows up in code.
The rule
No common denominator is needed:
Why it works: "of" means times
"Half of a quarter of a pizza" is . Cut the pizza into quarters, then cut one quarter in half: each small piece is of the pizza. So .
An area picture shows the general case. For , split a square into 3 rows and 4 columns (12 cells). Take 2 of the 3 rows and 3 of the 4 columns: the overlap has cells of 12, so the product is .
┌──┬──┬──┬──┐
│██│██│██│ │ ← row 1 of 3 (taken)
├──┼──┼──┼──┤
│██│██│██│ │ ← row 2 of 3 (taken)
├──┼──┼──┼──┤
│ │ │ │ │ ← row 3 (not taken)
└──┴──┴──┴──┘
3 of 4 columns taken → 6 of 12 cellsWhole numbers and mixed numbers
Write a whole number over 1, and turn mixed numbers into improper fractions first:
Note: is not . You would miss the cross terms. Always convert to improper fractions.
Cancel before you multiply
Any factor in a numerator can cancel with the same factor in any denominator, because the result is the same as simplifying at the end. That keeps the numbers small. Take :
Multiplying first gives , which also simplifies to , only with more work.
In Python
from fractions import Fraction as F
print(F(2, 3) * F(4, 5))
print(F(8, 9) * F(15, 16))
print(5 * F(3, 8))
print((2 + F(1, 2)) * (1 + F(1, 3)))
# fraction of a fraction of an amount
budget = 1200
print("1/4 of 2/3 of the budget:", F(1, 4) * F(2, 3) * budget)8/15
5/6
15/8
10/3
1/4 of 2/3 of the budget: 200
Multiplying makes things smaller (sometimes)
Multiplying by a fraction less than 1 shrinks a number; by a fraction greater than 1 it grows. That is the basis of scaling:
from fractions import Fraction as F
recipe = {"flour (g)": 450, "butter (g)": 200, "eggs": 3}
for factor in [F(2, 3), F(3, 2)]:
scaled = {k: v * factor for k, v in recipe.items()}
print(factor, {k: str(v) for k, v in scaled.items()})2/3 {'flour (g)': '300', 'butter (g)': '400/3', 'eggs': '2'}
3/2 {'flour (g)': '675', 'butter (g)': '300', 'eggs': '9/2'}
The fractions tell you honestly that of 200 g is g, and that eggs is not something you can buy. A real recipe app would round only for display.
Powers of fractions
Multiplying a fraction by itself squares top and bottom: , . You will use this in the exponents lessons.
In software
- Scaling images, UI and game objects: a 1600-pixel image at scale is 1200 pixels wide. Chaining zoom levels multiplies the factors.
- Probability of independent events: the chance of two coins both landing heads is . Games multiply drop chances the same way.
- Volume and opacity: a sound at volume through a channel at volume plays at ; a 50% transparent layer inside a 50% transparent group is 25% opaque.
Exercises
Exercise 1: Straight multiplication
Compute in lowest terms, cancelling first.
Answer
Solution
Exercise 2: Fraction of an amount
A game gives of a 2400-coin prize pool to second place. How many coins is that?
Answer
900 coins
Solution
Dividing by 8 first keeps the numbers small.
Exercise 3: Mixed numbers
A rectangle measures m by m. What is its area?
Answer
Solution
from fractions import Fraction as F
print((3 + F(1, 3)) * (2 + F(1, 4)))15/2
Exercise 4: Nested opacity
A UI element has opacity , inside a panel with opacity , inside a dialog with opacity . Using Fraction, find the final opacity and the percentage (rounded to one decimal).
Answer
, which is 50.0%.
Solution
Opacities multiply: . Cancel the 4s and the 5s: .
from fractions import Fraction as F
import math
final = math.prod([F(4, 5), F(3, 4), F(5, 6)])
print(final, f"{float(final):.1%}")1/2 50.0%
Test yourself
What is ?
Multiplying 12 by gives a result that is…
- bigger than 12
- equal to 12
- smaller than 12
- always a fraction
What is ?
- 2