[Math] If $x^2$ is divisible by $4$ then $x$ is even

discrete mathematicselementary-number-theoryproof-writing

I am studying discrete mathematics as course and I have to prove this

"If $x^2$ is divisible by $4$ then $x$ is even".

I am wondering how to prove it using the contrapositive of this statement.

Please guide me on this proof approach.

Thanks in advance.. 🙂

Best Answer

To prove a statement $p \rightarrow q$, we can instead prove its contrapositive $\lnot q \rightarrow \lnot p$, because the two forms of implication are equivalent: an implication is true if and only if its contrapositive is true: $$p\rightarrow q \equiv \lnot q \rightarrow \lnot p.$$

Let $p$ denote "$4$ divides $x^2$."

  • $\lnot p: \;$ "$4$ does not divide $x^2$", or equivalently, "$x^2$ is not divisible by $4$."

Let $q$ denote "$x$ is even."

  • $\lnot q:\;$ "$x$ is not even", or equivalently, "$x$ is odd."

We want to prove $p\rightarrow q$ by proving $\lnot q \rightarrow \lnot p$.


Proof:

Suppose $x$ is not even (that is, suppose $x$ is odd). Then $x = 2k+1$ for some integer $k$.

And if $x= 2k+1$, it follows that $$x^2 = (2k+1)^2 = 4k^2 + 4k + 1 = 4(k^2 + k) + 1$$

Clearly, $4$ does not divide $x^2 = 4(k^2+k) +1$, because $4$ does not divide $1$.

Having proved "$x$ not even" $\implies$ "$x^2$ is not divisible by $4$," we have proved its equivalent:

"If $x^2$ is divisible by 4, then $x$ must be even,"

as desired.