Let's look at the proof that $\sqrt{2}$ is irrational:

To show $\sqrt{2}$ is irrational, we argue by contradiction. Suppose $\sqrt{2}={p\over q}$, where $p, q$ are natural numbers. Without loss of generality, ${p\over q}$ is in lowest terms. So ${p^2\over q^2}=2$, and so $p^2=2q^2$. $\color{red}{\mbox{This means that}}$ $2$ divides $p$, that is, $p=2k$. So $2q^2=4k^2$, and $q^2=2k^2$. $\color{red}{\mbox{Again, this means}}$ that $2$ divides $q$. But then $p$ and $q$ have a common factor, contradiction.


Where this breaks down for $\sqrt{4}$: Look at the red phrases. They depend on the following fact: $$\mbox{If $2$ divides $ab$, then either $2$ divides $a$ or $2$ divides $b$}.$$ This fact requires proof, and relies on the fact that $2$ is prime. $4$, by contrast, is not prime, and indeed the fact fails for $4$: $4$ divides $2\cdot 2$, but $4$ does not divide $2$.

How it generalizes: It's a good exercise to show that the usual argument does work for any number $n$ such that some prime $p$ divides $n$ an odd number of times - that is, $p^{2i+1}$ divides $n$ but $p^{2i+2}$ doesn't, for some $i$. For example, the following numbers all have this property:

  • $12$ ($p=3, i=0$)

  • $27$ ($p=3, i=1$)

  • $24$ ($p=2, i=1$ or $p=3, i=0$)

etc. Any such number has an irrational square root. By contrast, if every prime dividing $n$ divides $n$ an even number of times, then $\sqrt{n}$ is rational (exercise!). So this is a complete characterization.


The standard proof that $\sqrt{2}$ is irrational is of course as follows: Assume for contradiction there exist $a, b$ positive whole numbers that share no factors (besides $1$) and $a / b = \sqrt{2}$. Then $a^2 = 2 b^{2}$. Now the observation here is that $2 b^{2}$ is divisible by $2$, a prime number, so $a$ must also be divisible by $2$.

Now, if instead we considered $9$, then we'd be looking at $a^2 = 9b^2$. We cannot conclude from here that $a$ is divisible by $9$, so we are dead in our tracks.


$$\sqrt{9}=\frac{a}{b}$$

where $\gcd(a,b)=1$. $$\sqrt{9}b=a$$ Squaring both sides, $$9b^2=a^2$$

We know that $a$ must be a multiple of $3$ (notice I am saying $a$ is a multiple of $3$ rather than $9$ and compare it with the proof for irrationality of $\sqrt{2}$.)

So $a=3k$ and hence $b=k$. $k$ takes value $1$ in this case.


See this proof that if $n$ is not a perfect square then $\sqrt{n}$ is irrational:

Follow-up Question: Proof of Irrationality of $\sqrt{3}$

The proof starts by saying that if $n$ is not a perfect square then there is a $k$ such that $k^2 < n < (k+1)^2$. The proof breaks down if $k^2 = n$.