Hello, in this post we are going to derive the trigonometric identities. While usually you would refer from a table with these identities when you deem it necessary to apply one, it comes in handy to have most of them memorised.
Introduction
The trigonometric functions are defined on a right angled triangle $ ABC $ for one of the angles of the triangle, in this case $\alpha$. We start by defining two sides relative to the angle known as the opposite side ($Opp$) and the adjacent side ($Adj$) which is the side that connects the angle to the $\frac{\pi}{2}$ angle. The third side is always the one opposite to the $\frac{\pi}{2}$ and is known as the hypoteneuse ($Hyp$).
From this, we can now define the 6 trigonometric functions as ratios of the sides of a rightangled triangle using the triangle above.
$$\tag{1} \sin(\alpha) = \frac{1}{\cosec(\alpha)} = \frac{Opp}{Hyp} = \frac{BC}{AB} $$ $$\tag{2} \cos(\alpha) = \frac{1}{\sec(\alpha)} = \frac{Adj}{Hyp} = \frac{AC}{AB} $$ $$\tag{3} \tan(\alpha) = \frac{1}{\cot(\alpha)} = \frac{Opp}{Adj} = \frac{BC}{AC} $$
We may also derive an easily accessible relationship between the ratios given by,
$$\tag{4} \tan(\alpha) = \frac{Opp}{Adj} = \frac{Opp}{Hyp}\frac{Hyp}{Adj} = \frac{Opp}{Hyp}\div\frac{Adj}{Hyp} = \frac{\sin(\alpha)}{\cos(\alpha)} $$
It is often useful to graph these functions which helps to visualize and build the intiution behind their behaviour. This graph runs through the values $ \frac{3\pi}{2} \leq \alpha \leq \frac{3\pi}{2} $,
From this graph, it may be interesting to find out for which values of $ \alpha $ the functions are equal. These include, $$\tag{5} \cos(\alpha) = \sin(\alpha  \frac{\pi}{2}); \; \; \sin(\alpha) = \cos(\alpha  \frac{\pi}{2}) $$
And using $(4)$ and the relationships in $(5)$, we may derive,
$$ \tan(\alpha) = \frac{\sin(\alpha)}{\cos(\alpha)} = \frac{\cos(\alpha  \frac{\pi}{2})}{\sin(\alpha  \frac{\pi}{2})} = \cot(\alpha  \frac{\pi}{2}) $$
Compound angle (or Ptolemy’s) identities
We will now start by deriving trigonometric identities that arise from trigonometric functions applied to a sum of angles.
Let’s start by considering a rightangled triangle $ OAB $ with the angle at $A = \frac{\pi}{2} $. We denote the angle of the triangle at origin as $ a $ and the angle between the $ y $axis and the triangle as $ b $. We also define the hypoteneuse of the triangle to be have a size of $ 1 $ units.
We now inscribe this triangle in the rectangle $ OCED $ which will prove useful later. We also denote other angles which one can verify by considering that all angles of the rectangle $ OCED $ as well as the angle $ OAB $ are right angles. This gives us the following figure:
Now, using the formulas,
$$ \sin(\theta) = \frac{Opp}{Hyp} \; \Rightarrow \; Opp = Hyp\sin(\theta); $$ $$ \cos(\theta) = \frac{Adj}{Hyp} \; \Rightarrow \; Adj = Hyp\cos(\theta); $$
and the hypoteneuse of size $ 1 $ we have that the lengths $ OA = \cos(a) $ and $ AB = \sin(a) $. By using the same formulas, along with the triangles $ AEB $, $ OCA $, and $ OBD $, we can label the lengths of all the other lines on the rectangle $ OCED $ as follows:
Now considering that opposite sides of a rectangle are equal we have the sides

$ OC = EB + BD $, from which we have, $$ \cos(a)\cos(b) = \sin(a)\sin(b) + \cos(a+b) $$ $$ \Rightarrow \; \cos(a+b) = \cos(a)\cos(b)  \sin(a)\sin(b) $$ $$ \tag{6} \Rightarrow \; \cos(a \pm b) = \cos(a)\cos(b) \mp \sin(a)\sin(b) $$

