Differentiate the following functions with respect to $x$ :
$\frac{x^{2}+2}{\sqrt{\cos x}}$
Let $y=\frac{x^{2}+2}{\sqrt{\cos x}}$
On differentiating y with respect to $x$, we get
$\frac{\mathrm{dy}}{\mathrm{dx}}=\frac{\mathrm{d}}{\mathrm{dx}}\left(\frac{\mathrm{x}^{2}+2}{\sqrt{\cos \mathrm{x}}}\right)$
Recall that $\left(\frac{\mathrm{u}}{\mathrm{v}}\right)^{\prime}=\frac{\mathrm{vu}^{\prime}-\mathrm{uv}^{\prime}}{\mathrm{v}^{2}}$ (quotient rule)
$\Rightarrow \frac{d y}{d x}=\frac{\sqrt{\cos x} \frac{d}{d x}\left(x^{2}+2\right)-\left(x^{2}+2\right) \frac{d}{d x}(\sqrt{\cos x})}{(\sqrt{\cos x})^{2}}$
$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=\frac{\sqrt{\cos \mathrm{x}}\left[\frac{\mathrm{d}}{\mathrm{dx}}\left(\mathrm{x}^{2}\right)+\frac{\mathrm{d}}{\mathrm{dx}}(2)\right]-\left(\mathrm{x}^{2}+2\right) \frac{\mathrm{d}}{\mathrm{dx}}\left[(\cos \mathrm{x})^{\frac{1}{2}}\right]}{\cos \mathrm{x}}$
We know $\frac{\mathrm{d}}{\mathrm{dx}}\left(\mathrm{x}^{\mathrm{n}}\right)=\mathrm{n} \mathrm{x}^{\mathrm{n}-1}$ and derivative of a constant is 0 .
$\Rightarrow \frac{d y}{d x}=\frac{\sqrt{\cos x}[2 x+0]-\left(x^{2}+2\right)\left[\frac{1}{2}(\cos x)^{\frac{1}{2}-1} \frac{d}{d x}(\cos x)\right] \text { [chain rule] }}{\cos x}$
$\Rightarrow \frac{d y}{d x}=\frac{2 x \sqrt{\cos x}-\frac{\left(x^{2}+2\right)}{2}(\cos x)^{-\frac{1}{2}}\left[\frac{d}{d x}(\cos x)\right]}{\cos x}$
$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=\frac{2 \mathrm{x} \sqrt{\cos \mathrm{x}}-\frac{\left(\mathrm{x}^{2}+2\right)}{2}(\cos \mathrm{x})^{-\frac{1}{2}}\left[\frac{\mathrm{d}}{\mathrm{dx}}(\cos \mathrm{x})\right]}{\cos \mathrm{x}}$
We know $\frac{\mathrm{d}}{\mathrm{dx}}(\cos \mathrm{x})=-\sin \mathrm{x}$
$\Rightarrow \frac{d y}{d x}=\frac{2 x \sqrt{\cos x}-\frac{\left(x^{2}+2\right)}{2}(\cos x)^{-\frac{1}{2}}(-\sin x)}{\cos x}$
$\Rightarrow \frac{d y}{d x}=\frac{2 x \sqrt{\cos x}+\frac{\left(x^{2}+2\right) \sin x}{2 \sqrt{\cos x}}}{\cos x}$
$\Rightarrow \frac{d y}{d x}=\frac{4 x(\sqrt{\cos x})^{2}+\left(x^{2}+2\right) \sin x}{2 \sqrt{\cos x} \cos x}$
$\Rightarrow \frac{d y}{d x}=\frac{4 x \cos x+\left(x^{2}+2\right) \sin x}{2 \sqrt{\cos x} \cos x}$
$\Rightarrow \frac{d y}{d x}=\frac{4 x \cos x}{2 \sqrt{\cos x} \cos x}+\frac{\left(x^{2}+2\right) \sin x}{2 \sqrt{\cos x} \cos x}$
$\therefore \frac{d y}{d x}=\frac{2 x}{\sqrt{\cos x}}+\frac{\left(x^{2}+2\right) \sin x}{2(\cos x)^{\frac{3}{2}}}$
Thus, $\frac{d}{d x}\left(\frac{x^{2}+2}{\sqrt{\cos x}}\right)=\frac{2 x}{\sqrt{\cos x}}+\frac{\left(x^{2}+2\right) \sin x}{2(\cos x)^{\frac{3}{2}}}$