2. The base of a given pyramid is an equilateral triangle with side $a$, and the lateral edges have length $b$. A sphere is constructed that touches all (extended) edges of the pyramid. Find its radius.
Solution. Let $T$ be the centroid of the base $ABC$ with side $a$. Let the desired sphere have radius $R$ and let its center $O$ be at a distance $x$ from $T$ (see the left diagram). If $H$ is the height of the tetrahedron, then

$$
H=\sqrt{b^{2}-\left(\frac{a}{\sqrt{3}}\right)^{2}}=\sqrt{b^{2}-\frac{a^{2}}{3}}
$$

![](https://cdn.mathpix.com/cropped/2024_06_05_30cabe35fe679f8b5942g-5.jpg?height=520&width=1178&top_left_y=634&top_left_x=280)

From the similarity of $\triangle DTC \sim \triangle DSO$ (see the right diagram), we get

$$
\frac{\frac{a}{\sqrt{3}}}{b}=\frac{R}{H-x}, \text{ i.e. } \frac{a}{\sqrt{3 b}}=\frac{R}{\sqrt{b^{2}-\frac{a^{2}}{3}-x}}
$$

from which we obtain $x=\sqrt{b^{2}-\frac{a^{2}}{3}}-\frac{R b \sqrt{3}}{a}$. Then, from the right triangle $RTO$, we get,

$$
R^{2}=x^{2}+\left(\frac{a}{2 \sqrt{3}}\right)^{2}=\left(\sqrt{b^{2}-\frac{a^{2}}{3}}-\frac{R b \sqrt{3}}{a}\right)^{2}+\frac{a^{2}}{12}
$$

Solving this quadratic equation for $R$, we get

$$
R=\frac{(2 b \pm a) a}{2 \sqrt{3 b^{2}-a^{2}}}
$$

Note. When $R=\frac{(2 b-a) a}{2 \sqrt{3 b^{2}-a^{2}}}$, the center $O$ of the sphere is inside the pyramid, and in the other case, it is outside the pyramid.