Prove that $\frac ac$ and $\frac bc$ are perfect squares $a, b, m$ are integers, such that $ab=m^2$
Prove that $a\over b$ and $b\over c$ are perfect squares, where $c$ is the GCF of $a$ and $b$.  
I'm fairly new to mathematics and had never attempted to prove anything before. However, I did give this one a try and I'm hoping to receive constructive criticism, as well as other solutions to the problem(or, the correct solution, if mine is incorrect).   
My solution goes as follows:  
$ab=m^2=m(m)$
$ab$ can be represented as $m(m)$
Hence, $gcf(a,b) = c = gcf(m,m) = m$
Therefore, $\frac ac = \frac bc = \frac mm = 1$
$1$ can be represented as $1(1)$ and is a perfect square.
I apologize if the formulation of my proposed proof is incorrect or difficult to understand. I'm still learning.
 A: Prime factorization of $ab$ will reveal that factors are even numbered by quantity ($2, 4$ or $6$ etc). It doesn't matter how those factors comprise to make $a$ and $b$, dividing by all the factors common to both leaves either an even number of factors in both $a$ and $b$ or a $1$.
Generalizing, looking at any one factor $f$ of $ab$, say it's $f\cdot f\cdot f\cdot f\cdot f\cdot f$, and allocating any number of $f$s to either $a$ or $b$, when diving by the lowest number of $f$s in either $a$ or $b$, there always remains an even number of $f$s or a $1$ in both $a$ and $b$. This repeats itself for any other series of factors in $ab$. Hence $\frac{a}{c}$ and $\frac{b}{c}$ will always be a perfect square.
A: Prime factorization requires a fair bit of background. Here is an answer that does not use prime factorization. This answer uses Bezout's Identity in the proof of the Lemma below. An elementary proof of Bezout's Identity is given in this answer.


Lemma: If $(a,b)=1$, then $\left(a^2,b^2\right)=1$.

Proof: Bezout's Identity says that there are $x,y\in\mathbb{Z}$ so that $ax+by=1$. Cube and collect to get
$$
a^2\left(ax^3+3x^2by\right)+b^2\left(by^3+3y^2ax\right)=1
$$
$\large\square$


Corollary $\bf{1}$: $\left(a^2,b^2\right)=(a,b)^2$

Proof: Let $g=(a,b)$. Then, $\left(\frac ag,\frac bg\right)=1$ and so $\left(\frac{a^2}{g^2},\frac{b^2}{g^2}\right)=1$. Thus, $(a^2,b^2)=g^2=(a,b)^2$.
$\large\square$


Corollary $\bf{2}$: If $a^2\mid b^2$, then $a\mid b$.

Proof: If $a^2\mid b^2$, then $a^2=(a^2,b^2)=(a,b)^2$. Therefore, $a=(a,b)$ which means that $a\mid b$.
$\large\square$


Corollary $\bf{3}$: If $ab=m^2$ and $(a,b)=1$, then $a=(a,m)^2$ and $b=(b,m)^2$.

Proof:
$$
\begin{align}
(a,m)^2
&=\left(a^2,m^2\right)\\
&=(a^2,ab)\\[3pt]
&=a(a,b)\\[3pt]
&=a
\end{align}
$$
Similarly, $b=(b,m)^2$.
$\large\square$

Answer
Suppose that $ab=m^2$ and $(a,b)=c$. Then $\frac ac\frac bc=\frac{m^2}{c^2}$ and $\left(\frac ac,\frac bc\right)=1$. Note that if $c^2\mid m^2$, then Corollary $2$ says that $c\mid m$. Applying Corollary $3$, we get
$$
\frac ac=\left(\frac ac,\frac mc\right)^2
$$
and
$$
\frac bc=\left(\frac bc,\frac mc\right)^2
$$
