Use Quadrilateration to locate a point I'm having lots of trouble with this. At first I thought the problem was a matter of equating four spheres to find their one common point, i.e. point of intersection. I've looked up lots of things on trilateration, which makes perfect sense to me, however I'm just missing something when it comes to quadrilateration, which is necessary for this problem because not all points will lie on the z=0 plane. 
The ultimate aim is to make a program which will use quadrilateration to find the (x,y,z) coordinates of a point, given an input of the radii, and the amount each sphere has been shifted away along any of the axes ($a_n, b_n, c_n$). Therefore an ideal answer would be a derivation of a general formula for finding said point.
Here's what I have done so far:


*

*I began by defining n spheres as follows:


$$
(x-a_n)^2 +(y-b_n)^2+(z-c_n)^2=r_n^2
$$
(As I only need 4 spheres, n will range from 1-4) 


*

*Next, I isolated $x^2$:


$$
x^2=r_n^2-(y-b_n)^2-(z-c_n)^2+2a_nx-a_n^2
$$
I did the same for y and z. This is where I get confused: I have 4 equations (for the 4 spheres) but only 3 unknowns (the coordinate of their overlap). Am I doing something wrong, or is there something I'm missing? This is a steady-state problem and shouldn't be too complex but I just can't find anything online to help me, everything seems to be related to GPS, however that takes into account the relative motion of the satellites which complicates things.
Any and all help will be really appreciated, thank you in advance!

The intersection between two spheres is a circle, lying in a plane whose equation you can find by subtracting the equation of one sphere from that of the other one (the equations must be normalized so that $x^2$, $y^2$ and $z^2$ all have unit coefficient). This plane is perpendicular to the line joining the centers of the spheres.
If three spheres intersect at a point, the three circles you get from their pairwise intersections have two points in common. That happens because the planes of those circles are all perpendicular to the plane defined by the centers of the spheres, so they must have a line in common.
A fourth sphere is then needed to choose the right point. Given the equations of the spheres, a practical way to find their intersection point (assuming it exists) could be as follows:


*

*subtract the equation of the first sphere from the equation of the second one, to get the equation of plane $\alpha$;

*subtract the equation of the second sphere from the equation of the third one, to get the equation of plane $\beta$;

*subtract the equation of the third sphere from the equation of the fourth one, to get the equation of plane $\gamma$;

*those three planes should have a single point in common, which is the one you are seeking. To find its coordinates, just solve the linear system formed with the equations of $\alpha$, $\beta$ and $\gamma$.
