# How do you find the derivative of y=x^cos(x)?

Jul 30, 2014

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

Solution :

$y = f {\left(x\right)}^{g} \left(x\right)$, this type of questions usually solve by following two methods,

Explanation (I)

taking $\ln$ of both sides, we get,

$\ln \left(y\right) = g \left(x\right) \cdot \ln \left(f \left(x\right)\right)$

Now differentiating both sides with respect to $x$ using Product Rule

$\frac{1}{y} \cdot y ' = g \left(x\right) \cdot \frac{f ' \left(x\right)}{f} \left(x\right) + \ln \left(f \left(x\right)\right) \cdot g ' \left(x\right)$,

$y ' = y \left(g \left(x\right) \cdot \frac{f ' \left(x\right)}{f} \left(x\right) + \ln \left(f \left(x\right)\right) \cdot g ' \left(x\right)\right)$,

$y ' = f {\left(x\right)}^{g} \left(x\right) \left(g \left(x\right) \cdot \frac{f ' \left(x\right)}{f} \left(x\right) + \ln \left(f \left(x\right)\right) \cdot g ' \left(x\right)\right)$,

Similarly following for $y = {x}^{\cos} \left(x\right)$, we get

$\ln y = \cos \left(x\right) \cdot \ln \left(x\right)$

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

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

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

Explanation (II)

$y = f {\left(x\right)}^{g} \left(x\right)$

first do the differentiation keeping $g \left(x\right)$ as constant and f(x) as it is (i.e. ${x}^{n}$), then $f \left(x\right)$ as constant and g(x) as it is (i.e. ${a}^{x}$), this is quick way to do these type of questions,

like,

$y ' = g \left(x\right) {\left(f \left(x\right)\right)}^{g \left(x\right) - 1} \cdot f ' \left(x\right) + f {\left(x\right)}^{g} \left(x\right) \cdot \ln \left(f \left(x\right)\right) \cdot g ' \left(x\right)$

following in the same way,

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

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

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