You may need the following formula (the cosine law):
a 2 = b 2 + c 2 − 2 b c ⋅ cos θ {\displaystyle a^{2}=b^{2}+c^{2}-2bc\cdot \cos \theta ~}