3.20. The radii of circles $S_{1}$ and $S_{2}$, touching at point $A$, are $R$ and $r (R>r)$. Find the length of the tangent drawn to circle $S_{2}$ from point $B$ on circle $S_{1}$, given that $A B=a$. (Consider the cases of internal and external tangency.)
3.20. Let $O_{1}$ and $O_{2}$ be the centers of circles $S_{1}$ and $S_{2} ; X$ - the second intersection point of line $A B$ with circle $S_{2}$. The square of the desired tangent length is $B A \cdot B X$. Since $A B: B X=O_{1} A: O_{1} O_{2}$, then $A B \cdot B X=A B^{2} \cdot O_{1} O_{2} / R=$ $=a^{2}(R \pm r) / R$, where the minus sign is taken in the case of internal tangency.