Sub topic 4
Why Some Square Roots Are Irrational
This chapter assumes you can factor integers into primes, square and take roots of perfect squares, and read short Python programs. It also assumes you have seen the principal square root and the radical symbol from earlier chapters. Here you will learn which square roots are rational, why every other square root is irrational, and how to test a number reliably.
Rational and irrational numbers
A rational number can be written as a fraction a/b, where a and b are integers and b is not zero. Examples are 3 (which is 3/1), -0.75 (which is -3/4), and 0.333... (which is 1/3). An irrational number cannot be written that way. Its decimal expansion never ends and never settles into a repeating block.
Every square root falls into one of two groups:
- Rational: √49 = 7, √(9/16) = 3/4, √0 = 0.
- Irrational: √2, √3, √50, √(2/9).
There is no third group. The rest of this chapter explains where the line falls and why.
The rule for whole numbers
For a positive integer n, √n is rational exactly when n is a perfect square. Otherwise √n is irrational. Nothing in between happens. A non-square integer never has a square root like 2.5 or 1.4142, and you can never write it as a neat fraction.
This rule is why the estimating chapter had you place a root such as √20 between 4 and 5. Since 20 is not a perfect square, √20 never lands on a fraction. Any decimal you write for it is only an approximation.
The same rule extends to fractions. Write a fraction in lowest terms, which means the numerator and denominator share no common factor. Then √(p/q) is rational exactly when both p and q are perfect squares.
| Value | In lowest terms | Both parts perfect squares? | Square root |
|---|---|---|---|
| 9/16 | 9/16 | yes | 3/4, rational |
| 2/9 | 2/9 | no (2) | √2 / 3, irrational |
| 8/18 | 4/9 | yes | 2/3, rational |
| 0.25 | 1/4 | yes | 1/2, rational |
The third row shows why lowest terms matter. Neither 8 nor 18 is a perfect square, yet 8/18 reduces to 4/9, and its root is 2/3.
A proof that √2 is irrational
The classic argument is a proof by contradiction. You assume the opposite of what you want to show, then show the assumption breaks something.
First you need a small fact: if a² is even, then a is even. To see this, suppose a were odd. Then a = 2m + 1 for some integer m, and a² = 4m² + 4m + 1, which is odd. So an odd number always has an odd square. An even square therefore has to come from an even number.
Now the proof:
- Assume √2 is rational. Then √2 = a/b, where a and b are integers with no common factor.
- Square both sides and clear the denominator: 2 = a²/b², so a² = 2b².
- The right side is even, so a² is even, so a is even. Write a = 2k.
- Substitute: (2k)² = 2b², so 4k² = 2b², so b² = 2k².
- Now b² is even, so b is even.
- Both a and b are even, so they share the factor 2. This contradicts step 1.
The assumption led to a contradiction, so it is false, and √2 is irrational.
Generalizing with prime factorization
The √2 proof depends on a property of the number 2. A stronger argument uses prime factorization and covers every non-square at once.
The key fact is unique factorization: every integer greater than 1 breaks into primes in exactly one way, apart from order. Consider what squaring does to the exponents. If a = 2³ · 5, then a² = 2⁶ · 5². Squaring doubles every exponent, so a perfect square has only even exponents in its prime factorization.
Suppose √n = a/b in lowest terms, with n a positive integer. Squaring and clearing the denominator gives n · b² = a². For any prime p:
- The exponent of p in a² is even.
- The exponent of p in b² is even.
- The exponent of p in n is therefore (even) − (even), which is even.
Every prime in n has an even exponent, so n is a perfect square. This says that if √n is rational, then n is a perfect square. The contrapositive gives the rule we wanted: if n is not a perfect square, √n is irrational.
The same argument shows that a rational √n for an integer n must be a whole number, never a proper fraction.
The following program prints the exponents and checks whether they are all even. It matches the factor-extraction idea behind simplifying radicals.
def prime_exponents(n):
"""Return {prime: exponent} for n >= 2."""
exps = {}
p = 2
while p * p <= n:
while n % p == 0:
exps[p] = exps.get(p, 0) + 1
n //= p
p += 1
if n > 1:
exps[n] = exps.get(n, 0) + 1
return exps
for n in [36, 72, 50, 144]:
exps = prime_exponents(n)
all_even = all(e % 2 == 0 for e in exps.values())
print(n, exps, 'perfect square' if all_even else 'not a perfect square')The output shows that 36 = 2² · 3² and 144 = 2⁴ · 3² have only even exponents. The numbers 72 = 2³ · 3² and 50 = 2 · 5² each have one odd exponent, so their roots are irrational. Notice that the odd exponents are exactly what the radical simplifier leaves behind. For example, √72 = 6√2 keeps the leftover 2 under the radical.
A reliable test in code
For large integers, prime factorization is slow. A faster test uses math.isqrt, which returns the exact integer part of the square root, with no rounding error. For fractions, Python's Fraction type stores values in lowest terms automatically, so the rule from the table applies directly.
import math
from fractions import Fraction
def is_perfect_square(n):
return n >= 0 and math.isqrt(n) ** 2 == n
def sqrt_is_rational(value):
q = Fraction(value)
if q < 0:
raise ValueError("no real square root")
return is_perfect_square(q.numerator) and is_perfect_square(q.denominator)
for v in [49, 50, Fraction(9, 16), Fraction(2, 9), Fraction(8, 18), 0.25]:
print(v, sqrt_is_rational(v))This prints True for 49, 9/16, 8/18 (shown as 4/9), and 0.25, and False for 50 and 2/9. Passing 0.25 works because that float is exactly 1/4 in binary. A float such as 0.1 is not exactly 1/10, so Fraction(0.1) would give a huge fraction rather than 1/10. For decimal input, pass a string such as Fraction("0.1") instead.
Why calculators and floats can mislead you
A calculator shows √2 as 1.41421356... and stops after some number of digits. The stored value is a finite decimal, and every finite decimal is rational. So the display is an approximation of an irrational number, not the number itself. You can see this by squaring it:
import math
r = math.sqrt(2)
print(r * r) # 2.0000000000000004
print(r * r == 2) # FalseThe product is not exactly 2 because r is only the nearest representable binary fraction to √2. If it were exactly √2, squaring it would give 2. This is why algebra keeps the radical symbol: √2 · √2 = 2 is exact, while 1.41421356 · 1.41421356 is not.
Arithmetic with irrational numbers
Two facts help later when you add, multiply, and rationalize radicals:
- A nonzero rational plus or times an irrational is irrational. For example, 3 + √2 and 5√2 are both irrational. If 3 + √2 were a fraction r, then √2 = r − 3 would be rational too, which is false.
- Two irrational numbers can combine into a rational one. √2 · √2 = 2, and √2 + (−√2) = 0. Irrational numbers are not closed under addition or multiplication.
The second fact is the reason conjugates work. (3 + √2)(3 − √2) = 9 − 2 = 7, and the radical disappears.
Where the cases fall
The diagram shows the decision order for a positive integer or a fraction.
Common errors
- Forgetting to reduce first. √(8/18) looks irrational, but it equals 2/3. Always reduce the fraction before testing it.
- Treating a long decimal as proof. A root that looks like 2.2360679775 is not rational just because you cannot see a pattern. Likewise 0.333... looks endless but is rational. Only the perfect-square test settles it.
- Thinking √n is rational if n is "close" to a square. √99 is no more rational than √2. A number is a perfect square or it is not.
- Mixing up "does not simplify" and "irrational." √35 cannot be simplified because 35 has no square factor above 1, and it is also irrational. But √72 simplifies to 6√2 and is still irrational. Simplifying changes the form of a root and never changes whether it is rational.
- Assuming irrational means unusable. The exact value √2 is a perfectly good number. You can multiply, add, and compare it without ever writing its decimal digits.
Exercise
Without a calculator, decide whether each square root is rational or irrational, and explain: (a) √196, (b) √(18/50), (c) √(12/25).
Show answer
(a) 196 = 14², so √196 = 14, which is rational. (b) First reduce 18/50 to 9/25. Both 9 and 25 are perfect squares, so √(18/50) = 3/5, which is rational. (c) 12/25 is already in lowest terms. The numerator 12 is not a perfect square (12 = 2² · 3 has an odd exponent on 3), so √(12/25) = 2√3/5, which is irrational.
Exercise
Adapt the √2 proof to show that √3 is irrational. Which fact about even numbers do you replace, and with what?
Show answer
Assume √3 = a/b in lowest terms, so a² = 3b². Then 3 divides a². Replace "if a² is even, then a is even" with "if 3 divides a², then 3 divides a". This holds because a number not divisible by 3 has the form 3m + 1 or 3m + 2, and its square leaves remainder 1 when divided by 3. So a = 3k, and then 9k² = 3b² gives b² = 3k², so 3 divides b as well. Both a and b are divisible by 3, which contradicts lowest terms. Hence √3 is irrational.
Exercise
Use the prime-exponent idea to decide whether √(2⁴ · 3³ · 5²) is rational. What does it simplify to?
Show answer
The exponent of 3 is 3, which is odd, so the number is not a perfect square and the root is irrational. Pull out the even parts: √(2⁴ · 3³ · 5²) = 2² · 3 · 5 · √3 = 60√3.