[Math] If the square of an integer number $x$ is even, then $x$ has to be even.

algebra-precalculusproof-verification

My math textbook had the following statement but did not mention how it got there, so I tried to find a proof. Can someone please verify if it is correct.

Statement:
If the square of an integer number $x$ is even, then $x$ has to be even.

Proof:

We know that $x^2$ is even, so we can write it in the form of an even number

$$x^2 = 2n$$

$$x = \sqrt2 \sqrt n$$

We know that $x$ is an integer and hence a rational number

$$x=(\sqrt2 \sqrt n) \times\frac{\sqrt2}{\sqrt2}$$

$$x=2(\sqrt\frac{n}{2})$$

Since $n$ is a natural number and $\sqrt(\frac{n}{2})$ is rational (because 2 and x are rational and the quotient of two rational numbers is rational). $n$ can only assume those values which allow $\sqrt(\frac{n}{2})$ to come out rational. In other words, $\frac{n}{2}$ has to be a perfect square.

Now $x=2p$ where $p$ is an integer and hence $x$ is even.

Best Answer

If a prime number (or a prime) is defined as a natural number greater than $1$ that cannot be formed by multiplying two smaller natural numbers then with unique prime decomposition it can be shown that for integers $a,b$ and prime $p$:$$p\mid ab\iff p\mid a\text{ or }p\mid b$$

Applying that on $p=2$ and $a=b=x\in\mathbb Z$ we find:$$2\mid x^2\iff 2\mid x$$