Basic number Theory question 
Let $m, n, \ell \in \mathbb N$ and $\operatorname{lcm}(m + \ell,m) = \operatorname{lcm}(n + \ell,n).$ Prove that $m=n.$

I am unable to understand how to proceed with this question. To begin, according to properties of the $\gcd,$ we have that $\gcd(m + \ell,m) = \gcd(\ell,m).$ So, I rewrote the given identity as $$\frac{m(\ell+m)}{\gcd(\ell,m)} = \frac{n(\ell+n)}{\gcd(\ell,n)}.$$
Expanding the numerators, we get $$\frac{m^2}{\gcd(\ell,m)} + \operatorname{lcm}(\ell,m) = \frac{n^2}{\gcd(\ell,n)} + \operatorname{lcm}(\ell,n).$$
I am unsure how to proceed from here. Was this even the right approach? Is there something really obvious that I am missing? Thanks.
 A: Begin by writing the prime factorizations of $m,$ $n,$ and $m + \ell,$ and $n + \ell.$ Explicitly, we have that $$m = p_1^{a_1} \cdots p_k^{a_k},$$ $$n = p_1^{b_1} \cdots p_k^{c_k},$$ $$m + \ell = p_1^{c_1} \cdots p_k^{c_k}, \text{ and }$$ $$n + \ell = p_1^{d_1} \cdots p_k^{d_k} \phantom{, and}$$ for some distinct primes $p_1, \dots, p_k$ and some integers $a_1, \dots, a_k, b_1, \dots, b_k, c_1, \dots, c_k, d_1, \dots, d_k \geq 0.$ We have therefore that $$p_1^{b_1 + d_1 + \min \{a_1, c_1\}} \cdots p_k^{b_k + d_k + \min \{a_k, c_k\}} = p_1^{a_1 + c_1 + \min \{b_1, d_1\}} \cdots p_k^{a_k + c_k + \min \{b_k, d_k\}}$$ from your observation that $n(n + \ell) \gcd(m + \ell, m) = m(m + \ell) \gcd(n + \ell, n).$ Consequently, we have that $b_i + d_i + \min \{a_i, c_i\} = a_i + c_i + \min \{b_i, d_i\}$ for each integer $1 \leq i \leq k.$
From here, check each of the four cases, i.e., (1.) $a_i < c_i$ and $b_i < d_i,$ (2.) $a_i > c_i$ and $b_i < d_i,$ (3.) $a_i < c_i$ and $b_i > d_i,$ and (4.) $a_i > c_i$ and $b_i > d_i.$ I believe that you will find that $m = n,$ as desired.
A: Let's try to seek a simple answer: you arrived at
$$\gcd(l,m)\cdot n(l+n)=\gcd(l,n)\cdot m(l+m)$$
Now suppose that $l=kl_1$ and $m=km_1$ for relatively prime integers $m_1,l_1$ such that $\gcd(l,m)=k$. 
Now, we can also suppose $l=pl_2$ and $n=pn_1$ in a similar manner, $\gcd(l,n)=p$ and 
$$l=pl_2=kl_1 \iff p=k\frac{l_1}{l_2}$$
We have 
$$k\cdot pn_1(pl_2+pn_1)=p\cdot km_1(kl_1+km_1)$$
$$\iff  k\frac{l_1}{l_2} \cdot n_1(l_2+n_1)=m_1(kl_1+km_1) \iff 
{l_1} \cdot n_1(l_2+n_1)=l_2\cdot m_1(l_1+m_1)$$
Now, it depends on the $\gcd(l_1,l_2)$, so we can assume again, for relatively prime $l_3,l_4$ that $l_1=ql_3$ and $l_2=ql_4$ giving $$ql_3\cdot n_1(ql_4+n_1)=ql_4\cdot m_1(ql_3+m_1)$$
$$\iff \frac{l_3n_1}{l_4m_1}=\frac{ql_3+m_1}{ql_4+n_1}$$
Now since the fraction on the left hand side is irreducible, we have
$$ql_3+m_1=rl_3n_1, \ \ ql_4+n_1=rl_4m_1$$
for some positive integer $r$. This means that $l_3|m_1$, which contradicts with $m_1$ and $l_1$ being coprime giving $l_3 = 1$ and similarly, in the second equation, $l_4=1$ so we conclude
$$l_1=l_2=q \implies k=p$$
Let's rewrite our equations again
$$l=kq, \ m=km_1, \ n=kn_1$$
And the main equation
$$k(n(l+n))=k(m(l+m)) \iff n_1(q+n_1)=m_1(q+m_1)$$
$$\iff (m_1-n_1)(m_1+n_1+q)=0 \implies m_1=n_1 \implies m=n$$
A: If $\ell=0$, then
$$m=\operatorname{lcm}(m + \ell,m) = \operatorname{lcm}(n + \ell,n)=n(n+\ell)=n$$
hence we can assume $\ell>0$.
If $d=\gcd(\ell,m,n)$, then $m=dm'$, $n=dn'$ and $\ell=d\ell'$
\begin{align}
d\operatorname{lcm}(m' + \ell',m')
&=\operatorname{lcm}(m + \ell,m)\\
&= \operatorname{lcm}(n + \ell,n)\\
&=d\operatorname{lcm}(n' + \ell',n')
\end{align}
hence $\operatorname{lcm}(m' + \ell',m')=\operatorname{lcm}(n' + \ell',n')$ and since $\gcd(\ell',m',n')=1$, we can assume $d=1$.
If $d=1$, then $\gcd(m,\ell)=\gcd(n,\ell)=1$.
For assume on contrary $p|\gcd(n,\ell)$ for a prime $p$.
Then $p|n$, $p\mid l$ and $p|\operatorname{lcm}(n + \ell,n)=\operatorname{lcm}(m + \ell,m)$, hence $p|m$ or $p|(m+\ell)$, from which $p\mid m$ hence $p|d$ a contradiction.
Consequently,
$$m(m+\ell)=\operatorname{lcm}(m + \ell,m) = \operatorname{lcm}(n + \ell,n)=n(n+\ell)$$
from which
$$(m-n)(m+n+\ell)=0$$
hence $m=n$ because $m+n+\ell>0$.
