# The proof that $\sqrt{q}$ is a rational number iff $q$ is a perfect square

I have a proof of that if $$q\in \mathbb{Q}$$ then $$\sqrt{q}$$ is rational if and only if $$q$$ is a perfect square (it can be written in the form $$q={p_1}^{a_1}...{p_n}^{a_n}$$ where integers $$a_j$$, which may be positive or negative are even). I just need an explanation why in this proof, when we squared $$r$$ there is $$r^2=\pm p_1^{2a_1}...p_k^{2a_n}$$ not just $$r^2=p_1^{2a_1}...p_k^{2a_n}$$? (Proof in the photo)

• What photo? ${}$ Feb 17, 2019 at 18:34
• Hmm there must be a photo, I dont know, why it doesnt show. Here link: i.stack.imgur.com/hHQBR.png @Wojowu Feb 17, 2019 at 18:36
• This is a typo.
– user65203
Feb 17, 2019 at 18:39

Hypothesis: the author copy-pasted the expression of $$r$$ and forgot about the $$\pm$$ symbol, because, you are correct: when you square a positive or negative integer, it should be positive.