# How to prove that if $n \in N$ is not a perfect square, then there is no rational $q$ s.t $q^2 = n$

I have constructed a proof for 2 not having such a $q$ in the format below:

If we suppose $\exists q \in Q$ then we can write $(\frac{m}{n})^2=2 \implies m^2 = 2n^2$, where clearly the numbers $m^2, n^2$ must have an even number of primes in their factorisation in order for them to be to an even power; this implies that $2n^2$ has an odd number of primes in its prime factorisation, which in turn violates the Fundamental Theorem of Arithmetic which states that every prime factorisation is unique. An odd number of prime powers cannot qual an even number, so there is not a rational number who's square is 2.

How can I extend this to any non-perfect square $n$? Thanks!

• Since you are already talking about prime factorizations: what do you know about the prime factorisation of a square? (And thus, about the prime factorization of a nonsquare.) Jan 9, 2017 at 10:45

Hint: suppose $\;q=\cfrac rs\;$ is a reduced fraction s.t. $\;q^2=n\;$ . Since $\;n\;$ is not a perfect square, at least one of the primes in its prime decomposition appears at an odd exponent, so WLOG

$$n=p^{a_1}\cdot p_2^{a_2}\cdot\ldots\cdot p_n^{a_n}\;,\;\;p_i\;\;\text{primes},\,a_i\in\Bbb N\;,\;\;a_1\;\;\text{odd}$$

Now look carefully at the exponents in

$$\frac{r^2}{s^2}=n=p^{a_1}\cdot p_2^{a_2}\cdot\ldots\cdot p_n^{a_n}\iff r^2=s^2\cdot p^{a_1}\cdot p_2^{a_2}\cdot\ldots\cdot p_n^{a_n}\;\ldots$$

• @MeesdeVries Thanks, edited. Tried to follow too close, and too stupidly, the mistaken notation of the OP. Jan 9, 2017 at 10:48

In this answer, it is shown that for any positive integer $k$, if $\left(\frac pq\right)^k-n=0$ where $n\in\mathbb{Z}$, then $\frac pq\in\mathbb{Z}$. This also follows from the Rational Root Theorem.

All values here are integers.

(1). Preliminaries.

The Fundamental Theorem of Arithmetic: If $c\;| \;ab$ and $\gcd (a,c)=1$ then $c\;|\;b.$

Corollary 1: If $p$ is prime and $p\;|\;b^2$ then $p\;|\;b .$ For otherwise, if $p \not |\;b$ then $\gcd(p,b)=1.$ Applying the theorem with $a=b$ and $c=p$ we have $p=c\;| \;b^2=ab$ and $\gcd (a,c)=\gcd(b,p)=1$ so $p=c\;|\;a=b,$ contrary to $p\not |\; b.$

Corollary 2: If $\gcd (a,b)=1$ then $\gcd(a^2,b^2)=1.$ For otherwise, if a prime $p$ divides $\gcd(a^2,b^2)$ then $p\;|\;a^2$ and $p \;|\; b^2$ so by Corollary 1 we have $p\;|\;a$ and $p\;|\;b,$ contrary to $\gcd(a,b)=1.$

(2). Solution.

Let $n\in \mathbb N$ and suppose $n=(a/b)^2$ where $a,b \in \mathbb N$ with $\gcd (a,b)=1.$ By Corollary 2, $\gcd(a^2,b^2)=1.$ By ancient history there exist $x,y$ with $a^2x+b^2y=1.$ Then $$b^2n=a^2\implies xb^2n=xa^2=1-b^2y \implies$$ $$\implies b^2(xn+y)=1\implies b^2\;|\;1\implies b=1$$ $$\implies n=b^2n=a^2.$$
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}