# Prime-power decomposition of a square

I'm trying to learn number theory on my own, and here's a proof I'm not quite sure I got right. It feels too simple(?), I'm thinking maybe I'm missing something. So the question is:

Prove that if $n$ is a square, then each exponent in its prime-power decomposition is even.

My proof:

Let $n=m^2$, with $m$ having prime factors $p_i$ with exponents $e_i$ so that

$$m= p^{e_1}_1 p^{e_2}_2 \ldots p^{e_n}_n.$$

When squared, this gives

$$m^2 = (p^{e_1}_1 p^{e_2}_2 \ldots p^{e_n}_n)^2 = p^{2e_1}_1 p^{2e_2}_2 \ldots p^{2e_n}_n,$$

where all the exponents are even.

-
That's correct, it really is as simple as that :-) – joriki Mar 11 '11 at 12:36
Yes, that's correct. But you should remark that the proof is complete because, by uniqueness, that's the only prime factorization. In other domains there might exist additional decompositions into irreducibles where not all exponents are even, e.g. $\rm\ x\:y = z^2 \in \mathbb Q[x,y,z]/(xy-z^2)$ – Bill Dubuque Mar 11 '11 at 13:04
@Bill: Ok, thanks! I will keep that in mind! – user8110 Mar 11 '11 at 13:15
Duplicate of math.stackexchange.com/questions/23360/… – lhf Oct 4 '11 at 20:36

You can even use it in the other direction to prove that if each exponent in the prime-power decomposition of $n$ is even, then $n$ is a square by saying
$$n = p^{2e_1}_1 p^{2e_2}_2 \ldots p^{2e_n}_n = (p^{e_1}_1 p^{e_2}_2 \ldots p^{e_n}_n)^2$$ so $n = m^2$ where $m= p^{e_1}_1 p^{e_2}_2 \ldots p^{e_n}_n.$