From Pythagoras’ theorem we know that
$${b^2 = h_c^2 + (c - d)^2}$$
Expanding the bracket:
$${b^2 = {\color{orange}{h_c^2}} + c^2 - 2cd + d^2}$$
Also,
$${a^2 = h_c^2 + d^2}$$
$${{\color{orange}{h_c^2 = a^2 - d^2}}}$$
Substituting, we get
$${b^2 = {\color{orange}{a^2 - d^2}} + c^2 - 2cd + d^2}$$
$${b^2 = a^2 + c^2 - 2c{\color{yellow}{d}}}$$
From the trigonometric ratios, we also know that
$${\cos{\beta} = \frac{d}{a} }$$
$${\color{yellow}{d = a \cdot \cos{\beta} } }$$
Substituting for d:
$${b^2 = a^2 + c^2 - 2{\color{yellow}{a }}c\cdot{\color{yellow}{\cos{\beta}}}}$$
the cosine rule - der Kosinussatz
$${b^2 = a^2 + c^2 - 2ac\cdot\cos{\beta}}$$
If looking for the angle given the three sides.
$${\cos{\beta} = \frac{a^2 + c^2 - b^2} {2ac}}$$
Remember that the square of the side opposite the given angle is subtracted from the sum of squares of the two sides enclosing the angle.
$${\beta = \cos^{-1}\left(\frac{a^2 + c^2 - b^2} {2ac}\right)}$$
or
$${\beta = \arccos\left(\frac{a^2 + c^2 - b^2} {2ac}\right)}$$
applications
CIMT - exercises (same as on sine rule page)