# Approximating $\log x$ with roots

The following is a surprisingly good (and simple!) approximation for $\log x+1$ in the region $(-1,1)$: $$\log (x+1) \approx \frac{x}{\sqrt{x+1}}$$

Three questions:

• Is there a good reason why this would be the case?
• How does one go about constructing the "next term"?
• Are the any papers on "generalized Pade approximations" that involve radicals?
• I suggest you write down the Taylor series of $\log(x+1)$ and $(x+1)^{-1/2}$ and see the few first terms agree. – LinAlgMan Dec 1 '14 at 10:42
• @LinAlgMan - That is true, but it is not the reason. This approximation works much better than the Taylor series, even to high orders, probably because it accounts for the pole. – nbubis Dec 1 '14 at 10:43
• May I ask how you got this interesting approximation ? – Claude Leibovici Dec 1 '14 at 10:49
• @ClaudeLeibovici - the function came up in a physics calculation, and upon plotting, I noticed it looked oddly familiar. – nbubis Dec 1 '14 at 10:51
• @Lucian - I'm not sure I see the connection. – nbubis Dec 8 '14 at 20:12

Let's rewrite both sides in terms of $y = x + 1$: we get

$$\log y \approx \sqrt{y} - \frac{1}{\sqrt{y}}$$

on, let's say, the interval $\left( \frac{1}{2}, 2 \right)$ (I hesitate to discuss the entire interval $(0, 2)$; it seems to me that the approximation is not all that good near $0$). The RHS should look sort of familiar: let's perform a second substitution $y = e^{2z}$ to get

$$2z \approx e^z - e^{-z} = 2 \sinh z$$

on the interval $\left( - \varepsilon, \varepsilon \right)$ where $\varepsilon = \frac{\log 2}{2} \approx 0.346 \dots$. Of course now we see that the LHS is just the first term in the Taylor series of the RHS, and on a smaller interval than originally. Furthermore, the Taylor coefficients of $2 \sinh z$, unlike the Taylor coefficients of our original functions, decrease quite rapidly. The next term is $\frac{z^3}{3}$, which on this interval is at most

$$\frac{\varepsilon^3}{3} \approx 0.0138 \dots$$

and this is more or less the size of the error in the approximation between $\log 2$ and $\frac{1}{\sqrt{2}}$ obtained by setting $y = 2$, or equivalently $x = 1$.

With the further substitution $t = \sinh z$, the RHS is just the first term in the Taylor series of the LHS. To get the "next term" we could look at the rest of the Taylor series of $\sinh^{-1} t$. The next term is $- \frac{t^3}{6}$, which gives

$$z \approx \frac{e^z - e^{-z}}{2} - \frac{(e^z - e^{-z})^3}{48}$$

or

$$\log y \approx \left( \sqrt{y} - \frac{1}{\sqrt{y}} \right) - \frac{1}{24} \left( \sqrt{y} - \frac{1}{\sqrt{y}} \right)^3.$$

I don't know if this is useful for anything. The series to all orders just expresses the identity

$$\log y = 2 \sinh^{-1} \frac{\left( \sqrt{y} - \frac{1}{\sqrt{y}} \right)}{2}.$$

• Very nicely done!! As you noticed though, near $y\to 0$, higher orders seem to actually ruin the approximation, which I find curious. – nbubis Dec 1 '14 at 11:26
• @nbubis: well, the radius of convergence of the Taylor series of $\sinh^{-1} t$ is $1$, and as $y \to 0$, $\sqrt{y} - \frac{1}{\sqrt{y}}$ gets arbitrarily large (in absolute value)... – Qiaochu Yuan Dec 1 '14 at 11:59

The simplest Pade approximant we could build seems to be $$\log(1+x)\approx\frac{x}{1+\frac{x}{2}}$$ and we can notice the similarity of denominators close to $x=0$.

However, the approximation given in the post seems to be significantly better for $x<\frac 12$.

• Indeed. It is probably better because it has a pole in the right place. – nbubis Dec 1 '14 at 11:00

I am being rather late, yet still there is some interesting information I can add.

The Padet approximant is of the form $\log(1+x)\approx \frac{x}{1+x/2}$ as noted by other posters. This partially explains why $\frac{x}{\sqrt{1+x}}$ is a good approximation, what it does not explain is why the square-root approximation is better than a supposedly "great" Pade approximation. @nbubis had an idea that it works better because it has pole in the correct spot, but it seems that it is actually a red herring.

Let's take a look on more general Pade $(1,n)$ approximation, it equals $\log(1+x)\approx\frac{x}{1+x/2-x^2/12+x^4/24+...}$.

Now the reason $\frac{x}{\sqrt{1+x}}$ approximation performs better can be explained by $\sqrt{1+x} \approx 1+x/2 -x^2/8$ and noting that $1+x/2-x^2/8$ is closer to the "true value" of the denominator than the first Pade approximant $1+x/2$.

To see that it is indeed the case consider the approximation

$\log(1+x)=\frac{x}{(1+5x/6)^{3/5}}$.

