The exponential function $f(x)=e^{x}$ can be defined for exponents that are complex numbers, $a+b i,$ where $i=\sqrt{-1}$. Complex-valued functions may be differentiated just like real-valued functions, and previous derivative rules carry over in this setting. For example, $\left(e^{a x}\right)^{\prime}=a e^{a x}$ holds if $a$ and $x$ are complex numbers. Furthermore, in the complex-number domain there is an important formula (known as Euler's formula) relating exponential and trigonometric functions: $e^{i x}=\cos x+i \sin x$. (These topics are all addressed formally when we develop the theory of power series in Chapter $10 .)$
(a) Using Euler's formula, prove
$$
\sin x=\frac{e^{i x}-e^{-i x}}{2 i} \text { and } \cos x=\frac{e^{i x}+e^{-i x}}{2}
$$
(b) Using the expressions from (a) and the derivative rule for $e^{x}$, prove the derivative rules for $\sin x$ and $\cos x$.