# Roots of a function with a logarithm / Graph of a function

So I'm trying to draw the graph (manually) of a function:

$$f(x)=x-2\ln{(x^2+1)}$$

Finding the first/second derivatives is fairly easy and so is proving that there are no asymptotes, but for the life of me I can't find the roots of the function, AKA where it intersects with $Ox$. Without them I don't know it's behavior when $x>0$, apart from the fact that it reaches a local maximum at $x=2-\sqrt{3}$ and a minimum at $x=2+\sqrt{3}$, but those could be reached while $y=f(x)>0$ when $x>0$, which is clearly not the case if you use a plot graph to check. WolframAlpha doesn't give me any good roots, no steps either. Any ideas?

## 2 Answers

Considering that you look for the zero's of $$f(x)=x-2\ln{(x^2+1)}$$ you could notice that there is a first trivial solution $x=0$.

Using $$f'(x)=1-\frac{4 x}{x^2+1}\qquad \text{and} \qquad f''(x)=\frac{4 \left(x^2-1\right)}{\left(x^2+1\right)^2}$$ you noticed that the first deivative cancels at two points corresponding to $x_\pm=(2\pm \sqrt 3)$; by the second derivative test, you showed that the $x_-$ corresponds to a local maximum and that the $x_+$ corresponds to a local minimum. This is very fine.

Now, compute
$$f(x_-)=2-\sqrt{3}-2 \log \left(4 \left(2-\sqrt{3}\right)\right)\approx 0.129276 >0$$ $$f(x_+)=2+\sqrt{3}-2 \log \left(4 \left(2+\sqrt{3}\right)\right)\approx -1.67445 <0$$ So,we have one root $x_- <x_1<x_+$ and another one $x_2 > x_+$.

Since we need a numerical method, we need to get some reasonable starting guesses. We can generate these using Taylor series around the points $x_\pm$ where the derivative cancels, that is say writing $$f(x)=f(x_\pm)+\frac 12 f''(x_\pm) (x-x_\pm))^2+ O\left((x-x_\pm)^3\right)$$ This means that,locally, we approximate the function by parabolas.

Ignoring the higher order terms, the solution is then just given by $$x_{1,2}^{est}=x_\pm+\sqrt{- \frac {2f(x_\pm)}{f''(x_\pm)}}$$ and, computing, we get $$x_1^{est}\approx 0.550786 \qquad \text{and} \qquad x_2^{est}\approx 7.53097$$ Now, we are ready for a use of Newton method which, starting from a guess $x_0$, will update it according to $$x_{n+1}=x_n-\frac {f(x_n)}{f'(x_n)}$$ For the first root, the iterates will be $$\left( \begin{array}{cc} n & x_n \\ 0 & 0.5507855949 \\ 1 & 0.5810415348 \\ 2 & 0.5800568654 \\ 3 & 0.5800558890 \end{array} \right)$$ For the second root, the iterates will be $$\left( \begin{array}{cc} n & x_n \\ 0 & 7.530969763 \\ 1 & 8.744371371 \\ 2 & 8.662791496 \\ 3 & 8.662482124 \\ 4 & 8.662482119 \end{array} \right)$$ These are the solutions for ten significant figures.

You can't find these roots analitically because $e^x = -2(x^2+1)$ is transcedental. However, you know the only extrema of $f$ are a local maximum $x_1 >0$, (then) a local minimum $x_2<0$, and that $\lim_{x\to\pm\infty} f(x) = \pm\infty$. The sign changes, the intermediate value theorem and the fact that you found all local extrema of $f$ guarantee that there are only three roots. It reminds me of cubic polynomials which have this exact shape (up to changes in $f'(x)$).

So even if you can't find the roots, you know how many there are and an interval containing them (e.g. there is a root in $(-\infty,x_1)$. What can be furthemore done with nothing but a calculator is approximating the position of these roots, by the bisection method, for example.