Let us concentrate on rule cosine or law of cosine in detail with some examples. For any of the triangles, a, b, and c are sides of the triangle and c is the angle opposite to side c. The rule cosine is known as the law of cosine which states that
C = a2 + b2 – 2ab cos C

https://www.onlinemathlearning.com/law-of-cosines.html
This law of cosines is used to find out the following
- SAS: Two sides and one angle are known. The other side and angles must be solved.
- SSS: Three sides are known. The angles must be solved.
Example 1
How long is the side ‘r’? p measures 11 and q measures 8 with the R angle of 37 degrees?

Now we know that the angle R is 37 degree and sides p and q are 8 and 11 respectively. The rule cosine says that r2 = p2 + q2 – 2pq cos R
Now input the known values in the formula
R = 82 + 112 – 2 * 8 * 11 * cos37 = r = 64 + 121 – 176 * 0.79
Thus, r = 44.4
Now the r will be around 6.67 as per the decimal places.
Example 2 – find out the angle R, if the three sides measure 5, 8 and 9?

Let us now evaluate the law of cosines.
Start considering r2 = p2 + q2 – 2pq cosR
Now put p, q and r = 82 = 92 + 52 – 2 * 9 * 5 * cos R, then evaluate 64 = 81 + 25 – 90 * cosR.
Now we can use the skills of algebra and rearranging and find out
Subtract 25 from both the sides 39 = 81 – 90 * cos R and subtracting 81 from both sides -42 = -90 * cos R.
For swapping the sides: -90 * cos R = -42
Now dividing from both sides by -90 – cosR = 42/90
Inverse cosine R = cos inverse of 42/90 = 62.2 degree angle.