[Math] Using the fact that 2 is prime, show that there do not exist integers p and q such that $p^2=2q^2$

proof-verification

Using the fact that 2 is prime, show that there do not exist integers p and q such that $p^2=2q^2$. Demonstrate that therefore $\sqrt2$ cannot be a rational number.

Second attempt:
Suppose $p^2=2q^2$, then:
$$p^2=2q^2$$
$$1=2\frac{q^2}{p^2}$$
$$1=2(\frac{q}{p})^2$$
so
$$(\frac{q}{p})^2=1/2$$
$$\frac{q}{p}=\sqrt{1/2}$$
$$\frac{q}{p}=\sqrt{1}/\sqrt{2}$$
$$\frac{q}{p}=\frac{1}{\sqrt{2}}$$
so $q=1$ and $p=\sqrt{2}$, which is not an integer
So there are no such integers p and q such that:

$$\sqrt{2}=\frac{p}{q}$$

So $\sqrt 2$ cannot be a rational number.

First attempt:
I don't think my answer is right because it doesn't really use the fact that 2 is prime.
My attempt:
Let p and q be integers.
Then, if p=q
$p^2=q^2\ne2q^2$. So either p>q or q>p.
$$p^2=2q^2$$
$$pp=2qq$$
$$\frac{p}{q}=2(\frac{q}{p})$$
Since $p\neq$, then either $\frac{p}{q}$ or $\frac{q}{p}$ is rational, and the other one is irrational, so they cannot equal each other.

Suppose $p=\sqrt2$, then
$$p^2=2q^2$$
$$(\sqrt 2)^2=2q^2$$

That's as far as I could get (not even sure if I was headed in the right direction)

Best Answer

There are various proofs of this result. Since you are asked to use the fact that $2$ is prime, possibly the following one is intended.

Suppose that $p^2=2q^2$, and factorise each side into primes. Since $p^2$ is a square, the number of factors of $2$ on the LHS is even. Similarly, the number of factors of $2$ in $q^2$ is even; but the extra $2$ makes the number of factors of $2$ on the RHS odd. Therefore LHS cannot equal RHS.