Figure 1. The plane z = 0, showing the three sphere centers, P1, P2, and P3; their x,ycoordinates; and the three sphere radii, r1, r2, and r3. The two intersections of the three sphere surfaces are directly in front and directly behind the point designated intersections in the z = 0 plane.
In geometry, trilateration is the process of determining absolute or relative locations of points by measurement of distances, using the geometry of circles, spheres or triangles.^{[1]}^{[2]}^{[3]}^{[4]}
In addition to its interest as a geometric problem, trilateration does have practical applications in surveying and navigation, including global positioning systems (GPS). In contrast to triangulation, it does not involve the measurement of angles.
In twodimensional geometry, it is known that if a point lies on two circles, then the circle centers and the two radii provide sufficient information to narrow the possible locations down to two. Additional information may narrow the possibilities down to one unique location.
In threedimensional geometry, when it is known that a point lies on the surfaces of three spheres, then the centers of the three spheres along with their radii provide sufficient information to narrow the possible locations down to no more than two (unless the centers lie on a straight line).
This article describes a method for determining the intersections of three sphere surfaces given the centers and radii of the three spheres.
Contents

Derivation 1

Preliminary and final computations 2

See also 3

External links 4

References 5
Derivation
The intersections of the surfaces of three spheres is found by formulating the equations for the three sphere surfaces and then solving the three equations for the three unknowns, x, y, and z. To simplify the calculations, the equations are formulated so that the centers of the spheres are on the z = 0 plane. Also, the formulation is such that one center is at the origin, and one other is on the xaxis. It is possible to formulate the equations in this manner since any three noncollinear points lie on a unique plane. After finding the solution, it can be transformed back to the original three dimensional Cartesian coordinate system.
We start with the equations for the three spheres:

r_1^2=x^2+y^2+z^2 \,

r_2^2=(xd)^2+y^2+z^2 \,

r_3^2=(xi)^2+(yj)^2+z^2 \,
d is the x coordinate of point P2. You have to subtract it from x to get the length of the base of the triangle between the intersection and r2 (x, y, z are coordinates, not lengths).
We need to find a point located at (x, y, z) that satisfies all three equations.
We need to use r1 and r2 to eliminate y and z from the equation and solve for x:

r_1^2=x^2+y^2+z^2 \,

r_2^2=(xd)^2+y^2+z^2.

r_1^2  r_2^2 = x^2  (xd)^2 \,

r_1^2  r_2^2 = x^2  (x^2  2xd + d^2) \,

r_1^2  r_2^2 = 2xd  d^2 \,

r_1^2  r_2^2 + d^2 = 2xd \,

x=\frac{r_1^2r_2^2+d^2}{2d}.
Assuming that the first two spheres intersect in more than one point, that is that

dr_1 < r_2 < d+r_1. \,
In this case, substituting the equation for x back into the equation for the first sphere produces the equation for a circle, the solution to the intersection of the first two spheres:

y^2+z^2=r_1^2\frac{(r_1^2r_2^2+d^2)^2}{4d^2}.
Substituting z^2=r_1^2x^2y^2 into the formula for the third sphere and solving for y there results:

y=\frac{r_1^2r_3^2x^2+(xi)^2+j^2}{2j}=\frac{r_1^2r_3^2+i^2+j^2}{2j}\frac{i}{j}x.
Now that the x and ycoordinates of the solution point are found, the formula can be rearranged for the first sphere to find the zcoordinate:

z=\pm \sqrt{r_1^2x^2y^2}.
Now the solution to all three points x, y and z is found. Because z is expressed as the positive or negative square root, it is possible for there to be zero, one or two solutions to the problem.
This last part can be visualized as taking the circle found from intersecting the first and second sphere and intersecting that with the third sphere. If that circle falls entirely outside or inside of the sphere, z is equal to the square root of a negative number: no real solution exists. If that circle touches the sphere on exactly one point, z is equal to zero. If that circle touches the surface of the sphere at two points, then z is equal to plus or minus the square root of a positive number.
Preliminary and final computations
The Derivation section pointed out that the coordinate system in which the sphere centers are designated must be such that

all three centers are in the plane z = 0,

the sphere center, P1, is at the origin, and

the sphere center, P2, is on the xaxis.
In general the problem will not be given in a form such that these requirements are met.
This problem can be overcome as described below where the points, P1, P2, and P3 are treated as vectors from the origin where indicated. P1, P2, and P3 are of course expressed in the original coordinate system.

\hat e_x = \frac{ P2  P1 }{ \ P2  P1 \ } is the unit vector in the direction from P1 to P2.

i = \hat e_x \cdot ( P3  P1 ) is the signed magnitude of the x component, in the figure 1 coordinate system, of the vector from P1 to P3.

\hat e_y = \frac{ P3  P1  i \; \hat e_x}{ \ P3  P1  i \; \hat e_x \ } is the unit vector in the y direction. Note that the points P1, P2, and P3 are all in the z = 0 plane of the figure 1 coordinate system.
The third basis unit vector is \hat e_z = \hat e_x \times \hat e_y. Therefore,

d = \ P2  P1 \ the distance between the centers P1 and P2 and

j = \hat e_y \cdot ( P3  P1 ) is the signed magnitude of the y component, in the figure 1 coordinate system, of the vector from P1 to P3.
Using i, \; d and j as computed above, solve for x, y and z as described in the Derivation section. Then

\vec p_{1,2} = P1 + x \ \hat e_x + y \ \hat e_y \ \pm \ z \ \hat e_z
gives the points in the original coordinate system since \hat e_x, \; \hat e_y and \hat e_z, the basis unit vectors, are expressed in the original coordinate system.
See also
External links

stackexchange.com, PHP / Python Implementation
References

^ Encyclopædia Britannica

^ diracdelta

^ Global Maritime

^ free dictionary
This article was sourced from Creative Commons AttributionShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, EGovernment Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a nonprofit organization.