# What are the first and second derivatives of  g(x) =ln(sinx)-sin(lnx)?

Dec 12, 2015

$g ' \left(x\right) = \cot x - \frac{\cos \left(\ln x\right)}{x}$

$g ' ' \left(x\right) = {\csc}^{2} x + \frac{\sin \left(\ln x\right) + \cos \ln \left(x\right)}{x} ^ 2$

#### Explanation:

According to the chain rule:

$\frac{d}{\mathrm{dx}} \left[\ln \left(u\right)\right] = \frac{u '}{u}$

$\frac{d}{\mathrm{dx}} \left[\sin \left(u\right)\right] = u ' \cos \left(u\right)$

Thus,

$\frac{d}{\mathrm{dx}} \left[\ln \left(\sin x\right)\right] = \frac{\frac{d}{\mathrm{dx}} \left[\sin x\right]}{\sin} x = \cos \frac{x}{\sin} x = \cot x$

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

$g ' \left(x\right) = \cot x - \frac{\cos \left(\ln x\right)}{x}$

To find $g ' ' \left(x\right)$, find the derivative of each part.

$\frac{d}{\mathrm{dx}} \left[\cot x\right] = - {\csc}^{2} x$

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

Find each derivative.

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

$\frac{d}{\mathrm{dx}} \left[x\right] = 1$

Plug back in:

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

Thus,

$g ' ' \left(x\right) = {\csc}^{2} x + \frac{\sin \left(\ln x\right) + \cos \ln \left(x\right)}{x} ^ 2$