Sub topic 12
HCF and LCM of Fractions
This chapter assumes you can compute HCF and LCM of integers by prime factorization and Euclid's algorithm, and that you can reduce a fraction to lowest terms. It covers the formulas for the HCF and LCM of fractions, why they work, and the traps CAT questions set around them.
Why the integer definitions need adjusting
For integers, the HCF is the largest integer that divides each number exactly. The LCM is the smallest positive integer that each number divides exactly.
Fractions do not fit this directly. Every fraction divides every other fraction in the sense that 1/2 ÷ 1/3 = 3/2 is a valid number. So the definitions are tightened to keep the results meaningful:
- The HCF of fractions is the largest fraction that divides each given fraction and gives an integer as the quotient.
- The LCM of fractions is the smallest fraction that each given fraction divides and gives an integer as the quotient.
With these definitions, the HCF is the biggest "step size" that fits a whole number of times into every fraction. The LCM is the smallest value that is a whole number of copies of every fraction.
The formulas
Write each fraction in lowest terms first. This step is required. For fractions a/b, c/d, e/f, and so on:
- HCF = HCF(a, c, e, ...) / LCM(b, d, f, ...)
- LCM = LCM(a, c, e, ...) / HCF(b, d, f, ...)
The HCF takes the HCF of the numerators over the LCM of the denominators. The LCM takes the LCM of the numerators over the HCF of the denominators. The two formulas are mirror images.
Worked example 1
Find the HCF and LCM of 2/3, 8/9 and 16/81.
All three are already in lowest terms.
- Numerators: 2, 8, 16. HCF = 2, LCM = 16.
- Denominators: 3, 9, 81. HCF = 3, LCM = 81.
HCF = 2/81 and LCM = 16/3.
Check the HCF: (2/3) ÷ (2/81) = 27, (8/9) ÷ (2/81) = 36, (16/81) ÷ (2/81) = 8. All are integers.
Check the LCM: (16/3) ÷ (2/3) = 8, (16/3) ÷ (8/9) = 6, (16/3) ÷ (16/81) = 27. All are integers.
Why the formulas work
Take two fractions a/b and c/d in lowest terms. Bring them to the common denominator L = LCM(b, d). They become a·(L/b)/L and c·(L/d)/L. Their numerators are integers, so the problem reduces to finding the HCF or LCM of those integer numerators, measured in units of 1/L.
Because the fractions are in lowest terms, the factors L/b and L/d share no common factor with a and c in a way that changes the result. Working through the prime-power view makes this clear. For each prime p, let the exponent in a numerator be written as is, and the exponent in a denominator be written as a negative exponent. A fraction is then a product of prime powers with integer exponents, some negative.
- The HCF takes the minimum exponent of each prime. For a prime in a numerator the exponent is positive, and for a prime in a denominator it is negative. The minimum of a set of exponents picks the smallest numerator exponent, or the most negative denominator exponent, which is the denominator's LCM exponent.
- The LCM takes the maximum exponent of each prime. That picks the largest numerator exponent, or the least negative denominator exponent, which is the denominator's HCF exponent.
This is why the HCF has the LCM of the denominators below it, and the LCM has the HCF of the denominators below it. Lowest terms matters because a prime that appears in both a numerator and a denominator of the same fraction would be cancelled in the exponent view but not in the raw formula.
Computing it in code
The following program applies the formulas with Python's fractions module, which reduces to lowest terms automatically.
from fractions import Fraction
from math import gcd
from functools import reduce
def lcm(a, b):
return a // gcd(a, b) * b
def hcf_lcm_fractions(*fracs):
fracs = [Fraction(f) for f in fracs]
nums = [f.numerator for f in fracs]
dens = [f.denominator for f in fracs]
hcf = Fraction(reduce(gcd, nums), reduce(lcm, dens))
lcm_ = Fraction(reduce(lcm, nums), reduce(gcd, dens))
return hcf, lcm_
h, l = hcf_lcm_fractions(Fraction(2, 3), Fraction(8, 9), Fraction(16, 81))
print(h, l) # 2/81 16/3
# Unreduced input is reduced by Fraction before the formulas run
h, l = hcf_lcm_fractions(Fraction(6, 9), Fraction(4, 6))
print(h, l) # 2/3 2/3In the second call, 6/9 and 4/6 both reduce to 2/3. Both the HCF and the LCM are 2/3, which is correct because the two numbers are equal.
Handling mixed inputs
CAT questions often mix integers, decimals and fractions. Convert everything to lowest-term fractions first.
- An integer n becomes n/1. Its denominator is 1, which does not affect the denominator HCF or LCM except to force the denominator HCF to 1.
- A decimal such as 0.75 becomes 3/4. A decimal such as 1.2 becomes 6/5.
- A mixed number such as 2 1/4 becomes 9/4.
Worked example 2
Find the HCF of 1.5, 2/3 and 5.
Convert: 1.5 = 3/2, 2/3 stays, 5 = 5/1.
- Numerators: 3, 2, 5. HCF = 1.
- Denominators: 2, 3, 1. LCM = 6.
HCF = 1/6.
Check: 1.5 ÷ (1/6) = 9, (2/3) ÷ (1/6) = 4, 5 ÷ (1/6) = 30. All are integers.
An alternative method for decimals is to scale. Multiply every number by a power of 10 that clears the decimals, find the integer HCF or LCM, then divide by the same power of 10. For 0.12, 0.18 and 0.30, scale by 100 to get 12, 18, 30. The HCF is 6 and the LCM is 180. So the HCF is 0.06 and the LCM is 1.80. This works because scaling by a constant scales the HCF and LCM by the same constant.
A common CAT application
Typical questions ask for the smallest length that can be measured exactly by several rods, or the largest piece that divides several lengths.
Worked example 3
Three ropes measure 5/6 m, 7/4 m and 3/2 m. What is the length of the longest piece into which all three can be cut with no waste, and how many pieces result in total?
The piece length is the HCF.
- Numerators: 5, 7, 3. HCF = 1.
- Denominators: 6, 4, 2. LCM = 12.
HCF = 1/12 m.
Pieces: (5/6) ÷ (1/12) = 10, (7/4) ÷ (1/12) = 21, (3/2) ÷ (1/12) = 18. The total is 10 + 21 + 18 = 49 pieces.
Relation to the product rule
For two integers, HCF × LCM = product of the numbers. This also holds for two fractions. Using Example 1's style on 2/3 and 8/9:
- HCF = HCF(2, 8) / LCM(3, 9) = 2/9.
- LCM = LCM(2, 8) / HCF(3, 9) = 8/3.
- HCF × LCM = (2/9)(8/3) = 16/27.
- Product of the fractions = (2/3)(8/9) = 16/27.
The rule holds for exactly two fractions and does not extend to three or more, just as it fails for three integers.
from fractions import Fraction
a, b = Fraction(2, 3), Fraction(8, 9)
h = Fraction(2, 9)
l = Fraction(8, 3)
print(h * l == a * b) # TrueThis gives a quick way to recover a missing value. If you know the HCF, the LCM and one fraction, the other fraction is (HCF × LCM) ÷ the known one.
Common errors
- Skipping the reduction. Using 6/9 and 4/6 directly gives HCF(6, 4)/LCM(9, 6) = 2/18 = 1/9, which is wrong. The correct HCF is 2/3.
- Swapping the denominator operation. The HCF uses the LCM of denominators, and the LCM uses the HCF of denominators. Remember that a smaller step needs a larger denominator.
- Mixing the denominators up with the numerators. Take the HCF of numerators only with the LCM of denominators for the HCF result. Do not take the HCF of both.
- Applying the product rule to three fractions.
- Forgetting to convert integers. An integer has denominator 1, so it pulls the denominator HCF down to 1.
A quick sanity check
Two checks catch most mistakes.
- The HCF of fractions must be less than or equal to the smallest input, and each input divided by it must be an integer.
- The LCM of fractions must be greater than or equal to the largest input, and it divided by each input must be an integer.
If either check fails, the likely cause is an unreduced fraction or a swapped denominator operation.
Exercise
Find the HCF and LCM of 4/15, 6/25 and 10/9. Then verify that the LCM divided by each fraction is an integer.
Show answer
All three fractions are in lowest terms. Numerators 4, 6, 10 have HCF 2 and LCM 60. Denominators 15, 25, 9 have HCF 1 and LCM 225. HCF = 2/225. LCM = 60/1 = 60. Check: 60 ÷ (4/15) = 225, 60 ÷ (6/25) = 250, 60 ÷ (10/9) = 54. All are integers.
Exercise
The HCF of two fractions is 1/12 and their LCM is 5/2... one fraction is 1/4. Find the other fraction, and confirm that it gives the stated HCF and LCM with 1/4.
Show answer
HCF × LCM = (1/12)(5/2) = 5/24. Other fraction = (5/24) ÷ (1/4) = 5/6. Check with 1/4 and 5/6: numerators 1 and 5 have HCF 1 and LCM 5. Denominators 4 and 6 have HCF 2 and LCM 12. HCF = 1/12 and LCM = 5/2. Both match.
Exercise
Find the greatest length that can measure 0.6 m, 1.5 m and 2.7 m exactly, using the scaling method with decimals.
Show answer
Multiply by 10 to get 6, 15, 27. Their HCF is 3. Divide by 10 to get 0.3 m. Check: 0.6 ÷ 0.3 = 2, 1.5 ÷ 0.3 = 5, 2.7 ÷ 0.3 = 9.