Japanese Temple Geometry Problem: Two tangent lines and three tangent circles. I am working on my Senior Thesis for my Bachelor's Degree in Mathematics. My project involves Japanese San Gaku problems, and moving said problems from Euclidean Geometry to Spherical and Hyperbolic Geometry.
I've been working on a particular problem for weeks now. The problem is stated as follows: 

Problem 1.2.5: A circle $O(r)$ has its center on a line $m$, and has a tangent line $\ell$. The circles $O_1(r_1)$ and $O_2(r_2)$ both touch $O(r)$ externally and also the lines $\ell$ and $m$. Show that 
  \begin{align*}
4r=r_1+6\sqrt{r_1r_2}+r_2.
\end{align*}


I have worked very hard on this and have come up with a lot of stuff. One very useful result is the following: 

Useful Result. Given tangent circles $O_1(r_1)$ and $O_2(r_2)$, and a line $AB$ tangent to $O_1$ at $A$ and to $O_2$ at $B$, it follows that 
  $$|AB| = 2\sqrt{r_1 r_2}$$ 
  See Useful Result.

Additionally, I've managed to construct the figure in Geogebra. This is quite a difficult task unless you know what you're doing (which I did not at first!). Here is what the figure looks like after construction.
By equating $AC$ and $A'C'$ in this image, I've been able to solve the problem, but not by hand. After using the Useful Result to rewrite $AC$, and a clever usage of the Pythagorean Theorem to write $A'C'$ in terms of $r$, $r_1$, and $r_2$, I get an algebraic nightmare. Mathematica can solve it for $r$ and provide us with the desired result, but that's a little unsatisfying. 
This problem comes from the book Japanese Temple Geometry Problems: San Gaku by H. Fukagwa and D. Pede. I can't find the problem anywhere online, and the "solution" in the back only says "Written on a surviving tablet in the Yagamata prefecture in 1823." If some incredibly smart individual out there could help me come up with a better way of solving this problem, I would be forever in your favor!
 A: 
Using your lemma we have
\begin{eqnarray*}
AB=2\sqrt{r r_2} \\
BC=2\sqrt{r r_1}.
\end{eqnarray*}
A similar calculation gives
\begin{eqnarray*}
A'O=\sqrt{r(r+2 r_2)} \\
OC'=\sqrt{r(r+2 r_1)}.
\end{eqnarray*}
Now by similar triangles $AB+BC=A'O+OC'$, so we have
\begin{eqnarray*}
2\sqrt{r r_2}+2\sqrt{r r_1}=\sqrt{r(r+2 r_2)}+\sqrt{r(r+2 r_1)}.
\end{eqnarray*}
Loose a factor of $\sqrt{r}$, square this and rearrange
\begin{eqnarray*}
r_1+r_2-r=\sqrt{(r+2 r_2)(r+2 r_1)}-4\sqrt{r_1 r_2}
\end{eqnarray*}
square again and rearrange, & square a final time
\begin{eqnarray*}
(16r^2-8rr_1-8rr_2+r_1^2-34r_1r_2+r_2^2)(r_1-r_2)^2=0.
\end{eqnarray*}
So
\begin{eqnarray*}
(4r-r_1-r_2)^2=36r_1r_2
\end{eqnarray*}
and we are done.
A: Edit. Simplified the derivation. See the Edit History for my previous version.

Suppose the lines meet at an angle of $2\theta$. (The parallel case is left as an exercise to the reader.) Let $\bigcirc C$ of radius $c$ be the circle with its center on one line, tangent to the other. Let $\bigcirc A$ and $\bigcirc B$, with respective radii $a$ and $b$, be tangent to the lines and to $\bigcirc C$ as shown:

Combining OP's Useful Result with some simple right-triangle trig gives
$$|A'C'| = 2\sqrt{ac} = c\cot2\theta-a\cot\theta \qquad\qquad |B'C'| = 2\sqrt{bc} = b\cot\theta - c\cot2\theta \tag{1}$$
Let's consider $(1)$ to be a linear system in $\cot\theta$ and $\cot 2\theta$. Solving, we find
$$\cot\theta = \frac{2 \sqrt{c}}{\sqrt{b}-\sqrt{a}}
\qquad\qquad 
\cot2\theta = \frac{2 \sqrt{ab/c}}{\sqrt{b}-\sqrt{a}} \tag{2}$$
Then, substituting into the double-angle formula for cotangent gives
$$\cot2\theta=\frac{\cot^2\theta-1}{2\cot\theta} \quad\to\quad 
\frac{a + b + 6 \sqrt{ab} - 4 c}{4 \sqrt{c}\left(\sqrt{b} - \sqrt{a}\right)} = 0 \quad\to\quad
a+b+6\sqrt{ab} = 4c
\tag{3}$$
as desired. $\square$

Note. To avoid thinking in terms of linear systems, we can derive the cotangent expressions this way:
Define $a' := |A'C'| = 2\sqrt{ac}$ and $b':= |B'C'|=2\sqrt{bc}$. We readily see that
$$\cot\theta = \frac{|A'B'|}{b-a}=\frac{a'+b'}{b-a} = \frac{2\sqrt{c}}{\sqrt{b}-\sqrt{a}} \tag{4}$$
Also, with $O$ the (unmarked) point where the lines meet,
$$\begin{align}
\frac{a}{|OA'|}=\frac{b}{|OB'|}&\quad\to\quad\frac{a}{|OC'|-|A'C'|}=\frac{b}{|OC'|+|B'C'|} \\[4pt]
&\quad\to\quad |OC'| = \frac{ab'+a'b}{b-a} = \frac{2\sqrt{abc}}{\sqrt{b}-\sqrt{a}} \tag{5}
\end{align}$$
so that
$$\cot2\theta = \frac{|OC'|}{c} = \frac{2\sqrt{ab/c}}{\sqrt{b}-\sqrt{a}} \tag{6}$$
The argument is still rather algebraic, but at least it feels a little more geometric. 