Now, as you can quickly check, $(1+5x/6)^{3/5}$ has the Taylor expansion $\approx 1+x/2 -x^2/12$ which aggrees with first 3 terms of $(1,n)$ Pade approximant. Now if you plot it it will turn out that it is even better than originally suggested $\frac{x}{\sqrt{1+x}}$ despite having pole in the wrong place.

Regarding method by @QiaochuYuan, you can perform the same "trick" to get better approximations which will be performing better in the neighbourhood of $x=0$ but worse when $x$ is large, for example

$\log (1+x) \approx \frac{x}{(1+5x/6)^{3/5}} + \frac{x^4}{108 (1+5x/6)^{12/5}}$

But in disguise what you are actually making is finding better approximations to some Pade approximant.

Some of the other approximations you can find in the same way are

$\log(1+x)\approx \frac{x}{\sqrt{1+x+x^2/12}}$ and $\log(1+x)\approx \frac{x}{(1+3x/2+x^2/2)^{1/3}}$ which are good simply beause they coincide with Pade approximant up to the terms of high order. I guess the first among those two is another reason why $\frac{x}{\sqrt{1+x}}$ worked so well.

Short version: It's actually a coincidence, $\sqrt{1+x}$ happen to have Taylor expansion $\sqrt{1+x}\approx 1+x/2-x^2/8$ which coincides with expansion of $x/\log(1+x)\approx 1+x/2 -x^2/12$ up to 2 terms and the third term is not that different to mess up the approximation.

• I like this! That makes a lot of sense. – nbubis Dec 1 '17 at 6:00

A different approach.

The function $f(x)=x-\log(1+x)\sqrt{1+x}$ is continuous and increasing on $[-1,1]$ (I have not proved it, but a graph of $f'$ is sufficiently convincing.) For any $a\in(0,1)$ $$f(-a)\le f(x)\le f(1)=0.0197419,\quad-a\le x\le1.$$ Take for instance $a=0.8$ we obtain $$-\frac{0.0802375}{\sqrt{1+x}}\le\frac{x}{\sqrt{1+x}}-\log(1+x)\le\frac{0.0197419}{\sqrt{1+x}},\quad -.8\le x\le1.$$

This shows that $\log(1+x)\sqrt{1+x}$ is a good approximation of $x$. $$f(x)=-\frac{x^3}{24}+\dots$$ is an alternate series. This explains the vey good approximation for $x>0$, and the not so good for $x<0$.

• I'm not sure how that helps - this is just an evaluation of the approximation. – nbubis Dec 1 '14 at 11:56

One reason may be that their Taylor series around $x=0$ start the same: $$\log (x+1) \approx x-x^2/2+x^3/3+\cdots$$ $$\frac{x}{\sqrt{x+1}} \approx x-x^2/2+3x^3/8+\cdots$$ So they agree to order 2 for $|x|<1$. They almost agree to order 3 because $1/3 \approx 3/8$ roughly.

However, this is an a posteriori reason. I don't know why this approximation should be good a priori.

• That doesn't necessarily tell you much about how good of an approximation to expect on an interval as large as $(-1, 1)$. – Qiaochu Yuan Dec 1 '14 at 10:46
• This was what I was just typing ! The question is interesting. – Claude Leibovici Dec 1 '14 at 10:46
• For example, when $x = 1$ the LHS is $\log 2 \approx 0.693 \dots$ while the RHS is $\frac{1}{\sqrt{2}} \approx 0.707 \dots$. These agree substantially better that can be accounted for by the first two terms of the Taylor series, which give $0.5$. – Qiaochu Yuan Dec 1 '14 at 10:48
• This is clearly not the reason. The approximation does much better than the Taylor series way past second order.(probably because it has a pole) – nbubis Dec 1 '14 at 10:49

$$\log(x+1)=\lim_{n\to\infty}n(\sqrt[n]{x+1}-1).$$

In the case $n=2$, $$2(\sqrt{x+1}-1)=2\frac{x}{\sqrt{x+1}+1}\approx\frac x{\sqrt{x+1}}$$ for small $x$.

The approximation works better as it has a vertical asymptote at $x=-1$.

• Nice :) Though the approximation ends up being better than the derivation... – nbubis Dec 1 '14 at 11:14
• This still doesn't explain most of the agreement. Again taking $x = 1$ we have $2 (\sqrt{2} - 1) \approx 0.828 \dots$, which is maybe 15% bigger than either the LHS or the RHS, which agree to maybe within 2%. – Qiaochu Yuan Dec 1 '14 at 11:15
• Anyone who's still trying to answer the question should actually plot the functions (I did it in WolframAlpha) to see how close the agreement actually is. I think the pole is a red herring: the agreement is really not very good close to the pole. – Qiaochu Yuan Dec 1 '14 at 11:17
• I don't thank the downvoters. @QiaochuYuan: the question is not a contest to the best approximation. It is about why $\log (x+1) \approx \dfrac{x}{\sqrt{x+1}}$. – Yves Daoust Oct 31 '17 at 7:45