# Find the center and radius of a circle tangent to three given semi-circles

Three semi-circles have their centers as follows: $$(0,0), (2, 0), (-4, 0)$$ with radii of $$6, 4, 2$$, respectively. Determine the radius and center coordinates of a circle that is tangent to all three semi-circles.

My attempt:

Let $$C_1 = (x_1, y_1) = (0,0), C_2 = (x_2, y_2)= (2, 0), C_3 = (x_3,y_3) = (-4, 0)$$ and let $$r_1 = 6 , r_2 = 4, r_3 = 2$$.

Further, let $$C_4 = (x_4, y_4)$$ be the center of the required circle, and $$r_4$$ be its radius, then by connecting the centers of the fourth circle with each of the first three, we can write the following three quadratic equations:

$$(x_4 - x_1)^2 + (y_4 - y_1)^2 = (r_1 - r_4)^2$$

$$(x_4 - x_2)^2 + (y_4 - y_2)^2 = (r_2 + r_4) ^ 2$$

$$(x_4 - x_3) ^ 2 + (y_4 - y_3) ^ 2 = (r_3 + r_4) ^ 2$$

My question is, how to solve these three equations for the unknowns $$x_4, y_4, r_4$$?

• Hint: the radii of the four circles satisfy Descrate's theorem: $$\left(-\frac1{r_1} + \frac1{r_2} + \frac1{r_3} + \frac1{r_4}\right)^2 = 2\left(\frac1{r_1^2} + \frac1{r_2^2} + \frac1{r_3^2} + \frac1{r_4^2}\right)$$ Commented Nov 6, 2023 at 9:27
• @JuvHuffpuff $(r_1-r_4)^2$ is correct because circle 4 is tangent to inside of circle 1. Commented Nov 6, 2023 at 9:29
• The formula given by @achille hui can be complemented by another one giving (in a complex numbers setting) the centers of the circles (see formula (2) here) Commented Nov 6, 2023 at 9:40
• Subtracting the first equation from the other two, you get two linear equations which you can use to express $x_4$ and $y_4$ as a function of $r_4$. Plug then those expressions into the first equation. Commented Nov 6, 2023 at 10:32
• That's okay. I am not gonna solve it by hand. I'll using my math library to solve the linear system and the quadratic system that follows. Commented Nov 6, 2023 at 13:00

As @intelligentipauca suggested, I started by subtracting the second equation from the first, this gives

$$x_4 (-2 x_1 + 2 x_2 ) + y_4 (- 2 y_1 + 2 y_2 ) + x_1^2 - x_2^2 + y_1^2 - y_2^2 = r_4 (- 2 r_1 - 2 r_2 ) + r_1^2 - r_2^2$$

And similarly, subtracting the third equation from the first equation gives

$$x_4 (-2 x_1 + 2 x_3 ) + y_4 (- 2 y_1 + 2 y_3 ) + x_1^2 - x_3^2 + y_1^2 - y_3^2 = r_4 (- 2 r_1 - 2 r_3 ) + r_1^2 - r_3^2$$

Now we have a linear system of two equations in $$3$$ unknowns.

The system can be expressed as follows

$$A X = B$$

where $$X = [x_4, y_4, r_4]^T$$

and

$$A = \begin{bmatrix}-2 x_1 + 2 x_2 && - 2 y_1 + 2 y_2 && 2 r_1 + 2 r_2 \\ -2 x_1 + 2 x_3 && - 2 y_1 + 2 y_3 &&2 r_1+ 2 r_3\end{bmatrix}$$

and

$$B = \begin{bmatrix} -x_1^2 + x_2^2 - y_1^2 + y_2^2 + r_1^2 - r_2^2 \\ -x_1^2 + x_3^2 - y_1^2 + y_3^2 + r_1^2 - r_3^2 \end{bmatrix}$$

Plugging the given values of $$x_1, x_2, x_3, y_1, y_2, y_3, r_1, r_2, r_3$$, gives us

$$A = \begin{bmatrix} 4 && 0 && 20 \\ -8 && 0 && 16 \end{bmatrix}$$

$$B = \begin{bmatrix} 24 \\ 48 \end{bmatrix}$$

The solution of which is

$$X = \dfrac{1}{7} \begin{bmatrix} -18 \\ 0 \\ 12 \end{bmatrix} + \lambda \begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix}$$

So that,

$$C_4 = \dfrac{1}{7} \begin{bmatrix} -18 \\ 0 \end{bmatrix} + \lambda \begin{bmatrix} 0 \\ 1 \end{bmatrix}$$

And

$$r_4 = \dfrac{12}{7}$$

Pluggin these into

$$(C_4 - C_1)^T (C_4 - C_1) = (r_1 - r_4)^2$$

Gives

$$\lambda = \dfrac{24}{7}$$

So that

$$C_4 = \dfrac{1}{7} \begin{bmatrix} -18 \\ 24 \end{bmatrix}$$

• In this particular case the coefficient of $y_4$ vanishes in both linear equations. Hence you have a linear system with only two unknowns ($r_4$ and $x_4$) which can be solved. No need to use Descartes' formula. Commented Nov 6, 2023 at 22:08
• Thanks @Intelligentipauca, I've modified my solution to avoid the calculation of $r_4$ based of Descartes' formula. Commented Nov 9, 2023 at 12:07