<s>[INST] Edge length of an equilateral triangle if distances from a point $P$ to its vertices is given A point $P$ is located inside an equilateral triangle and is at a distance of 5, 12, and 13 from its vertices. Compute the edge length of the triangle.
The answer is $\sqrt{169 + 60\sqrt(3)}$.
If $s$ is the edge length of the triangle, and if $x$ is the measure of the angle with vertex at $P$ and with sides of lengths 5 and 12, and if $y$ is the measure of the angle with vertex at $P$ and with sides of lengths 5 and 13, according to the Law of Cosines,
\begin{equation*}
s^{2} = 169 - 120\cos(x)
\end{equation*}
\begin{equation*}
s^{2} = 194 - 130\cos(y)
\end{equation*}
and since $\cos(360 - (x + y)) = \cos(x + y)$,
\begin{equation*}
s^{2} = 313 - 312\cos(x+y)
\end{equation*}
So,
\begin{align*}
\cos{x} = - \frac{s^{2} - 169}{120} , \\
\cos{y} = - \frac{s^{2} - 194}{130} , \\
\cos(x+y) = - \frac{s^{2} - 313}{312} .
\end{align*}
For any real numbers $\theta$ and $\phi$,
\begin{equation*}
\bigl[\cos{\theta}\cos{\phi} - \cos(\theta + \phi)\bigr]^{2}
= \sin^{2}\theta\sin^{2}\phi
= \bigl(1 - \cos^{2}\theta\bigr)\bigl(1 - \cos^{2}\phi\bigr) .
\end{equation*}
So,
\begin{align*}
&\left[\frac{s^{2} - 169}{120} \cdot \frac{s^{2} - 194}{130} + \frac{s^{2} - 313}{312}\right]^{2} \\
&\qquad \qquad = \left(1 - \left(\frac{s^{2} - 169}{120}\right)^{2}\right)\left(1 - \left(\frac{s^{2} - 194}{130}\right)^{2}\right)
\end{align*}
or equivalently, by multiplying by $(120^{2})(130^{2})312$,
\begin{align*}
&\Bigl[312(s^{2} - 169)(s^{2} - 194) + (120^{2})(130^{2})(s^{2} - 313)\Bigr]^{2} \\
&\qquad \qquad
= 312 \Bigl((120^{2})(130^{2}) - 130^{2}(s^{2} - 194)\Bigr)
\Bigl((120^{2})(130^{2}) - 120^{2}(s^{2} - 194)\Bigr) .
\end{align*}
How is the quartic equation in the variable $s$ to be solved?
 [/INST] 
Given $a,b,c$, 
the equilateral triangle 
with the internal point $P$,
located at distances $a,b,c$ from its vertices,
can be constructed as follows.
Start with $\triangle ABC$,
$|BC|=a$,
$|CA|=b$,
$|AB|=c$,
$\angle CAB=\alpha$,
$\angle ABC=\beta$,
$\angle BCA=\gamma$.
Construct a helper external equilateral triangle,
based on any side of $\triangle ABC$,
for example, $\triangle ADB$.
Then $|CD|=u$ is the side of sought equilateral triangle,
which can be constructed in-place
as either 
$\triangle CFD$ with $P=A$
or $\triangle DEC$ with $P=B$.
Note that the three angles at $P$ are 
$\alpha+60^\circ$,
$\beta+60^\circ$,
$\gamma+60^\circ$,
hence such equilateral triangle 
with internal point $P$
can be constructed only if 
angles of $\triangle ABC$
are less than $120^\circ$.
The length of the side, $u$,
can be found by the cosine rule,
for example:
\begin{align} 
\triangle ADC:\quad
u^2&=
b^2+c^2-2bc\cos(\alpha+60^\circ)
\\
&=b^2+c^2-bc(\cos\alpha-\sqrt3\sin\alpha)
\\
&=b^2+c^2-bc\cos\alpha+bc\sqrt3\sin\alpha)
\\
&=b^2+c^2-bc\cos\alpha+2\sqrt3 S_{\triangle ABC}
,\\
\triangle ABC:\quad
\cos\alpha&=\frac1{2bc}\,(b^2+c^2-a^2)
,\\
u^2&=
b^2+c^2-\tfrac12\,(b^2+c^2-a^2)+2\sqrt3 S_{\triangle ABC}
\\
&=\tfrac12\,(a^2+b^2+c^2)
+2\sqrt3 S_{\triangle ABC}
,
\end{align}
where $S_{\triangle ABC}$
is the area of $\triangle ABC$.
</s>