Euclidean Algorithm
Find the greatest common factor of any two numbers by repeated division with remainder, and use it to simplify fractions and find the LCM.
Definition
Try it now
Worked Examples
Cut squares of side 18 from the long side
Cut squares of side 12 from the leftover
Cut squares of side 6
Tile the whole rectangle with the last square
Answer: The squares of side fit exactly, so . Each cut is one row of the algorithm.
Common Mistakes
Keeping the old large number: after , continuing with and
Why it's wrong: The algorithm works because . The number is no longer needed after the first division.
Correct: The next pair is : the old divisor and the remainder. So .
Giving or the last quotient as the GCF
Why it's wrong: The last row has remainder , which only tells you to stop. The quotient counts how many squares fit, it is not a common factor.
Correct: The GCF is the last nonzero remainder, the divisor in the final row. In it is .
Writing a remainder that is too big, like
Why it's wrong: The equation is true, but , so still fits into it. The remainder must be smaller than the divisor.
Correct: Take the largest quotient possible: with .
Taking as the LCM
Why it's wrong: is always a common multiple, but usually not the least one: counts the common factor twice.
Correct: Divide by the GCF: .
Interactive Visual
Largest squares in a rectangle: pick a pair
Rectangle 1071 × 462
Press Next step to cut off the biggest squares that fit.
Your turn: type the quotient and the remainder of each row
Rectangle 168 × 120
How many times does 120 fit into 168, and what is left over?
Interactive Sandbox
Expression Calculator
Try these:
History
No calculations yet
Practice Problems
18 problemsWhy It Matters
- Big numbers: factoring or into primes is slow, but three or four divisions give the GCF right away. For numbers with hundreds of digits, prime factorization is practically impossible, while the Euclidean algorithm still finishes in at most a few thousand quick steps.
- Fractions: to simplify you need , which is hard to see by factoring but quick with the algorithm.
- LCM: once you know the GCF, , so one algorithm gives both.
- Tiles, gears and screens: the largest square tile for a floor, when two gears line up again, and why a screen is all come down to the GCF.
- Internet security: encryption systems like RSA use an extended version of this algorithm every time you open a secure website.
Real World Applications
Tiling a Floor with the Largest Square Tiles
A tiler wants to cover a rectangular floor with equal square tiles without cutting any. The largest possible tile side is the GCF of the two lengths.
Example:
A cm by cm panel is covered exactly by cm squares: , so tiles.
A hallway floor is cm by cm. It must be covered with equal square tiles, with no cutting and no gaps.
What is the side of the largest square tile that works, in cm?
Step 1: Write the mathematical expression
Find with the Euclidean algorithm:
Gears and Repeating Cycles
When two gears turn together, the same pair of teeth meets again after a number of teeth equal to the LCM of the tooth counts. The Euclidean algorithm gives the GCF, and the LCM follows.
Example:
Gears with and teeth: , so the same teeth meet again after teeth.
A bicycle gear has teeth and a small gear has teeth. Two marked teeth touch now.
After how many teeth have passed do the two marked teeth touch again?
Step 1: Write the mathematical expression
Find :
Screen Aspect Ratios
A screen resolution like $1920 \times 1080$ is turned into an aspect ratio by dividing both numbers by their GCF.
Example:
: , so the ratio is .
A monitor has by pixels. To write its aspect ratio, you divide both numbers by their GCF.
What is ?
Step 1: Write the mathematical expression
Run the Euclidean algorithm on and :
Key Takeaways
- 1Euclidean algorithm: divide by as with , then replace by until the remainder is
- 2The GCF is the last nonzero remainder, the divisor in the final row
- 3It works because : both pairs have the same common divisors
- 4Geometrically, it cuts an rectangle into the largest possible squares; the last square side is the GCF
- 5The subtraction version subtracts the smaller number again and again; division is its shortcut
- 6Use it to simplify fractions, to find , and to test if two numbers are coprime (GCF )
Frequently Asked Questions
Glossary
- Euclidean algorithm
- A method for the GCF of two numbers: divide with remainder, replace the pair by (divisor, remainder), repeat until the remainder is
- Division with remainder
- Writing with , for example
- Quotient
- The number of whole times fits into
- Remainder
- The number left over after division, always smaller than the divisor
- Coprime (relatively prime)
- Two numbers whose GCF is , like and
- Least common multiple (LCM)
- The smallest positive number that both numbers divide;
Formula Card
Division with remainder
One row of the algorithm: $q$ is the quotient, $r$ the remainder
Key step
Replace the pair by (divisor, remainder) and repeat until $r = 0$
LCM from the GCF
Multiply the numbers and divide by their GCF
Coprime numbers
The numbers share no factor except $1$