Here
c
2
=
a
2
+
b
2
−
2
a
b
⋅
cos
γ
{\displaystyle c^{2}=a^{2}+b^{2}-2ab\cdot \cos \gamma }
The law of cosines explains the relation between the sides and an angle of a triangle. The law states that for any triangle
Δ
A
B
C
{\displaystyle \Delta ABC}
, if
∠
A
C
B
=
θ
{\displaystyle \angle ACB=\theta }
,
A
B
=
c
{\displaystyle AB=c}
,
A
C
=
b
{\displaystyle AC=b}
and
B
C
=
a
{\displaystyle BC=a}
, then
c
2
=
a
2
+
b
2
−
2
a
b
⋅
cos
θ
{\displaystyle c^{2}=a^{2}+b^{2}-2ab\cdot \cos \theta }
. For
θ
=
π
2
,
Δ
A
B
C
{\displaystyle \theta ={\frac {\pi }{2}},\Delta ABC}
is a right angle and
c
2
=
a
2
+
b
2
{\displaystyle c^{2}=a^{2}+b^{2}}
, we have proved it as the pythagorean theorem earlier.
In any triangle, the square of one side's length is equal to the difference between the sum of the squares of the other two sides' lengths and twice the product of those two sides' lengths and the cosine of the included angle.
Assume,
Δ
A
B
C
{\displaystyle \Delta ABC}
is a triangle where
∠
A
C
B
=
θ
,
{\displaystyle \angle ACB=\theta ,}
A
B
=
c
{\displaystyle AB=c}
A
C
=
b
{\displaystyle AC=b}
and
B
C
=
a
.
{\displaystyle BC=a.}
It is needed to be proved that,
c
2
=
a
2
+
b
2
−
2
a
b
⋅
cos
θ
{\displaystyle c^{2}=a^{2}+b^{2}-2ab\cdot \cos \theta }
.
Let us extend the line segment
B
C
{\displaystyle BC}
to
B
D
{\displaystyle BD}
(only for obtuse triangles), where
A
D
⊥
B
D
{\displaystyle AD\perp BD}
. Assume
A
D
=
h
{\displaystyle AD=h}
and
C
D
=
k
{\displaystyle CD=k}
.
Construction for proving the law of cosines for angle
θ
>
π
/
2
{\displaystyle \theta >\pi /2}
.
According to the Pythagorean theorem, we can say that, for
Δ
A
C
D
,
{\displaystyle \Delta ACD,}
b
2
=
k
2
+
h
2
{\displaystyle b^{2}=k^{2}+h^{2}}
Similarly, for the triangle
Δ
A
B
D
,
{\displaystyle \Delta ABD,}
c
2
=
h
2
+
(
a
+
k
)
2
{\displaystyle c^{2}=h^{2}+(a+k)^{2}}
=
h
2
+
a
2
+
k
2
+
2
a
k
{\displaystyle =h^{2}+a^{2}+k^{2}+2ak}
=
a
2
+
b
2
+
2
a
k
{\displaystyle =a^{2}+b^{2}+2ak}
.
We will be using this value for further proof. But now, let's determine some trigonometric values for the triangles.
Here,
∠
A
C
D
=
π
−
θ
{\displaystyle \angle ACD=\pi -\theta }
.
Therefore,
k
b
=
cos
(
π
−
θ
)
{\displaystyle {\frac {k}{b}}=\cos(\pi -\theta )}
Or,
k
=
b
⋅
cos
(
π
−
θ
)
{\displaystyle k=b\cdot \cos(\pi -\theta )}
=
b
[
cos
(
π
)
⋅
c
o
s
(
θ
)
+
sin
(
π
)
⋅
sin
(
θ
)
]
{\displaystyle =b[\cos(\pi )\cdot cos(\theta )+\sin(\pi )\cdot \sin(\theta )]}
=
−
b
⋅
cos
(
θ
)
{\displaystyle =-b\cdot \cos(\theta )}
Now,
c
2
=
a
2
+
b
2
+
2
a
k
{\displaystyle c^{2}=a^{2}+b^{2}+2ak}
.
∴
c
2
=
a
2
+
b
2
−
2
a
b
⋅
cos
θ
{\displaystyle \therefore c^{2}=a^{2}+b^{2}-2ab\cdot \cos \theta }
. [Proved]
Construction for proving the law of cosines for angle
θ
<
π
/
2
{\displaystyle \theta <\pi /2}
.
Like as the proof we have proved before, according to the Pythagorean theorem, we can say that, for
Δ
A
C
D
,
{\displaystyle \Delta ACD,}
b
2
=
k
2
+
h
2
{\displaystyle b^{2}=k^{2}+h^{2}}
Similarly, for the triangle
Δ
A
B
D
,
{\displaystyle \Delta ABD,}
c
2
=
h
2
+
(
a
−
k
)
2
{\displaystyle c^{2}=h^{2}+(a-k)^{2}}
=
h
2
+
a
2
+
k
2
−
2
a
k
{\displaystyle =h^{2}+a^{2}+k^{2}-2ak}
=
a
2
+
b
2
−
2
a
k
{\displaystyle =a^{2}+b^{2}-2ak}
.
Here,
∠
A
C
D
=
θ
{\displaystyle \angle ACD=\theta }
.
Therefore,
k
b
=
cos
θ
{\displaystyle {\frac {k}{b}}=\cos \theta }
⇒
k
=
b
⋅
cos
θ
{\displaystyle \Rightarrow k=b\cdot \cos \theta }
Now,
c
2
=
a
2
+
b
2
−
2
a
k
{\displaystyle c^{2}=a^{2}+b^{2}-2ak}
.
∴
c
2
=
a
2
+
b
2
−
2
a
b
⋅
cos
θ
{\displaystyle \therefore c^{2}=a^{2}+b^{2}-2ab\cdot \cos \theta }
. [Proved]
[Note: Whatever the triangle is, the formula,
c
2
=
a
2
+
b
2
−
2
a
b
⋅
cos
θ
{\displaystyle c^{2}=a^{2}+b^{2}-2ab\cdot \cos \theta }
works.]