Three circles $O_1(r_1)$, $O_2(r_2)$ and $O_3(r_3)$ touch each other externally. The line $l$ is tangent to $O_1(r_1)$ and parallel to the exterior common tangent $m$ to $O_2(r_2)$ and $O_3(r_3)$ which does not intersect $O_1(r_1)$. Find the distance between the lines $l$ and $m$.
I tried using Pythagoras theorem and got the following equations $$(h+r_3-r_2)^2 + (2\sqrt{r_2r_3}-x)^2 = (r_1 +r_2) ^2$$ $$h^2+x^2=(r_1+r_3)^2$$ where $r_1 + r_3 + h$ is the required length. I don't know how to proceed i.e. how to isolate $h$ in terms of $r_1$,$r_2$ and $r_3$.


Let $x$ be the distance between the parallel lines, and angles $\theta$ and $\phi$ as indicated in the diagram.
Using the cosine rule in $\triangle O_1O_2O_3$ gives $$(r_1+r_2)^2=(r_1+r_3)^2+(r_2+r_3)^2-2(r_1+r_3)(r_2+r_3)\cos(\pi-\theta-\phi)$$
Which leads to $$\cos(\theta+\phi)=\frac{r_1r_2-r_1r_3-r_2r_3-r_3^2}{(r_1+r_3)(r_2+r_3)}$$
Meanwhile, you also have $$\cos\phi=\frac{r_3-r_2}{r_3+r_2}$$ and $$\cos\theta=\frac{x-r_3-r_1}{r_1+r_3}$$
From this you can extract $x$ since you have all the radii.