# What is the derivative of (cosx)^x?

May 29, 2018

We use a technique called logarithmic differentiation to differentiate this kind of function.

In short, we let $y = {\left(\cos \left(x\right)\right)}^{x}$,

Then,

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

$\ln \left(y\right) = x \ln \left(\cos \left(x\right)\right)$, by law of logarithms,

And now we differentiate.

$\frac{d}{\mathrm{dx}} \left(\ln \left(y\right)\right) = \frac{d}{\mathrm{dx}} \left(x \ln \left(\cos \left(x\right)\right)\right)$

$\frac{\mathrm{dy}}{\mathrm{dx}} \times \frac{d}{\mathrm{dy}} \left(\ln \left(y\right)\right) = \ln \left(\cos \left(x\right)\right) \times \frac{d}{\mathrm{dx}} \left(x\right) + x \frac{d}{\mathrm{dx}} \left(\ln \left(\cos \left(x\right)\right)\right)$

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

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

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

Alternatively, you can express ${\left(\cos \left(x\right)\right)}^{x}$ as ${e}^{x \ln \left(\cos \left(x\right)\right)}$, but that's basically the same thing.