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

Oct 26, 2016

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

#### Explanation:

Take logs of both sides:

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

The LHS can be differentiated simplicity, and the RHS can be differentiated using product rule; $\frac{d}{\mathrm{dx}} \left(u v\right) = u \frac{\mathrm{dv}}{\mathrm{dx}} + v \frac{\mathrm{du}}{\mathrm{dx}}$

So, we have:
$\frac{1}{y} \frac{\mathrm{dy}}{\mathrm{dx}} = \cos \left(3 x\right) \frac{d}{\mathrm{dx}} \ln x + \ln x \frac{d}{\mathrm{dx}} \cos \left(3 x\right)$
$\therefore \frac{1}{y} \frac{\mathrm{dy}}{\mathrm{dx}} = \cos \left(3 x\right) \frac{1}{x} + \left(\ln x\right) \left(- \sin \left(3 x\right)\right) \left(3\right)$
$\therefore \frac{1}{y} \frac{\mathrm{dy}}{\mathrm{dx}} = \cos \frac{3 x}{x} - 3 \sin \left(3 x\right) \ln x$
$\therefore \frac{\mathrm{dy}}{\mathrm{dx}} = \left(\cos \frac{3 x}{x} - 3 \sin \left(3 x\right) \ln x\right) y$
$\therefore \frac{\mathrm{dy}}{\mathrm{dx}} = \left(\cos \frac{3 x}{x} - 3 \sin \left(3 x\right) \ln x\right) {x}^{\cos} \left(3 x\right)$