# Is my proof that the square root of any non-perfect square is irrational correct?

Currently, I am doing some self-study in Real Analysis, and I wanted to verify if my proof regarding the irrationality of square roots of non-perfect squares is correct. I have viewed other solutions such as Proof verification: Prove $\sqrt{n}$ is irrational. but I wanted to see if my reasoning is sufficient here. Any comments explaining flaws in my reasoning are much appreciated!

$$\textbf{Theorem:}$$ Let $$n\in \mathbb{N}$$. Assume that $$n$$ is not a perfect square, meaning it cannot be written as the product of two identical integers. Then $$\sqrt{n}$$ is irrational.

$$\triangle$$ $$\textbf{My proof:}$$ For the sake of contradiction, assume that $$\sqrt{n}$$ is rational. Thus, $$\sqrt{n}=\frac{p}{q}$$ for $$p,q\in \mathbb{Z}$$, $$q\neq 0$$, and $$p$$ and $$q$$ are coprime (I assume without proof that any rational number can be written uniquely as a fraction of 2 coprime integers, but this is a known result). Squaring both sides gives us: $$n=\frac{p^2}{q^2} \Rightarrow p^2=nq^2$$ Also, note that $$n\neq 0$$ and $$n\neq 1$$ since both $$0$$ and $$1$$ are perfect squares.

$$\textit{Lemma: If p,q,n\in \mathbb{Z}, n\neq 0, and p^2=nq^2, then n is a factor of p and q}:$$

$$\triangle$$ Proof: Note, if $$n=1$$, this is trivially true, since $$1$$ is a factor of every number. Now, consider the case where $$n\neq 1$$. Since the integers are closed under multiplication (Again, I assume this without proof for brevity), $$q^2$$ and $$p^2$$ are both integers. Let $$q^2=m$$. Since $$n \neq 0$$, we can write $$\frac{p^2}{n}=m$$. Now, for the sake of contradiction, assume $$n$$ is not a factor of $$p$$. Thus, $$\frac{p^2}{n}$$ is an irreducible fraction. However, since $$n\neq 1$$, $$\frac{p^2}{n}$$ is not an integer (an integer cannot be an irreducible fraction with denominator other than 1), and thus $$m\notin \mathbb{Z}$$. However, we have $$m\in \mathbb{Z}$$ since it is the product of two (identical) integers. This is a contradiction, so $$n$$ must be a factor of $$p$$. Since this is the case, we can write $$p=nk$$ for $$k\in \mathbb{Z}$$. Thus, $$p^2=n^2k^2$$, which implies $$n^2k^2=nq^2$$. Divide both sides by $$n$$, and we have $$q^2=nk^2$$. Using the exact same argument I used for $$p$$, it follows that $$n$$ is also a factor of $$q$$. Thus, the lemma is concluded.

Now, the result of the lemma tells us that $$p$$ and $$q$$ share $$n$$ as a common factor, and that $$n\neq 1$$. However, we assumed that $$p$$ and $$q$$ were coprime, so this is a contradiction. Therefore, $$\sqrt{n}$$ is irrational.

Thanks to previous commentors for your suggestions!

New contributor
Matthew S is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
• You claimed without proof that $q=1.$ Sep 18 at 20:39
• Okay I see, thanks for pointing that out! So from here, I would then assume q is not equal to 1 and then show that implies p and q share a common factor? Sep 18 at 21:36
• Your reasoning is (I think) taking it as known that every rational number has a unique representation of the form $m/n$ where $m$ and $n$ are coprime and that needs to be proved first. Sep 18 at 22:18
• "assume $n$ is not a factor of $p$. Thus, $\frac{p^2}{n}$ is an irreducible fraction"? 2 days ago
• Ahhh that's a great point @AnneBauval, I totally missed that! Instead of my current lemma, could I use another lemma that states that if two numbers are coprime, their squares are also coprime? Then use the fact that p^2=nq^2 implies q^2 is a factor of p^2, which is a contradiction if q^2 is not 1? I'd from there argue q=1 also implies a contradiction to finish. 6 hours ago