If $ab$ is a square number and $\gcd(a,b) = 1$, then $a$ and $b$ are square numbers. 
Let $n, a$ and $b$ be positive integers such that $ab = n^2$. If $\gcd(a, b) = 1$, prove that there exist positive integers $c$ and $d$ such that $a = c^2$ and $b = d^2$

So far I have tried this:
Since $n^2 = ab$ we have that $n = \sqrt{ab}$.
Because $\gcd(a,b) = 1$, there exists integers $k$ and $l$ such that $ak + bl = 1$. This means that $\sqrt{a}(k\sqrt{}) + \sqrt{b}(l\sqrt{b}) = 1$.
Hence $\sqrt{a}$ and $\sqrt{b}$ are both positive integers and we can set $\sqrt{a} = c$ for some arbitrary integer $c$ and $\sqrt{b} = d$ for some arbitrary integer $d$. Therefore, $a = c^2$ and $b = d^2$.

Let $ab=c^2$ for some $c\in N$ then the result will hold if any one of the integers is 1 as 1^2=1.
So let us take a>1,b>1 and c>1. We can use prime factorization and represent the integers as follows: 
a=$p_1^{d_1} * p_2^{d_2}$ 
b= $q_1^{e_1} * q_2^{e_2}$ 
and c=$k_1^{l_1} *k_2^{l_2}$ 
thus $ab=c^2$ becomes 
$p_1^{d_1} * p_2^{d_2} * q_1^{e_1} * q_2^{e_2} = k_1^{2l_1} *k_2^{2l_2}$ 
(a,b)=1 so all the primes $p_1...$ are different from $q_1...$. Hence we can say that p and q are just rearrangement of k and each of $d_i$ and $e_j$ are also similar rearrangement of $2l_1....2_r$. Hence each of $d_i$ and $e_j$ are even.


Using this we can also prove that $ab=c^n$ then $a=x^n$ and $b=y^n$
P.s Extension of Alex's answer
