# Differentiate the following functions with respect to x :

Question:

Differentiate the following functions with respect to $x$ :

$\cos (\log x)^{2}$

Solution:

Let $y=\cos (\log x)^{2}$

On differentiating y with respect to $x$, we get

$\frac{d y}{d x}=\frac{d}{d x}\left[\cos (\log x)^{2}\right]$

We have $\frac{d}{d x}(\cos x)=-\sin x$

$\Rightarrow \frac{d y}{d x}=-\sin (\log x)^{2} \frac{d}{d x}\left[(\log x)^{2}\right]$ [using chain rule]

We know $\frac{d}{d x}\left(x^{n}\right)=n x^{n-1}$

$\Rightarrow \frac{d y}{d x}=-\sin (\log x)^{2}\left[2(\log x)^{2-1} \frac{d}{d x}(\log x)\right]$ [chain rule]

$\Rightarrow \frac{d y}{d x}=-\sin (\log x)^{2}\left[2 \log x \frac{d}{d x}(\log x)\right]$

$\Rightarrow \frac{d y}{d x}=-\sin (\log x)^{2}\left[2 \log x \frac{d}{d x}(\log x)\right]$

However, $\frac{\mathrm{d}}{\mathrm{dx}}(\log \mathrm{x})=\frac{1}{\mathrm{x}}$

$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=-2 \log \mathrm{x} \sin (\log \mathrm{x})^{2} \times \frac{1}{\mathrm{x}}$

$\therefore \frac{\mathrm{dy}}{\mathrm{dx}}=-\frac{2}{\mathrm{x}} \log \mathrm{x} \sin (\log \mathrm{x})^{2}$

Thus, $\frac{d}{d x}\left[\cos (\log x)^{2}\right]=-\frac{2}{x} \log x \sin (\log x)^{2}$