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$.
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.