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

May 28, 2017

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

#### Explanation:

Let $f \left(x\right) = {\left(\cos x\right)}^{x}$

$\ln f \left(x\right) = x \ln \cos x$

$\frac{f ' \left(x\right)}{f \left(x\right)} = \ln \cos x - \frac{x}{\sin} x$

$f ' \left(x\right) = f \left(x\right) \left(\ln \cos x - \frac{x}{\sin} x\right)$

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

May 28, 2017

$\frac{d}{\mathrm{dx}} {\cos}^{x} \left(x\right) = {\cos}^{x} \left(x\right) \left(- x \tan \left(x\right) + \ln \left(\cos \left(x\right)\right)\right)$

#### Explanation:

Step 1. Express $\cos {\left(x\right)}^{x}$ as a power of $e$.

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

Step 2. Use the chain rule with $u = x \ln \left(\cos \left(x\right)\right)$ and $\frac{d}{\mathrm{du}} \left({e}^{u}\right) = {e}^{u}$

Chain Rule: $\frac{d}{\mathrm{dx}} \left({e}^{x \ln \left(\cos \left(x\right)\right)}\right) = \frac{{\mathrm{de}}^{u}}{\mathrm{du}} \frac{\mathrm{du}}{\mathrm{dx}}$

$\frac{{\mathrm{de}}^{u}}{\mathrm{du}} = {e}^{u}$

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

Using the Product Rule

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

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

$\frac{\mathrm{du}}{\mathrm{dx}} = - x \tan \left(x\right) + \ln \left(\cos \left(x\right)\right)$

Plugging it back in to the Chain Rule

$\textcolor{b l u e}{\frac{{\mathrm{de}}^{u}}{\mathrm{du}}} \textcolor{red}{\frac{\mathrm{du}}{\mathrm{dx}}} = \textcolor{b l u e}{{e}^{x \ln \left(\cos \left(x\right)\right)}} \textcolor{red}{\left(- x \tan \left(x\right) + \ln \left(\cos \left(x\right)\right)\right)}$

Simplifying a bit gives

$\frac{{\mathrm{de}}^{u}}{\mathrm{du}} \frac{\mathrm{du}}{\mathrm{dx}} = {\cos}^{x} \left(x\right) \left(- x \tan \left(x\right) + \ln \left(\cos \left(x\right)\right)\right)$