<s>[INST] Find X location using 3 known (X,Y) location using trilateration I post this question in stackoverflow here and was advised it was best suited for here.
I am trying to understand the maths behind trilateration, we have 3 access points $(\text{AP's: } 1,2,3)$ and we know the centre coordinates of theses $3$ (AP's). Lost device ($X$) is the location where all $3$ circle intersect.
example GRID $\Rightarrow x=30, y=30.$
Known Locations: $\text{AP}_1 = (5,5), \text{AP}_2 = (5,15), \text{AP}_3 = (20,10).$
Unknown Location: $X$
Lets say $X = (9,11)$
how do we work out the intersection of all $3$ circles by the maths.
your help is greatly appreciated.

 [/INST] Use the distance equation.  If your unknown point is $(x,y)$, your known points are $(x_i, y_i)$ which are distances $r_i$ from your unknown point, then you get three equations:
$$(x-x_1)^2 + (y-y_1)^2 = r_{1}^2 \\ (x-x_2)^2 + (y-y_2)^2 = r_{2}^2 \\ (x-x_3)^2 + (y-y_3)^2 = r_{3}^2$$
We can expand out the squares in each one:
$$x^2 - 2x_1x + x_1^2 + y^2 - 2y_1y + y_1^2 = r_1^2 \\ x^2 - 2x_2x + x_2^2 + y^2 - 2y_2y + y_2^2 = r_2^2 \\ x^2 - 2x_3x + x_3^2 + y^2 - 2y_3y + y_3^2 = r_3^2$$
If we subtract the second equation from the first, we get
$$(-2x_1 + 2x_2)x + (-2y_1 + 2y_2)y = r_1^2 - r_2^2 - x_1^2 + x_2^2 - y_1^2 + y_2^2 .$$
Likewise, subtracting the third equation from the second,
$$(-2x_2 + 2x_3)x + (-2y_2 + 2y_3)y = r_2^2 - r_3^2 - x_2^2 + x_3^2 - y_2^2 + y_3^2 .$$
This is a system of two equations in two unknowns:
$$Ax + By = C \\ Dx + Ey = F$$
which has the solution:
$$x = \frac{CE-FB}{EA-BD} \\ y = \frac{CD-AF}{BD-AE}$$
</s>