CCommons

The proof that √2 is irrational is five lines long and it still bothers me

Proof by contradiction, a legend about a drowned mathematician, and why my code can never store the diagonal of a square.

Tushar PawarDropper Sample

1 Sept 2026 · 4 min read

Photo: Lucasbosch · CC BY-SA 3.0 · via Wikimedia Commons

Last month I was sitting in the library after a bad mock, too fried for another problem, and I picked up an old maths book somebody had left on the table. It had the proof that 2\sqrt{2} is irrational. I knew the result from school (it's in the class 10 NCERT), but I'd only memorised it. This time I read it slowly and I think it's one of the best things I've ever seen in maths. So here it is, along with the parts where I got stuck.

The claim

2\sqrt{2} cannot be written as a fraction pq\dfrac{p}{q} of two whole numbers. That's what "irrational" means.

You can't test every fraction, because there are infinitely many. So you don't hunt for the fraction. You assume one exists and see what breaks. That's proof by contradiction.

The proof

Assume 2=pq\sqrt{2} = \dfrac{p}{q}, where pp and qq are positive integers with no common factor. We can always cancel a fraction down until that's true, and this setup is the important part.

  1. Square both sides: 2=p2q22 = \dfrac{p^2}{q^2}, so p2=2q2p^2 = 2q^2.
  2. So p2p^2 is even. If pp were odd, p2p^2 would be odd (odd times odd is odd). So pp must be even: p=2kp = 2k for some integer kk.
  3. Substitute: (2k)2=2q2(2k)^2 = 2q^2, so 4k2=2q24k^2 = 2q^2, so q2=2k2q^2 = 2k^2.
  4. So q2q^2 is even, and by the same argument as step 2, qq is even.
  5. Now both pp and qq are even. They share the factor 2. That contradicts "no common factor".

The assumption led to nonsense, so it was false: 2\sqrt{2} is irrational. ∎

I stared at it for ten minutes trying to find the trick, and there isn't one. The trick is the very first line, "lowest terms". The contradiction only appears because we insisted the fraction was already fully simplified.

Where I got stuck: why doesn't this prove √4 is irrational?

Try the same steps on 4=p/q\sqrt{4} = p/q. You get p2=4q2p^2 = 4q^2, which just says p=2qp = 2q. That's a perfectly fine fraction (4=2/1\sqrt{4} = 2/1) and nothing contradicts anything. The proof for 2 works because p2=2q2p^2 = 2q^2 forces both pp and qq to be even. With 4 you only learn that pp is twice qq.

It generalises, and primes are the reason

For 3\sqrt{3}: p2=3q2p^2 = 3q^2, so 33 divides p2p^2. The key step is that if a prime divides p2p^2, it must divide pp. This works for primes (it's why the proof is written for 2 and 3 and 5 but we'd need more care for 6 or 10). Then p=3kp = 3k, so 9k2=3q29k^2 = 3q^2, so q2=3k2q^2 = 3k^2, so 33 divides qq as well. Contradiction again.

The full version: for a positive integer nn, n\sqrt{n} is irrational unless nn is a perfect square. The cleanest proof uses prime factorisation: in p2=nq2p^2 = nq^2, every prime appears an even number of times on the left side (squares do that), so every prime in nn must also appear an even number of times, which means nn is a perfect square.

The legend

The story goes that this was discovered in the school of Pythagoras, where the belief was that everything is a ratio of whole numbers, and that the person who proved otherwise was thrown overboard. Historians aren't sure it happened or who the person was, so I treat it as a great story and not a fact. What is solid is that the ancient Greeks knew the diagonal of a square of side 1 has no whole-number ratio with its side. By Pythagoras's theorem that diagonal is 12+12=2\sqrt{1^2 + 1^2} = \sqrt{2}. The simplest shape you can draw, and its diagonal is a number no fraction can name.

And in code

>>> import math
>>> math.sqrt(2)
1.4142135623730951
>>> math.sqrt(2) ** 2
2.0000000000000004
>>> 0.1 + 0.2
0.30000000000000004

A computer stores numbers with a finite number of bits, so 2\sqrt{2} gets rounded to the nearest value it can represent. Squaring that gives something a hair away from 2. (The 0.1 case is different. It's rational, but its binary expansion goes on forever, like 1/3 does in decimal, so it also can't be stored exactly.) Floating point is a polite lie we all agree to live with.

A cute bonus

Can an irrational number raised to an irrational power be rational? Take x=22x = \sqrt{2}^{\sqrt{2}}. Either xx is rational, in which case we're done with a=b=2a = b = \sqrt{2}. Or xx is irrational, in which case take a=xa = x and b=2b = \sqrt{2}:

ab=(22)2=2 2=2a^b = \left(\sqrt{2}^{\sqrt{2}}\right)^{\sqrt{2}} = \sqrt{2}^{\,2} = 2

which is rational. Either way the answer is yes, and the proof never even tells us which case is true. (It's actually known that xx is irrational, but that needs much heavier machinery to prove.)

I think this is why I like maths. It's one of the only places where you can be completely sure, and it fits on a page.

WhatsAppPost on X

12 responses

Sign in to join the conversation.

  • [+]Arjun Nair12thSample· 1mo ago

    Step 2 is the quiet hero. "If p2p^2 is divisible by a prime, pp is too" is the whole thing, and it fails for composite numbers, which is exactly why your √4 check fails to contradict. Nice write-up. The √2^√2 bonus is my favourite non-constructive proof of all time.

  • [+]Ishaan Bose11thSample· 1mo ago

    so since √2 is irrational that means its decimal never ends, right? and the reverse should also be true, if a decimal never ends it's irrational. like 0.333... never ends so it must be irrational too?

    • [+]Kabir Joshi11thSample· 1mo ago

      The first part is fine, the "reverse" isn't. Irrational means the decimal never ends and never repeats a pattern. 0.333... never ends but it repeats forever, and it equals 1/3, so it's rational. Every fraction gives either a terminating decimal or a repeating one. Irrational numbers like √2 or π never settle into a repeating pattern.

      • [+]Ishaan Bose11thSample· 1mo ago

        ahh okay that makes sense, never ends AND no pattern. noted

  • [+]Rohan Sharma11thSample· 1mo ago

    me trying to find √2 as a fraction: 1414/1000, 14142/10000... "close enough" the proof: "no"

  • [+]Vivek Mishra12thSample· 1mo ago

    I read this twice. Step 2 I understood only after I wrote some odd numbers: 3 squared is 9, 5 squared is 25, 7 squared is 49. Always odd. So if p squared is even, p cannot be odd. Is it okay to understand a proof by writing small examples? Sometimes I feel that it is not "real" maths.

    • [+]Tushar PawarDropperSample· 1mo agoAuthor

      Totally okay. That's how I got it too. Examples are how you find out why a step is true. The proof is then the version that works for all numbers, not just the ones you tried. Both parts are real maths.

  • [+]Aman YadavDropperSample· 1mo ago

    Five lines. Got it on first read. The √2^√2 thing took me three reads. Good one.

  • [+]Ananya Reddy11thSample· 1mo ago

    Very clear. One doubt though. Is π irrational for the same reason, like a "never repeats" thing? How do we actually know?

    • [+]Tushar PawarDropperSample· 1mo agoAuthor

      It's true, but the proof is harder. There's no simple divisibility trick like with √2. It was first proved in the 1760s using calculus and infinite series, and the argument is much longer. "The digits don't seem to repeat" isn't a proof, since we can only ever look at finitely many digits. That's the difference between looking for a pattern and proving there isn't one.

  • [+]Harsh Gupta12thSample· 1mo ago

    my relationship with √2: irrational. my relationship with step 5: also irrational. but ok this was fun

  • [+]Dev Agarwal12thSample· 1mo ago

    Business-brain takeaway: "assume the opposite and see what breaks" is also a decent way to test a startup idea 😅 Assume it works, then ask which assumption has to be true, then check if that's even possible.

More from Tushar Pawar