GCD and LCM: Find Both by Hand, With Worked Examples
The greatest common divisor (GCD, also called the highest common factor or HCF) of two whole numbers is the largest number that divides both. The least common multiple (LCM) is the smallest number that both divide into. For 36 and 48, the GCD is 12 and the LCM is 144.
The rest of this guide shows how to get those answers by hand, the link between GCD and LCM, and where they are used.
What is the GCD?
The greatest common divisor (also called the greatest common factor or highest common factor) of two integers is the largest positive integer that divides both numbers evenly. For two integers and :
Example 1: GCD by listing factors
Find :
Factors of 36: 1, 2, 3, 4, 6, 9, 12, 18, 36
Factors of 48: 1, 2, 3, 4, 6, 8, 12, 16, 24, 48
Common factors: 1, 2, 3, 4, 6, 12
Methods for finding the GCD
Method 1: Prime factorisation
Express each number as a product of prime factors, then take the product of the common prime factors raised to their lowest powers.
Example 2: GCD by prime factorisation
Find :
Take the smaller power of each prime:
Method 2: The Euclidean algorithm
The Euclidean algorithm is much faster than listing factors or factorising when the numbers are large. It is based on the fact that , and repeats until the remainder is zero:
Example 3: Euclidean algorithm
Find :
The last non-zero remainder is 21, so .
Method 3: Extended Euclidean algorithm
The extended Euclidean algorithm also finds integers and such that:
This is Bezout's identity. It is how modular inverses are found, which is used in RSA encryption.
Example 4: Extended Euclidean algorithm
Find and such that . Working backwards from the divisions above gives and , and indeed:
What is the LCM?
The least common multiple of two integers is the smallest positive integer that is divisible by both numbers:
Example 5: LCM by listing multiples
Find :
Multiples of 4: 4, 8, 12, 16, ...
Multiples of 6: 6, 12, 18, ...
LCM by prime factorisation
Express each number as a product of primes, then take the product of all prime factors raised to their highest powers.
Example 6: LCM by prime factorisation
Find :
The GCD-LCM relationship
One property connects the two:
So you can compute the LCM from the GCD, and the other way round:
Example 7: Using the relationship
Find using the GCD we already computed:
GCD and LCM of more than two numbers
To find the GCD or LCM of more than two numbers, apply the operation one number at a time:
Example 8: GCD of three numbers
Find :
So .
Properties of GCD and LCM
- Commutative: and .
- Associative: .
- Identity: and .
- Coprime numbers: If , then and are coprime, and .
- Divisibility: divides both and , and both divide .
Where the GCD is used
- Simplifying fractions: Divide numerator and denominator by their GCD. For example, .
- Modular inverses: The extended Euclidean algorithm finds them, which RSA encryption uses.
- Tiling: The largest square tile that exactly covers a floor of metres has side , as the squares diagram shows.
Where the LCM is used
- Adding fractions: The least common denominator is the LCM of the denominators. For , the least common denominator is .
- Scheduling: If one event repeats every 4 days and another every 6 days, they coincide every 12 days.
Worked example: a scheduling problem
Example 9: Bus schedules
Bus A departs every 15 minutes and Bus B departs every 20 minutes. If both depart at 9:00, when do they next depart at the same time?
They next depart together after 60 minutes, at 10:00.
Worked example: fraction addition
Example 10: Adding fractions with the LCM
Add :
Convert and add:
Common mistakes
- Confusing GCD with LCM. The GCD is never larger than either number. The LCM is never smaller than either number.
- Using the wrong powers in prime factorisation. For the GCD, take the smaller power. For the LCM, take the larger power.
- Forgetting . Every integer divides zero.
- Not checking the final fraction. After dividing by the GCD, the numerator and denominator should have a GCD of 1.
Try it yourself
Compute the GCD and LCM of two numbers or a whole list with the free GCD & LCM Calculator. It shows the Euclidean algorithm and prime factorisations step by step. For all the factors of a number, use the Factor Calculator, and to put the LCM to work on fractions, the Fraction Calculator.
Related Articles
Mastering Fractions: How to Add, Subtract, Multiply, and Divide
A complete guide to fraction arithmetic. Learn how to find common denominators, simplify fractions, and perform all four operations with worked examples.
Fraction Shortcuts and Tricks for Faster Maths
Speed up your fraction calculations with the butterfly method, cross-cancellation, the benchmark method, and quick conversion tricks. Practical shortcuts with examples.
Ratios and Proportions: A Complete Guide with Examples
Learn how to work with ratios and proportions, including simplification, cross multiplication, direct and inverse proportion, and real-world applications.