$ OD = AE + CA $, from which we have, $$ \sin(a + b) = \sin(a)\cos(b) + \cos(a)\sin(b) $$ $$ \tag{7} \Rightarrow \; \sin(a \pm b) = \sin(a)\cos(b) \pm \cos(a)\sin(b) $$
Dividing out $ (7) $ by $ \cos(a + b) $ we obtain, $$ \begin{aligned} \frac{\sin(a \pm b)}{\cos(a \pm b)} & = \; \frac{\sin(a)\cos(b)}{\cos(a \pm b)} \pm \frac{\cos(a)\sin(b)}{\cos(a \pm b)} \\ \; & = \; \frac{\sin(a)\cos(b)}{\cos(a)\cos(b) \mp \sin(a)\sin(b)} \pm \frac{\cos(a)\sin(b)}{\cos(a)\cos(b) \mp \sin(a)\sin(b)} \\ \; \end{aligned} $$
Now if we divide the numerators and the denominators of the RHS of equation above with $ \cos(a)\cos(b) $, we obtain:
$$ \tag{8} \tan(a \pm b) = \frac{\tan(a) \pm \tan(b)}{1 \mp \tan(a)\tan{b}} $$
Note that we are able to extend the formulas to handle $ (a  b) $ based on the fact that $ \sin(\theta) = \sin(\theta) $ and $ \cos(\theta) = \cos(\theta) $, i.e $ \sin $ and $ \cos $ are odd and even functions respectively.
Pythagorean identities
Using the same figure we used to derive compound angle formulas, but this time considering just the triangle $ OAB $ we can obtain an identity using Pythagora’s theorem,
so that, we have: $$ \tag{9} \cos^2(a) + \sin^2(a) = 1 $$
Dividing $ (9) $ all through by $ \cos^2(a) $, we have: $$ \frac{\cos^2(a)}{\cos^2(a)} + \frac{\sin^2(a)}{\cos^2(a)} = \frac{1}{\cos^2(a)} $$
$$ \tag{10} \Rightarrow \; 1 + \tan^2(a) = \sec^2(a) $$
While dividing all through by $ \sin^2(a) $, we obtain:
$$ \frac{\cos^2(a)}{\sin^2(a)} + \frac{\sin^2(a)}{\sin^2(a)} = \frac{1}{\sin^2(a)} $$
$$ \tag{11} \Rightarrow \; \cot^2(a) + 1 = \cosec^2(a) $$
Double angle identities
Using the compound angle cosine identity $ (6) $ when $ a = b $ we will have:
$$ \begin{aligned} \tag{12} \cos(2a) & = \; \cos^2(a)  \sin^2(a) \\ \; & = \; 1  2\sin^2(a) \\ \; & = \; 2\cos^2(a)  1 \end{aligned} $$
Note that to obtain the second and third identites of $ \cos(2a) $ we substite either the value of $ \sin^2(a) $ or $ \cos^2(a) $ using $ (9) $.
Using the compound angle sine identity $ (7) $ and by making $ a = b $ we have:
$$ \tag{13} \sin(2a) = 2\sin(a)\cos(a) $$
By making $ a = b $ in $ (8) $, we also have:
$$ \tag{14} \tan(2a) = \frac{2\tan(a)}{1  \tan^2(a)} $$
Half angle identities
These identities are obtained by manipulating the double angle identities. We start by supposing that $ a = 2b $. Then,
From $ (12) $, we have
$$ \begin{aligned} \cos(2b) & = \; 2\cos^2(b)  1 \\ \; \Rightarrow \cos^2(b) & = \; \frac{1 + \cos(2b)}{2} \\ \; \Rightarrow \cos(b) & = \; \pm \sqrt{\frac{1 + \cos(2b)}{2}} \end{aligned} $$
Since we have made the assumption that $ a = 2b $, this can be rewritten as
$$ \tag{15} \cos(\frac{a}{2}) = \; \pm \sqrt{\frac{1 + \cos(a)}{2}} $$
Using $ (12) $ but with identity $\cos(2a) = 1  2\sin^2(a)$ we can also obtain a similar result for $ \sin(\frac{a}{2}) $ to be:
$$ \tag{16} \sin(\frac{a}{2}) = \; \pm \sqrt{\frac{1  \cos(a)}{2}} $$
To obtain the half angle identity for the $ \tan $ function,
 We can divide $ (15) $ by $ (16) $ so, that:
$$ \tag{17} \tan(\frac{a}{2}) = \frac{\sin(\frac{a}{2})}{\cos(\frac{a}{2})} = \; \pm \sqrt{\frac{1  \cos(a)}{1 + \cos(a)}} $$
We can also use the identities $ \sin(2a) = 2\cos(a)\sin(a) $ along with $ \cos(2a) = 1  \sin^2(a) = \cos^2(a)  1 $ (double angle sine and cosine rules) to obtain other versions of the tangent half angle identities.
 That is, if we multiply both $ \cos(\frac{a}{2}) $ and $ \sin(\frac{a}{2}) $ (i.e the denominator and the numerator) above with $ 2\cos(\frac{a}{2}) $ we would obtain,
$$ \tag{18} \tan(\frac{a}{2}) = \frac{2\cos(\frac{a}{2})\sin(\frac{a}{2})}{2\cos^2(\frac{a}{2})} = \; \frac{2\cos(\frac{a}{2})\sin(\frac{a}{2})}{1 + 2\cos^2(\frac{a}{2})  1} = \; \frac{\sin(2\cdot\frac{a}{2})}{1 + \cos(2\cdot\frac{a}{2})} = \; \frac{\sin(a)}{1 + \cos(a)} $$
 We could also multiply both the denominator and the numerator above with $ 2\sin(\frac{a}{2}) $ in which case we would obtain,
