Show there are no nonzero integers $a$ and $b$ such that $a^2 = pb^2$ if $p$ is prime

I'm struggling to figure out the proof for this question. The question again is stated as: If $p$ is a prime, prove that one cannot find nonzero integers $a$ and $b$ such that $a^2 = pb^2$.

I'm sure this is an easy proof to prove, but I'm new with abstract algebra so I'm still trying to fully grasp the concepts.

Any tips or suggestions on how to start this proof would be greatly appreciated!

• Look at the parity of the exponents of the prime factorizations of the two sides. – Mose Wintner Sep 10 '15 at 0:08
• Step One: read the proof that $\sqrt{2}$ is irrational. Step Two: Prove $\sqrt{p}$ is irrational the same way. (@Mose The fact that integers have prime factorizations is actually relatively nontrivial compared to the fact that primes are not squares. In fact, one can prove primes are not squares in some domains even if elements don't have prime factorizations.) – whacka Sep 10 '15 at 0:12

Note the following theorem:

$n^2$ is even if and only if $n$ is even for all integers $n$.

Proof: $\Rightarrow$) Suppose $n$ is not even (i.e. $n$ is odd). Then $n=2k+1$ for some integer $k$. So $n^2 = 2(2k^2+2k)+1$ is also odd. Therefore if $n^2$ is even it must be that $n$ is even.

$\Leftarrow$) Suppose $n$ is even. Then $n=2k$ for some integer $k$ and $n^2 = 2(2k^2)$ is also even.

Even more generally, you can prove the following:

$n^2\equiv 0\mod p$ if and only if $n\equiv 0\mod p$ for all integers $n$ and prime numbers $p$.

Proof: $\Rightarrow)$ Suppose that $n\not\equiv 0\mod p$. That means $n=pk+r$ for some integer $k$ and some integer $r$ with $1\leq r\leq p-1$. Then $n^2 = p^2k^2 + 2pkr + r^2 = p(pk^2+2kr) + r^2$. Noting that $r^2\not\equiv 0\mod p$ (since $r\neq 0$ and $p\not\mid r$) you have $n^2\not\equiv 0\mod p$.

$\Leftarrow)$ Suppose $n\equiv 0\mod p$. Then trivially $n^2\equiv 0\mod p$.

Using this result, we see that since $a^2=pb^2$ that $p\mid a$. Furthermore, since $p\mid a$ we have $p^2\mid a^2$. Since $p^2\mid a^2$ we have $p^2\mid pb^2$ implying that $p\mid b^2$ implying that $p\mid b$.

So, we can factor out a $p^2$ from both sides of the equation and it will remain integers. Let $a=pa_2$ and $b=pb_2$. So $a^2=pb^2=p^2a_2^2=p\cdot p^2b_2^2$ and $a_2^2=pb_2^2$. Repeat the argument to show that $p\mid a_2$ and $p\mid b_2$ in order to form $a_2=pa_3$ and $b_2=pb_3$.

Repeating this argument ad nauseam implies that $p^N\mid a$ for all natural numbers $N$. This is, however, impossible since such an $a$ could not be finite.

• Well, rather, we have that $p^n\mid a$ for all natural numbers $n,$ which is true for $a=0$ and impossible otherwise. – Cameron Buie Sep 10 '15 at 0:51

I think this is easiest to prove with a basic property of exponentiation: $(mn)^x = m^x n^x$. If you have already proven this, or if you can cite someone else's proof of this fact, then you're almost home.

Then, if $a^2 = pb^2$, that means $p = q^2$, where $q$ is also an integer. But this would mean that $p$ is composite, or $p = 1$, contradicting the assertion that $p$ is prime.

Without loss of generality we may assume $\gcd(a,b) = 1$, for if $a = da'$ and $b = db'$ for any $d > 1$, we have:

$d^2a'^2 = a^2 = pb^2 = pd^2b'^2 = d^2pb'^2 \implies a'^2 = pb'^2$ since $\Bbb Z$ is an integral domain (in other words, we can factor the gcd out).

Now $p|pb^2$ so $p|a^2$ and since $p$ is prime, $p|a$, so:

$a^2 = (kp)^2 = pb^2 \implies k^2p^2 = b^2p \implies k^2p = b^2$.

But $p|k^2p$, so $p|b^2 \implies p|b$, contradicting $\gcd(a,b) = 1$.