Maximizing/minimizing $f(\theta) = \sqrt{2}\cos(\theta)-4\sin(\theta)$ 
Assume that $f : [0, 2\pi]\rightarrow \mathbb{R}$ is a function such that $f(\theta) = \sqrt{2}\cos(\theta)-4\sin(\theta)$. Then, how can we maximize/minimize $f$?

We can re-parametrize our function $f$ by defining another function $g : [-1, 1]\rightarrow \mathbb{R}$ function such that for every $t\in [-1, 1]$,
$$g(t) = \sqrt{2}\sqrt{1-t^2}-4t$$
$$\frac{dg}{dt} = \frac{d}{dt}\left(\sqrt{2}\sqrt{1-t^2}-4t\right) = \frac{\sqrt{2}t}{\sqrt{1-t^2}} + 4 = 0$$
From which we conclude that $g$ attains its maximum/minimum at $\left(-\frac{2\sqrt{2}}{3}, g\left(-\frac{2\sqrt{2}}{3}\right)\right), (1, g(1))\in \mathbb{R}^2$ respectively.

$f(\theta) = \sqrt{2}\cos(\theta)-4\sin(\theta) = \sqrt{18}( \sin\alpha \cos \theta  - \cos \alpha \sin \theta)$ where $\sin \alpha = \frac{\sqrt{2}}{\sqrt{18}}$ and $\cos \alpha = \frac{4}{\sqrt{18}}$ and hence $\alpha = arctan \frac{\sqrt{2}}{4}$. Thus
$$f(\theta) = \sqrt{18}\sin(\alpha - \theta) \le \sqrt{18}$$ and the estimate is best possible.
