Prime Factorization of $m^2$

If $m$ is a positive integer, explain why each prime in the prime factorization of $m^2$ must occur an even number of times.

I did a small proof, I was wondering what's a nice way to explain it aside from my explanation below:

Proof: let $m=p_1^{e_1} p_2^{e_2}p_3^{e_3}\cdots p_k^{e_k}$

Then $m^2=(p_1^{e_1})^2 (p_2^{e_2})^2(p_3^{e_3})^2\cdots (p_k^{e_k})^2 = p_1^{2e_1}p_2^{2e_2}p_3^{2e_3}\cdots p_k^{2e_k}$

These $p_i^{e_i}$ occur an even number of times any suggestions to make a more solid answer?

• I would not put both formulas for $m^2$ on the same line, but otherwise it's the right proof. Maybe say explicitly that raising to a power distributes over multiplication $(ab)^n=a^nb^n$ because multiplication is commutative. Otherwise, I think it's good. – Gregory Grant Jul 27 '17 at 2:01
• One suggestion: you also need to explicitly invoke the uniqueness of prime factorizations to conclude that is the only such factorization of $m^2$ (else it might have another factorization where some prime has odd exponent). – Bill Dubuque Jul 27 '17 at 2:02
• Actually don't say "These $p_i^{e_i}$ occur an even number of times. Say $p_i$ occurs $2e_i$ times which is even. – Gregory Grant Jul 27 '17 at 2:02
• @GregoryGrant yeah thanks my issue was that explanation it did not sit well with me either. – OLE Jul 27 '17 at 2:04
• @BillDubuque is their a nicer more stronger way of proving this? – OLE Jul 27 '17 at 2:06

It's in fact an if and only if :

Each prime in "the" (due to uniqueness of p.f up to multiplication by units) prime factorization of $$k$$ occurs an even number of times, if and only if $$k$$ is a perfect square.

Suppose each prime in the prime factorization of $$k$$ occurs an even number of times, say $$k = \prod p_i^{r_i}$$, where each $$r_i$$ is even. Then, you can see that if $$b = \prod p_i^{\frac {r_i} 2}$$, then $$b$$ is a well defined integer, and $$b^2 = k$$.

Conversely, note that if $$k = m^2$$ is a perfect square, then the prime factorization of $$m = \prod p_i^{r_i}$$ suggests the prime factorization for $$k = \prod p_i^{2r_i}$$. Since prime factorization is unique, it follows that $$k$$ can indeed only be prime factorized in the above form, and hence every prime appears evenly many times in the rime factorization.

Alternately, we can also go by this way : Suppose $$p^r$$ divides $$m^2$$, where $$r$$ is maximal. Suppose $$r$$ is even, then we are done. Otherwise, note that $$r = 2k+1$$, and we can write $$p \ \mid\ \frac {m^2}{p^{2k}}$$, so that $$p$$ divides a perfect square.

Hence, from here, using Euclid's lemma, that $$p$$ divides $$ab$$ implies $$p$$ divides $$a$$ or $$p$$ divides $$b$$, we get that taking $$a=b=\frac m{p^k}$$, $$p^{k+1} \mid m$$, or that $$p^{2k+2} \mid m^2$$, a contradiction by uniqueness of prime factorization.

On a little inspection,the second proof is just a longer winded version of the first proof, but two is better than one, I suppose.

EXTENSION : If $$m$$ is a perfect $$k$$th power, then every prime that appears in the factorization does so, with multiplicity a multiple of $$k$$.