Length of line segment at intersection of three spheres For laying out a grid of spheres, I need to calculate the the length of the line segment (highlighted in red) at the intersection of three spheres:

Each sphere has an equal radius and is centred on the corners of an equilateral triangle; the $y$-coordinate for each sphere's center is $0$.

So, my question is: given the radius and $z$ and $x$ coordinates of each sphere, how do I calculate the length of the line segment highlighted in red?
 A: Solve for $(x,y,z)$ in the system of equations
$$\begin{align*}
r_1^2 &= (x-x_1)^2 + (y-y_1)^2 + (z-z_1)^2\\
r_2^2 &= (x-x_2)^2 + (y-y_2)^2 + (z-z_2)^2\\
r_3^2 &= (x-x_3)^2 + (y-y_3)^2 + (z-z_3)^2
\end{align*}$$
In your case you already know $y_1=y_2=y_3=0$, so it may be useful to solve for $y$.
In nondegenerate cases it will have 0, 1 or 2 solutions. In the last case you can then calculate the distance.
A: 
It is clear from the sketch that the segment is along line passing through the centroid of the $\triangle ABC$ and parallel to $z$-axis. Now, let $E$ be one end of the segment, $F$ be the centroid of the triangle. Hence, in $\triangle EFB$, by Pythagoras theorem, $$EB^2=EF^2+FB^2$$ The length of the segment is $2EF$.
In the question we are given the $x$ and $z$ coordinates of the respective centers. We get the coordinates of the centroid $F$ of the $\triangle ABC$ as $$F=\left(\frac{x_1+x_2+x_3}{3},0,\frac{z_1+z_2+z_3}{3}\right)$$ Now, from this you get $BF$.
Here is the figure drawn in Geogebra of the situation.
