Find the maximum and minimum values
Question:

Find the maximum and minimum values of $y=\tan x-2 x$.

Solution:

Given : $f(x)=y=\tan x-2 x$

$\Rightarrow f^{\prime}(x)=\sec ^{2} x-2$

For a local maxima or local minima, we must have

$f^{\prime}(x)=0$

$\Rightarrow \sec ^{2} x-2=0$

$\Rightarrow \sec ^{2} x=2$

$\Rightarrow \sec x=\pm \sqrt{2}$

$\Rightarrow x=\frac{\pi}{4}$ and $\frac{3 \pi}{4}$

Thus, $x=\frac{\pi}{4}$ and $x=\frac{3 \pi}{4}$ are the possible points of local maxima or a local minima.

Now,

$f^{\prime \prime}(x)=2 \sec ^{2} x \tan x$

At $x=\frac{\pi}{4}:$

$f^{\prime \prime}\left(\frac{\pi}{4}\right)=2 \sec ^{2}\left(\frac{\pi}{4}\right) \tan \left(\frac{\pi}{4}\right)=4>0$

So, $x=\frac{\pi}{4}$ is a point of local minimum.

The local minimum value is given by

$f\left(\frac{\pi}{4}\right)=\tan \left(\frac{\pi}{4}\right)-2 \times \frac{\pi}{4}=1-\frac{\pi}{2}$

At $x=\frac{3 \pi}{4}:$

$f^{\prime \prime}\left(\frac{3 \pi}{4}\right)=2 \sec ^{2}\left(\frac{3 \pi}{4}\right) \tan \left(\frac{3 \pi}{4}\right)=-4<0$

So, $x=\frac{3 \pi}{4}$ is a point of local maximum.

The local maximum value is given by

$f\left(\frac{3 \pi}{4}\right)=\tan \left(\frac{3 \pi}{4}\right)-2 \times \frac{3 \pi}{4}=-1-\frac{3 \pi}{2}$