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

Jan 9, 2016

We'll need chain rule for both terms.
- Chain rule: $\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{\mathrm{dy}}{\mathrm{du}} \frac{\mathrm{du}}{\mathrm{dx}}$

#### Explanation:

Also, let's just remember the rule to differentiate $\ln$ and $\arctan$:

• $\left(\ln \left(u\right)\right) ' = \frac{1}{u}$

• $\left(\arctan u\right) ' = \frac{u '}{1 + {u}^{2}}$

Therefore, using the chain rule for each term... In the first, we'll rename $\ln \left(u\right)$ with $u = \arctan x$ and in the second, let's just vary the letter and rename $\arctan \left(v\right)$, with $v = \ln x$.

$\frac{\mathrm{dg} \left(x\right)}{\mathrm{dx}} = \frac{1}{u} \left(\frac{1}{1 + {x}^{2}}\right) - \frac{v '}{1 + {v}^{2}} \left(\frac{1}{x}\right)$

Substituting $u$, $v$ and $v '$:

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

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

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

The second derivative will demand some product rule: $\left(a b\right) ' = a ' b + a b '$. Also, quotient rule, as we have two fractions: $\left(\frac{a}{b}\right) ' = \frac{a ' b - a b '}{b} ^ 2$

$\frac{\mathrm{dg} {\left(x\right)}^{2}}{{d}^{2} x} = \frac{0 - \left(2 x \arctan x + {x}^{2} \left(\frac{1}{1 + {x}^{2}}\right) + \frac{1}{1 + {x}^{2}}\right)}{{x}^{2} \arctan x + \arctan x} ^ 2 - \frac{0 - \left(1 + {\ln}^{2} x + \cancel{x} \frac{2 \ln x}{\cancel{x}}\right)}{x + x {\ln}^{2} x} ^ 2$

$\frac{\mathrm{dg} {\left(x\right)}^{2}}{{d}^{2} x} = - \frac{2 x \arctan x + \cancel{\frac{{x}^{2} + 1}{{x}^{2} + 1}}}{{x}^{2} \arctan x + \arctan x} ^ 2 + \frac{1 + {\ln}^{2} x + 2 \ln x}{x + x {\ln}^{2} x} ^ 2$

Simplifying and rearranging:

$\frac{\mathrm{dg} {\left(x\right)}^{2}}{{d}^{2} x} = {\left(1 + \ln x\right)}^{2} / \left({x}^{2} \left({\ln}^{2} x + 1\right)\right) - \frac{2 x \arctan x + 1}{\left({x}^{2} + 1\right) {\arctan}^{2} x}$