Let’s suppose I have two spheres $S_1$ and $S_2$. Let's suppose they have a non-trivial intersection, meaning its not a point. Then their intersection forms a circle.
Assume I have the centers of each sphere $P_1$ and $P_2$. Assume their radii are $r_1$ and $r_2$ respectively.
Consider this diagram:
This is a cross section view of the spheres along their axis of intersection. Importantly, I wish to find the radius. A similar question is asked here:
The author suggests that we can get to the solution for the radius via $d_1^2 + d_2^2 = d^2$, but I don't understand how this is possible because, in this diagram, when you look at $d_{1}, d_{2}, d$ they are colinear, so I don't see how Pythagorean theorem would apply since that only applies to right triangles.
Can some explain why the formula is correct?
EDIT: it seems like this thread is relevant
https://mathworld.wolfram.com/Sphere-SphereIntersection.html
Let's assume momentarily that $P_1 = (0,0,0)$ and $P_2=(0,0,d)$.
Then we have the equations of the spheres given by
\begin{align*} x^2+y^2+z^2&=r_1^2\\ (x-d)^2+y^2+z^2&=r_2^2\\ \end{align*}
Combining and rearranging yields
$$x=\frac{d^2-r_2^2+r_1^2}{2d}$$
Then taking the first equation, we have
\begin{align*} x^2+y^2+z^2&=r_1^2\\ y^2+z^2&=r_1^2-x^2\\ y^2+z^2&= r_1^2-\left(\frac{d^2-r_2^2+r_1^2}{2d}\right)^2\\ y^2+z^2&= \frac{4d^2r_1^2-(d^2-r_2^2+r_1^2)^2}{4d^2}\\ \end{align*}
Calling $r^2\equiv \frac{4d^2r_1^2-(d^2-r_2^2+r_1^2)^2}{4d^2}$, you notice then, we can write this as
$$y^2+z^2 = r^2$$
implying the radius of this circle is
\begin{align*} r &= \sqrt{\frac{4d^2r_1^2-(d^2-r_2^2+r_1^2)^2}{4d^2}}\\ &=\frac{1}{2d} \sqrt{4d^2r_1^2-(d^2-r_2^2+r_1^2)^2} \end{align*}
User @peterwhy suggested the following test case. Let $r_1=r_2=d=1$ , then the radius of intersection common circle $r$ should be the height of an equilateral triangle of unit side: $r=\frac{\sqrt{3}}{2}$, which indeed this formula yields.
My question is, is this generalizable to any spheres with arbitrary centers so long as they intersect?
