Trilateration

Trilateration is a method for determining the intersections of three sphere surfaces given the centers and radii of the three spheres. Trilateration is used by GPS devices to compute exact location based on signals received from a satellite and the time that signal takes to get from the satellite to the receiver.

Derivation
A mathematical derivation for the solution of a three-dimensional trilateration problem can be found by taking the formulae for three spheres and setting them equal to each other. To simplify the calculations, we apply three constraints to the centers of these spheres; we assume all three spheres are centered on the z=0 plane, one is at the origin, and one other is on the x-axis. It is possible to transform any set of three points to comply with these constraints, find the solution point, and then reverse the translation to find the solution point in the original coordinate system.

We start with the equations for the three spheres


 * $$r_1^2=x^2+y^2+z^2$$


 * $$r_2^2=(x-d)^2+y^2+z^2$$,

and


 * $$r_3^2=(x-i)^2+(y-j)^2+z^2$$.

We need to find a point located at (x, y, z) that satisfies all three equations.

First we subtract the second equation from the first and solve for x:


 * $$x=\frac{r_1^2-r_2^2+d^2}{2d}$$.

We assume that the first two spheres intersect in more than one point, that is that d-r1 < r2 < d+r1. 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^2-r_2^2+d^2)^2}{4d^2}$$.

Substituting :$$y^2+z^2=r_1^2-x^2$$ into the formula for the third sphere and solving for y there results:


 * $$y=\frac{r_1^2-r_3^2-x^2+(x-i)^2+j^2}{2j}=\frac{r_1^2-r_3^2+i^2+j^2}{2j}-\frac{i}{j}x$$.

Now that we have the x- and y-coordinates of the solution point, we can simply rearrange the formula for the first sphere to find the z-coordinate:


 * $$z=\pm \sqrt{r_1^2-x^2-y^2}.$$

Now we have the solution to all three points x, y and z. 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 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.

Error model
When measurement error is introduced into the picture, things become a little more complicated. If we know that the distance from P to a reference point lies in a range (a closed interval) [r1, r2], then we know that P lies in a circular band between the circles of those two radii. If we know a range for another point, we can take the intersection, which will be either one or two areas bounded by circular arcs. A third point will usually narrow it down to a single area, but this area may still be of significant size; additional reference points can help shrink it further, but as the area shrinks more measurements quickly become less useful. In three dimensions, we are instead intersecting spherical shells with thickness, similar to bowling balls.

This new model emphasizes the importance of choosing three points that are in very different directions &mdash; if the points are relatively close together and all far from the point being located, it will take very precise measurement to find the point using trilateration.

Application
Trilateration can be used in lightning strike location detection. Detectors operating on a common clocking system can use the variation in arrival time of the radio-frequency emissions accompanying a strike to determine the distances from each detector to the strike. Such systems can be useful in forestry for fire prevention and in storm tracking.

A GPS receiver uses trilateration to determine its location from satellite data.