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

Nov 30, 2015

$\frac{d}{\mathrm{dx}} g \left(x\right) = \frac{2 \left(\ln \left(x\right) - 1\right)}{x}$

${d}^{2} / {\mathrm{dx}}^{2} g \left(x\right) = \frac{4 - 2 \ln \left(x\right)}{x} ^ 2$

#### Explanation:

We will use

• The chain rule:
d/dxf(g(x)) = f'(g(x)g'(x)

• The quotient rule:
$\frac{d}{\mathrm{dx}} f \frac{x}{g} \left(x\right) = \frac{f ' \left(x\right) g \left(x\right) - f \left(x\right) g ' \left(x\right)}{g} ^ 2 \left(x\right)$

• $\frac{d}{\mathrm{dx}} \left(f \left(x\right) \pm g \left(x\right)\right) = f ' \left(x\right) \pm g ' \left(x\right)$

• $\frac{d}{\mathrm{dx}} \ln \left(x\right) = \frac{1}{x}$

• $\frac{d}{\mathrm{dx}} {x}^{n} = n {x}^{n - 1}$

$g ' \left(x\right) = \frac{d}{\mathrm{dx}} \left({\ln}^{2} \left(x\right) - \ln \left({x}^{2}\right)\right) = \frac{d}{\mathrm{dx}} \left({\ln}^{2} \left(x\right)\right) - \frac{d}{\mathrm{dx}} \left(\ln \left({x}^{2}\right)\right)$

$= 2 \ln \left(x\right) \left(\frac{d}{\mathrm{dx}} \ln \left(x\right)\right) - \frac{1}{{x}^{2}} \left(\frac{d}{\mathrm{dx}} {x}^{2}\right)$ (by the chain rule)

$= 2 \ln \left(x\right) \left(\frac{1}{x}\right) - \frac{1}{x} ^ 2 \left(2 x\right)$

$= \frac{2 \ln \left(x\right)}{x} - \frac{2}{x}$

$= \frac{2 \left(\ln \left(x\right) - 1\right)}{x}$

To find the second derivative, we take the derivative of $g ' \left(x\right)$ using the quotient rule.

$g ' ' \left(x\right) = \frac{d}{\mathrm{dx}} \frac{2 \left(\ln \left(x\right) - 1\right)}{x}$

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

$= \frac{\left(2 \left(\frac{1}{x}\right)\right) x - 2 \left(\ln \left(x\right) - 1\right) \left(1\right)}{x} ^ 2$

$= \frac{2 - 2 \ln \left(x\right) + 2}{x} ^ 2$

$= \frac{4 - 2 \ln \left(x\right)}{x} ^ 2$