<s>[INST] Find vertex coordinates of a square given their distances $p,\>s,\>q,\>r$ to an inner point 
The figure represents a square, with P a point inside the square. The four segments are drawn from P to the four vertices of the square and they are named p, q, r, s. 
If the bottom-left vertex is at origin and the sides of the square are parallel to the axes (square is drawn in the first quadrant), find the co-ordinates of other three vertices if the measures of p, q, r, s are given.
I'm seeking your help.
 [/INST] 
Let $P(x,y)$ and $a$ the side length of the square. Then, 
$$x^2+y^2=p^2, \>\>\>
(a-x)^2+y^2=s^2,\>\>\> x^2+(a-y)^2=r^2
$$
The 2nd and 3rd equations leads to
$x= \frac{a^2+p^2-s^2 }{2a}$ and $y= \frac{a^2+p^2-r^2}{2a}$.
Substitute them into the 1st equation to get
$$ a^4 -(s^2+r^2)a^2 +\frac12[(s^2-p^2)^2+ (r^2-p^2)^2]=0
$$
Solve for $a$ to obtain the vertex coordinates $(0,a)$, $(a,0)$ and $(a,a)$ with 
$$a= \left(\frac{s^2+r^2}2 +\left( p^2(s^2+r^2)-p^4 -\frac14(s^2-r^2)^2 \right)^{1/2} \right)^{1/2}
$$
Note that $q^2 = s^2+r^2-p^2$ can not be separately specified. For example, $p=3$, $s=7$ and $r=9$ result in $q=11$ and $a=\sqrt{65+7\sqrt{17}}=9.7$.
</s>