<s>[INST] How to find angle at centroid of triangle by its edge lengths? I need to write a program that takes length of a triangle's edges and calculates the angle $\angle APB$ ($P$ is the centroid of the triangle). Thanks for any help or clue.
 [/INST] $$
PA^2=\frac {2b^2+2c^2-a^2}9,\quad PB^2=\frac {2a^2+2c^2-b^2}9\\
\implies \cos(\angle APB)=\frac {PA^2+PB^2-c^2}{2\cdot PA \cdot PB}
=\frac {a^2+b^2-5c^2}{2\sqrt{(2b^2+2c^2-a^2)(2a^2+2c^2-b^2)}}.
$$
</s>