# How do you differentiate y = x^(cos x)?

Mar 8, 2018

The answer is $= \left(\frac{1}{x} \cos x - \ln x \sin x\right) {x}^{\cos x}$

#### Explanation:

The function is

$y = {x}^{\cos x}$

Taking logarithms on both sides

$\ln y = \ln \left({x}^{\cos x}\right) = \cos x \ln x$

Differentiating both sides

$\left(\ln y\right) ' = \left(\cos x \ln x\right) ' = \left(\cos x\right) ' \ln x + \cos x \left(\ln x\right) '$

$\frac{1}{y} \frac{\mathrm{dy}}{\mathrm{dx}} = - \sin x \cdot \ln x + \cos x \cdot \frac{1}{x}$

$\frac{\mathrm{dy}}{\mathrm{dx}} = \left(\frac{1}{x} \cos x - \ln x \sin x\right) y$

$= \left(\frac{1}{x} \cos x - \ln x \sin x\right) {x}^{\cos x}$

Mar 8, 2018

${x}^{\cos} x \left(\cos \frac{x}{x} - \sin x \ln x\right)$

#### Explanation:

We know that ${a}^{b} = {e}^{b \ln a}$. Here, we say that ${x}^{\cos} x = {e}^{\cos x \ln x}$.

According to the chain rule, $\frac{\mathrm{df}}{\mathrm{dx}} = \frac{\mathrm{df}}{\mathrm{du}} \cdot \frac{\mathrm{du}}{\mathrm{dx}}$, where $u$ is a function within $f$.

Here, $f = {e}^{u}$ where $u = \cos x \ln x$, so we have:

$\frac{d}{\mathrm{du}} {e}^{u} \cdot \frac{d}{\mathrm{dx}} \left(\cos x \ln x\right)$

${e}^{u} \frac{d}{\mathrm{dx}} \left(\cos x \ln x\right)$

According to the product rule, $\left(f \cdot g\right) ' = f ' g + f g '$. Here, $f = \cos x$ and $g = \ln x$, so we have:

$\frac{d}{\mathrm{dx}} \cos x \cdot \ln x + \frac{d}{\mathrm{dx}} \ln x \cdot \cos x$

$- \sin x \ln x + \frac{1}{x} \cos x$

$\cos \frac{x}{x} - \sin x \ln x$

So we have:

${e}^{u} \left(\cos \frac{x}{x} - \sin x \ln x\right)$, but as $u = \cos x \ln x$, we have:

${e}^{\cos x \ln x} \left(\cos \frac{x}{x} - \sin x \ln x\right)$, but remember that ${e}^{\cos x \ln x} = {x}^{\cos} x$, so we have:

${x}^{\cos} x \left(\cos \frac{x}{x} - \sin x \ln x\right)$