# Prove that a number is even, given the cube is even

If it is known that $x^3$ is even, can we say that $x$ is even? It seems to be the case because an odd*odd*odd=odd (if we are dealing with natural numbers). But is there a proof?

-

It sounds like you've more or less given a proof without realizing it. Proof by contrapositive

-

Suppose $x$ is odd. Then 2 does not divide x. So the prime factorization of x does not contain $2$. What can we say about the prime factorization of $x^3$?

-

Suppose $n^3$ is even. Then $2$ is a prime factor of $n^3$ and therefore $n$. Hence, you actually have $8\mid n^3$ if $n^3$ is even.

-

Yes it's a formal proof by contradiction and to be more accurate we write:

assume that $x$ is odd hence $x=2k+1$ for some $k$ and then $$x^3=(2k+1)^3=8k^3+12k^2+6k+1=2(\underbrace{4k^3+6k^2+3k}_{=k'})+1=2k'+1$$ so $x^3$ is odd which's a contradiction.

-
I think this is overkill. If you want to prove that $x^{10}$ is odd when $x$ is odd, would you multiply it out like this? If you do want a formal proof along these lines, it's IMHO better to prove that the product of two odd numbers is odd, and then apply the result twice (to prove that the product of three odd numbers is odd, in particular the cube of an odd number is odd). – ShreevatsaR Feb 6 '14 at 17:44
@ShreevatsaR I just answered the OP's question " Is there a proof" and I hadn't intention to give an ideal answer either by induction or other. – user63181 Feb 6 '14 at 17:52
@SamiBenRomdhane: Sure, to be clear I don't mean there's anything wrong with this -- it's a perfectly valid proof. I was just pointing out that this proof can be improved further (while also acknowledging that whether it would be an improvement is subjective). Apologies if my comment seemed negative. – ShreevatsaR Feb 6 '14 at 18:09
@ShreevatsaR You're welcome and thank you for any comments:-) – user63181 Feb 6 '14 at 18:12

Your proof is correct: if $n$ was odd then $n^3$ would be odd as well, so $n$ must be even.

-

On top of the mathematical proofs, you can try this yourself with very high numbers with a bit of code.

from __future__ import division

for i in range(0,1000):
if type((i*i*i)/2)==int:
print(i)
else:
print("Done")


With any number you input, you can see it will never find any number that this statement does not hold true for.

http://labs.codecademy.com/ You can try the python code out here if you like.

-
This seems unnecessary and obfuscates the need for a proof. – Dan Rust Feb 6 '14 at 14:49
This needs to be accompanied by an argument why testing it for just a thousand numbers is enough: $1000$ is not "very high", you know. :-) [Of course, if do make that argument, you'll probably end up showing that testing it for far fewer numbers — eight, maybe — is enough.] – ShreevatsaR Feb 6 '14 at 17:47