Find the derivative of the following functions (it is to be understood that $a, b, c, d, p, q, r$ and $s$ are fixed non-zero constants and $m$ and $n$ are integers): $(x+\cos x)(x-\tan x)$
Let $f(x)=(x+\cos x)(x-\tan x)$
By product rule,
$f^{\prime}(x)=(x+\cos x) \frac{d}{d x}(x-\tan x)+(x-\tan x) \frac{d}{d x}(x+\cos x)$
$=(x+\cos x)\left[\frac{d}{d x}(x)-\frac{d}{d x}(\tan x)\right]+(x-\tan x)(1-\sin x)$
$=(x+\cos x)\left[1-\frac{d}{d x} \tan x\right]+(x-\tan x)(1-\sin x)$ (i)
Let $g(x)=\tan x$. Accordingly, $g(x+h)=\tan (x+h)$
By first principle,
$g^{\prime}(x)=\lim _{h \rightarrow 0} \frac{g(x+h)-g(x)}{h}$
$=\lim _{h \rightarrow 0}\left(\frac{\tan (x+h)-\tan x}{h}\right)$
$=\lim _{h \rightarrow 0} \frac{1}{h}\left[\frac{\sin (x+h)}{\cos (x+h)}-\frac{\sin x}{\cos x}\right]$
$=\lim _{h \rightarrow 0} \frac{1}{h}\left[\frac{\sin (x+h) \cos x-\sin x \cos (x+h)}{\cos (x+h) \cos x}\right]$
$=\frac{1}{\cos x} \cdot \lim _{h \rightarrow 0} \frac{1}{h}\left[\frac{\sin (x+h-x)}{\cos (x+h)}\right]$
$=\frac{1}{\cos x} \cdot \lim _{h \rightarrow 0} \frac{1}{h}\left[\frac{\sin h}{\cos (x+h)}\right]$
$=\frac{1}{\cos x} \cdot\left(\lim _{h \rightarrow 0} \frac{\sin h}{h}\right) \cdot\left(\lim _{h \rightarrow 0} \frac{1}{\cos (x+h)}\right)$
$=\frac{1}{\cos x} \cdot 1 \cdot \frac{1}{\cos (x+0)}$
$=\frac{1}{\cos ^{2} x}$
$=\sec ^{2} x$ (ii)
Therefore, from (i) and (ii), we obtain
$f^{\prime}(x)=(x+\cos x)\left(1-\sec ^{2} x\right)+(x-\tan x)(1-\sin x)$
$=(x+\cos x)\left(-\tan ^{2} x\right)+(x-\tan x)(1-\sin x)$
$=-\tan ^{2} x(x+\cos x)+(x-\tan x)(1-\sin x)$