Prove/Show that a number is square if and only if its prime decomposition contains only even exponents. 
Prove/Show that a number is square if and only if its prime decomposition contains only even exponents.

How would you write a formal proof for this.
 A: Suppose $a = p_1^{r_1}...p_n^{r_n}$. If $r_i$ are all even, then let $b = p_1^{\frac{r_1}{2}} ... p_n^{\frac{r_n}{2}}$. Then $b^2 = a$. 
Suppose $a = b^2$. Let $q_1^{s_1} ... q_m^{s_m}$ be the unique prime factorization of $b$. Then $a = q_1^{2s_1} ... q_m^{2s_m}$. So by unique factorization all primes of $a$ have even powers. 
A: Suppose $x=y^2$ for some integer $y$. Let 
$$y=p_1^{e_1}\cdots p_n^{e_n}$$
be a decomposition of $y$ into primes. Then 
$$x=y^2=p_1^{2e_1}\cdots p_n^{2e_n}$$
so its prime decomposition has only even exponents.
Suppose the prime decomposition of $x$ has only even exponents, so we can write
$$x=p_1^{2e_1}\cdots p_n^{2e_n}$$
for some set of primes $P_i$ and integers $e_i$. Then
$$x=\left(p_1^{e_1}\cdots p_n^{e_n}\right)^2$$
so $x$ is a perfect square.
A: Proof:  Suppose for some integer $m \geq 2$ that $m=p_1^{a_1}p_2^{a_2}\cdot \cdot \cdot p_k^{a_k}$ where $p_1,p_2,...,p_k$ are prime such that $p_1<p_2<\cdot \cdot \cdot <p_k$ and each exponent $a_i$ is a positive integer. If each exponent $a_i$ is even, then $n=p_1^{a_1/2}p_2^{a_2/2}\cdot \cdot \cdot p_k^{a_k/2}$ and so $n^2=m$.
For the converse, suppose $n^2=m$ for some integer $n$. Then let $n=q_1^{b_1}q_2^{b_2}\cdot \cdot \cdot q_k^{b_k}$ where $q_1,q_2,...,q_k$ are primes such that $q_1<q_2<\cdot \cdot \cdot <q_k$ and each exponent $b_i$ is a positive integer. Then $m=n^2=q_1^{2b_1}q_2^{2b_2}\cdot \cdot \cdot q_k^{2b_k}$ and so if $c_i=2b_i$, the exponent $c_i$ is even.
