# How to bound the error of an approximation for ln|k+x|?

$$\forall x\in\left(-1,1\right):\space\ln\left|1+x\right|=\int\frac{1}{1+x}\space dx=\int\sum_{n=0}^{\infty}\left(-x\right)^n\space dx=x-\frac{x^2}{2}+\frac{x^3}{3}\dots=\sum_{n=1}^{\infty}\left(-1\right)^{n-1}\cdot\frac{x^n}{n}$$

This is well known. I have two questions here. Firstly, I noticed that this is a convergent alternating series, and so the error of an approximation of degree $$n$$ is dominated by term $$n+1$$: $$\xi_n(x)=\left|\frac{x^{n+1}}{n+1}\right|$$ (I think!). However, when plotting this on Desmos, with $$x\in\left(-1,1\right)$$ of course, I noticed that the error predicted by this remainder function was not always an upper bound of the actual difference between the polynomial and the natural logarithm; the real error was greater than my "upper bound" sometimes, especially for low-degree approximations - the approximation at degree $$1$$ is visibly terrible, since it's a straight line, and the error is far greater than $$\left|\frac{x^2}{2}\right|$$ for $$x$$ near $$-1$$.

Secondly, I wondered if this was a useful approximation technique for $$\ln\left|k+x\right|,\space\forall k>0$$ - or maybe even $$\forall k\in\mathbb{R}$$? I'm not sure. Anyway, I attempted this in much the same way: $$\forall x\in\left(-\left|k\right|,\left|k\right|\right):\space\ln\left|k+x\right|=\int\frac{1}{k+x}\space dx=\int\frac{\frac{1}{k}}{1+\frac{x}{k}}\space dx=\int\sum_{n=0}^{\infty}\frac{1}{k}\cdot\left(-\frac{x}{k}\right)^n\space dx$$ $$\int\frac{1}{k}-\frac{x}{k^2}+\frac{x^2}{k^3}\dots\space dx=\frac{x}{k}-\frac{x^2}{2k^2}+\frac{x^3}{3k^3}\dots=\sum_{n=1}^{\infty}\left(-1\right)^{n-1}\cdot\frac{x^n}{n\cdot k^n}$$

The interval of convergence is $$\left(-\left|k\right|,\left|k\right|\right)$$ since $$\left|-\frac{x}{k}\right|<1$$, I think. Likewise, an error bound on this approximation fails miserably... and after plotting this on Desmos, I note that my approximation is terrible! It doesn't work at all :)

EDIT: This is despite my thought that $$\forall x,k>0,x

Many thanks if anyone can clear up how to properly bound this!

• Can you write down the bounds of your intervals? You may discover errors doing so. – mathcounterexamples.net Apr 28 at 6:40
• @mathcounterexamples.net Are they not $x \in (0,|k|)$? – FShrike Apr 28 at 7:02
• May I ask you to write the bounds yourself and compute properly the integral... rather than answering my question with another question? You'll discover your error by yourself then! – mathcounterexamples.net Apr 28 at 7:55
• @mathcounterexamples.net after some empirical observations on Desmos I have deduced that my infinite sum is exactly equal not to $\ln\left|k+x\right|$ but instead to $\ln\left|\frac{k+x}{k}\right|$! – FShrike Apr 28 at 21:04
• I believe that this is due to the algebraic rearrangement of $\frac{1}{k+x}$ to $\frac{1/k}{1+x/k}$ by multiplying both numerator and denominator by $\frac{1}{k}$, since $\frac{1}{k}$ is the difference between the failed approximation and the accurate one! However, a slight niggling doubt remains, since the two multiplications cancel, so the algebraic effect is nil - no? – FShrike Apr 28 at 21:11

First question

For $$g(x)=x \in (-1,0)$$, $$\sum_{n=1}^{\infty}\left(-1\right)^{n-1}\cdot\frac{x^n}{n}$$ is not an alternating series! $$x^n$$ itself has alternating signs and $$g(x)$$ tends to approach the harmonic series as $$x \to 1$$ which is diverging. This is coherent with what you found in Desmos.

Second question

If your goal is to evaluate $$\ln(k+x)$$, I would better use $$\ln \frac{1}{x} = - \ln x$$ to only deal with $$x \gt 1$$ and then $$\ln(a+x) = \ln a + \ln \left(1 + \frac{x}{a}\right).$$

• Beat me to it. Excellent answer +1 – Alann Rosas Apr 27 at 19:15
• The first response makes total sense and yes, I now realise that the series could never approximate the asymptote at $x=-1$. With regards to the second response, I do not understand the derivation there; shouldn't the second term be $\ln\left(1+\frac{x}{a}\right)$? Plus, my geometric series attempt for $\ln\left|k+x\right|$ was clearly wrong - but why? Do I just need a ridiculous number of terms to make it work, but if so, then why does the alternating bound fail even for positive $k, x$? – FShrike Apr 27 at 19:45
• Thanks for spotting the typo. And yes, the approximation is very poor especially when $x$ is close to $k$ and even worse when close to $-k$. – mathcounterexamples.net Apr 27 at 19:53
• @mathcounterexamples.net - poor due to an error in my workings, an error in my estimation of the error bound (because the alternating bound for my expansion actually goes to $\frac{1}{n}$ as $x\to k$) or some other reason? – FShrike Apr 27 at 20:00
• I mean to say: my bound predicts a very good accuracy for high $n$, so why is the accuracy atrocious? – FShrike Apr 27 at 20:00