How to solve n-lateration problem? Given a 3D coordinates of a set of $n$ points: $A_1(x_1,y_1,z_1), A_2(x_2,y_2,z_2), ... A_n(x_n,y_n,z_n)$. Also, $\forall i \in [1..n]$ we know some approximate distance $l_i$, from point $A_i$ to point $L$, and it is known that $l_n$ could have some unknown, but relatively small error. I mean $\frac{l_n+|A_nL|}{|A_nL|} \approx 1$, ratio could be equal to 1 but this is not guranteed, and there is no way to measure error.
The task is to find coordinates of $L(x,y,z)$ with least possible absolute error. There is no way to measure error.
How could i solve this "$n$-radar location", or "$n$-lateration" problem?
PS. I thought following analytical geometry algorithm. 
for each sphere pair we could


*

*draw a line segment, connecting their centres,

*find a point on that line, which dissects segment in a ratio of their radiuses. 

*draw a plane through that point and perpendicular to that line. 
then several cases, i even dont know now how to determine.


*

*In ideal case (when all lenghts were measured without an error) that planes will intersect in a single point. Well, $L$ is found! (in this case we could use spheres equation system and it will have single root)

*Otherwise this could be concave 2d polygon or 3d mesh. and we have somehow to find its.. center of mass, assuming that mesh is a solid body having uniform density. 



I feel, it has to do something with matrix lineal algebra. where $A$ is $3 * n$ matrix and $l$ is a vector of length $n$. And solution is known and is a kind of matrix-vector magic, eg multiply-divide-.... giving one and exactly one point in result. You just have to know it or not know. I dont, so am asking.
 A: To determine the coordinate $(x,y,z)$ of the point $L$, we have $n$ equations
$$(x-x_i)^2+(y-y_i)^2+(z-z_i)^2=l_i^2(1+2\epsilon_i),$$
with $i=1,2,\ldots,n$. We may expand the squares to obtain
$$x^2+y^2+z^2-2xx_i-2yy_i-2zz_i+(x_i^2+y_i^2+z_i^2-l_i^2)=2l_i^2\epsilon_i.$$
Your proposed method is equivalent to using two such equations at a time and subtracting one from the other to cancel $\,x^2+y^2+z^2\,$ and obtain a linear equation for $x,y,z\,$ (which is a plane in $\mbox{3D}$). But this either correlates the errors of different planes or not fully using the data (by obtaining only $n/2\,$ planes). An improvement of the method is to consider $x^2+y^2+z^2=A$, $x$, $y$, and $z$ as $4$ independent variables. Then we have $n$ linear equations for them
$$A-2xx_i-2yy_i-2zz_i+(x_i^2+y_i^2+z_i^2-l_i^2)=2l_i^2\epsilon_i,$$
with $i=1,2,\ldots,n$. If $n\geq 4$, we can find a least-square solution $(A^*,x^*,y^*,z^*)$ using linear algebra, which minimizes $\sum_i\epsilon_i^2$. Then $A^*\,$ and $\,(x^*)^2+(y^*)^2+(z^*)^2\,$ will be within error, since their true values would be exactly equal. We may then locally linearize the nonlinear constraint $\,A=x^2+y^2+z^2\,$ around $(A^*,x^*,y^*,z^*)$ using $\,dA=2xdx+2ydy+2zdz\,$ to obtain
$$A=A^*+2x^*(x-x^*)+2y^*(y-y^*)+2z^*(z-z^*).$$
Then we have $n+1$ linear equations for $4$ unknowns $A,x,y,z$. The constraint equation has no error (except the nonlinearity of order $\mathcal{O}(\epsilon^2)$). We may use it to cancel all of the $A$'s in the other $n$ equations with errors and do a least-square fitting again to obtain $x,y,z$.
