Law of Cosines Formula
A triangle has 6 elements (3 sides + 3 angles). Solving for 3 elements of a triangle when we know the other 3 elements is called "solving the triangle". The law of sines and the law of cosines are used to solve the triangle. The law of cosines formula is used to solve for the third side when two sides and their included angle are given. Let us learn the law of the cosines formula along with a few solved examples.
What is the Law of Cosines Formula?
The law of cosines formula is used to find the missing side of a triangle when its two sides and the included angle is given i.e., it is used in the case of a SAS triangle. We know that if A, B, and C are the vertices of a triangle, then their opposite sides are represented by the small letters a, b, and c respectively. The law of cosines formula is used to:
 find a when b, c, and A are given (or)
 find b when a, c, and B are given (or)
 find c when a, b, and C are given (or)
 find any angle of the triangle when a, b, and c are given.
There are three laws of cosines and we choose one of them to solve our problems depending on the available data.
a^{2} = b^{2} + c^{2 } 2bc.CosA
b^{2} = c^{2} + a^{2}  2ca.CosB
c^{2} = a^{2} + b^{2}  2ab.CosC
Let us try out a few simple examples to understand the applications of the Law of Cosines Formula.
Solved Examples on Law of Cosines Formula

Example 1: In a triangle ABC, the sides opposite to the vertices A, B, and C are denoted by a, b, and c respectively. Find the value of b if we are given that a = 3 units, c = 5 units, and B = 50°. Round your final answer to the nearest tenths.
Solution
To find: The value of the side b.
We are given the values of a, c, and B.
If you refer the above figure, B is the included angle of a and c. So we use the law of cosines to solve for b.
b^{2} = c^{2} + a^{2}  2ca cos B
b^{2} = 5^{2} + 3^{2}  2 × 5 × 3 cos 50°
b^{2} = 25 + 9  30 cos 50°
b^{2} = 34  30 (0.64278760968...) (using calculator by keeping it in degrees mode).
b^{2} = 34  19.28362829059....
b ≈ 3.8 (Rounded to the nearest tenths).
Answer: b = 3.8 units.

Example 2: In a triangle ABC, the sides opposite to the vertices A, B, and C are denoted by a, b, and c respectively. Find the angle at the vertex C if it is given that a = 4 units, b = 7 units, and c = 9 units. Round your answer to the nearest degree.
Solution
To find: The angle at C.
It is given that a = 4; b = 7; and c = 9.
Substitute these values in the law of cosines,
c^{2} = a^{2} + b^{2}  2ab cos C (We used this particular formula as we need to find angle C).
9^{2} = 4^{2} + 7^{2}  2 × 4 × 7 cos C
81 = 16 + 49  56 cos C
81 = 65  56 cos C
56 cos C = 6581 = 16
cos C = 16/56
C = cos^{1} (16/56) ≈ 107°
The answer is found using the calculator and is rounded to the nearest degree.
Answer: C = 107°.