$$ \tag{19} \tan(\frac{a}{2}) = \frac{2\sin^2(\frac{a}{2})}{2\sin(\frac{a}{2})\cos(\frac{a}{2})} = \; \frac{1  2\sin^2(\frac{a}{2})  1}{2\sin(\frac{a}{2})\cos(\frac{a}{2})} = \; \frac{\cos(2\cdot\frac{a}{2})  1}{\sin(2\cdot\frac{a}{2})} = \; \frac{1  \cos(a)}{\sin(a)} $$
Productsum identities
Suppose we added $ \sin(c + d) $ and $ \sin(c  d) $. Then, by $ (7) $, we would have:
$$ \begin{aligned} \sin(c+d) + \sin(cd) & = \; \big(\sin(c)\cos(d) + \cos(c)\sin(d)\big) + \big(\sin(c)\cos(d)  \cos(c)\sin(d) \big) \\ \; & = \; 2\sin(c)\cos(d) \end{aligned} $$
Now if we make $ c + d = a $ and $ c  d = b $, and by solving for $ a $ and $ b $ we would have:
$$ \tag{20} \sin(a) + \sin(b) = 2\sin(\frac{a+b}{2})\cos(\frac{ab}{2}) $$
Similarly, we can obtain results for:
$$ \tag{21} \cos(a) + \cos(b) = 2\cos(\frac{a+b}{2})\cos(\frac{ab}{2}) $$ $$ \tag{22} \sin(a)  \sin(b) = 2\cos(\frac{a+b}{2})\sin(\frac{ab}{2}) $$ $$ \tag{23} \cos(a)  \cos(b) = 2\sin(\frac{a+b}{2})\sin(\frac{ab}{2}) $$
Product identities
Now consider the identity $ (20) $, above. We have,
$$ \sin(c) + \sin(d) = 2\sin(\frac{c+d}{2})\cos(\frac{cd}{2}) $$
This may be rewritten as:
$$ \sin(\frac{c+d}{2})\cos(\frac{cd}{2}) = \frac{\sin(c) + \sin(d)}{2} $$
Again, if we suppose that $ \frac{c+d}{2} = a $ and $ \frac{cd}{2} = b $ and solve for $ c $ and $ d $, we would have:
$$ \tag{24} \sin(a)\cos(b) = \frac{\sin(a+b) + \sin(ab)}{2} $$
Similarly, we can obtain:
$$ \tag{25} \cos(a)\cos(b) = \frac{\cos(a+b) + \cos(ab)}{2} $$ $$ \tag{26} \sin(a)\sin(b) = \frac{\cos(ab)  \cos(a+b)}{2} $$
Cosine and sine laws
Although these laws are not considered to be trigonometric identities, they will often show up in problems and are worth covering. We will start by deriving the sine law.
Sine law
Consider the triangle below,
We will denote the angles on the triangle with the name of the point on which the angle is formed. For each angle, we also denote the side opposite to it by its lower case letter.
Now by definition of the $ \sin $ function, we have:
$$ \sin(A) = \frac{CO}{b}; \; \; \; \sin(B) = \frac{CO}{a} $$ $$ \Rightarrow b\sin(A) = CO; \; \; \; a\sin(B) = CO $$
Which implies that, $$ b\sin(A) = a\sin(B) \Rightarrow \frac{a}{\sin(A)} = \frac{b}{\sin(B)} $$
The same argument may be extended to the angle $ C $ at which point we will have,
$$\tag{27} \frac{a}{\sin(A)} = \frac{b}{\sin(B)} = \frac{c}{\sin(C)} $$
Cosine law
To derive the cosine law, we will use the triangle below:
Let the length $ AO = x $ and $ CO = h $. Then $ OB = c  x $, which means,
$$ \begin{aligned} a^2 & = (c  x)^2 + h^2 \\ \; & = c^2  2cx + x^2 + h^2; \\ \\ \; b^2 & = x^2 + h^2 \\ \; \Rightarrow a^2 & = b^2 + c^2  2cx \end{aligned} $$
But we also have,
$$ \cos(A) = \frac{x}{b} \Rightarrow x = b\cos(A) $$
Which if we substite in the equation above, we have, $$\tag{28} a^2 = b^2 + c^2  2bc\cos(A) $$
The same argument may be extended to the other two angles, so that,
$$\tag{29} b^2 = a^2 + c^2  2ac\cos(B) $$ $$\tag{30} c^2 = a^2 + b^2  2ab\cos(C) $$
This concludes our tour of the trigonometric identities!