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$.
 A: Because $n$ is a positive integer, $n^2$ has an even number of factors, and each factor appears an even number of times in its factorization. The prime factorizations of $a$ and $b$ must together contain $2$ of each of all elements of the prime factorization of $n$. However, since $\gcd(a,b)=1$, $a$ and $b$ share no factors. Then each factor $f_k$ of $n$ must occur twice as many times in either $a$ or $b$ (not both) than it does in $n$, so each factor of $a$ and $b$ occurs an even number of times. Since each factor occurs an even number of times in both $a$ and $b$, they are both perfect squares.
A: This:

$\sqrt{a}$ and $\sqrt{b}$ are both positive integers

does not follow from

$\sqrt{a}(k\sqrt{a}) + \sqrt{b}(l\sqrt{b}) = 1$.

For instance,
$$ \sqrt{2}((-1)\sqrt{2}) + \sqrt{3}((1)\sqrt{3}) = 1$$
($a = 2, b = 3, k = -1, l = 1$).
What you need to do instead is use prime factorization.
A: Consider the prime factorization of $ab=n^2$. Each prime factor appears an even number of times because $n^2$ is a square (each prime factor of $n$ is repeated twice in the factorization of $n^2$).
The condition $\gcd(a,b)=1$ means that $a$ and $b$ have no common prime factors.
That means each prime factor of $a$ itself appears an even number of times; ditto for $b$. This in turn means that $a$ is a square and $b$ is a square.
A: Let $a = \Pi_{i=1}^{r} p_i^{d_i}$ and $b=\Pi_{j=r+1}^{r+s} p_j^{d_j}$ be the unique prime factorizations of $a$ and $b$, respectively.  Since $gcd(a,b)=1$, none of the $r$ primes which are divisors of $a$ is equal to any of the $s$ primes which are divisors of $b$.  Hence, the product $ab$ can be written as $ab=\Pi_{i=1}^{r+s} p_i^{d_i}$, where the $p_i$'s are distinct. 
Since $ab$ is a perfect square, each $d_i$ is even.  Suppose $d_i = 2e_i$ for $i=1,\ldots, r+s$.  Then, $a=x^2$ and $b=y^2$, where $x = \Pi_{i=1}^r p_i^{e_i}$ and $y=\Pi_{j=r+1}^{r+s} p_j^{e_j}$.
A: 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
