Summation problem: $f(x)=1+\sum_{n=1}^{\infty}\frac{x^n}{n}$ I want to evaluate this summation:

$$S=1+x+\frac{x^2}{2}+\frac{x^3}{3}+\frac{x^4}{4}+...+...$$
where, $|x|<1$

Here it is my approach
$$S=1+\sum_{n=1}^{\infty}\frac{x^n}{n}=f(x)$$
$$f'(x)=1+x+x^2+x^3+...+...=\frac{1}{1-x}$$
$$f(x)=\int f'(x)dx=\int \frac{1}{1-x} dx=-\ln(1-x)+C$$
$$f(0)=1 \Longrightarrow  C=1 $$
$$S=1-\ln(1-x)$$
And here is my problem:
I calculated this sum for only $|x|<1$.
Then, I checked in Wolfram Alpha and I saw that, this sum $f(x)$ converges for $x=-1$. But, this creating a contradiction with my solution. Because, the series $$f'(x)=1+x+x^2+x^3+...+...=\frac{1}{1-x}$$ for $x=-1$ doesn't converge, diverges. Therefore, there is a problem in my solution. But I can not find the source of the problem.

How can I prove the formula $f(x)=1-\ln(1-x)$ is also correct at the point $x=-1$ ?

Thank you very much.
 A: I don't know how familiar your are with power series, but this has to do with the notion of radius of convergence.
$\sum \left(\frac{x^n}{n}\right)_{n\in\mathbb{N^*}}$ is a power series with a radius of convergence $R=1$ (which can be proved by the ratio test), so indeed, it does converge for $|x|<1$, and does diverge for $|x|>1$.
As for $x=1$, the only case with $x=-1$ were we can't conclude right away, it could naively be anything, but it happens to converge.
The power series $\sum \left(x^n\right)_{n\in\mathbb{N^*}}$ is indeed the derivative of the previous one : we know it has the same radius of convergence, so for $x=1$, here again it could be anything ; and it happens to diverge.
The convergence circle is the only place were the convergence of a power series and its derivatives aren't always equivalent : it could be anything, and you can't deduce the convergence of the derivative from the convergence of the power series there.
As to show that the power series and $f(x)=1-\ln(1-x)$ are equal also for $x=-1$ (that is to say, to prove that $f(-1)$ is the sum of the series) :
$\cdot$ The power series and f both exist for $x$ in $[-1,1)$ (for the power series, you can prove it with the ratio test)
$\cdot$ They are both continuous on $[-1,1)$ : it is obvious for $f$, and for the power series, we know that the sum of the power series is continious strictly inside the convergence disk $(-1,1)$.
We extend the continuity to -1 by the uniform convergence on $[-1,0]$.
$\cdot$ Are equal to one another on $(-1,1)$ which is dense in $[-1,1]$.
We can conclude that the power series and f are equal also at $x=1$, so $f(-1)$ is indeed the sum of the series.
If you are not familiar with this density theorem :
Since the power series is continuous on -1, by definition, $\lim\limits_{x\rightarrow\ -1}\sum\limits_{n=1}^{\infty}\frac{x^n}{n}=\sum\limits_{n=1}^{\infty}\frac{(-1)^n}{n}$, the limits being taken by approaching from the right ($x>-1$).
But, since the power series and f are equal for $x>-1$, we can put $f$ instead of the power series inside the limit :
$$\lim\limits_{x\rightarrow\ -1}f(x)=\sum\limits_{n=1}^{\infty}\frac{(-1)^n}{n}$$
Or $f$ is continuous on -1, so $\lim\limits_{x\rightarrow\ -1}f(x)=f(-1)$
Hence $\sum\limits_{n=1}^{\infty}\frac{(-1)^n}{n}=f(-1)$.
A: By the ratio test,
$$\lim_{n\to\infty } \left|\frac{x^{n+1}}{n+1}\frac{n}{x^n} \right|=\lim_{n\to\infty}|x|\frac{n}{n+1}<1$$
whenever $|x|<1$. Thus we have convergence on $(-1,1)$. We need to check the endpoints separately. For $x=1$, we have the diverging harmonic series. For $x=-1$, we have the alternating harmonic series, which converges.
A: A power series $\sum_{n=0}^\infty a_n x^n$ (I am assuming the series is centered at zero for definiteness) converges either only at $0$, or on some interval $I$ centered at zero. The half-length of $I$ is called the radius of convergence $R$, and can be computed generally as $\frac{1}{R}=\limsup_{n \to \infty} a_n^{1/n}$ (understood as $R=\infty$ if $1/R$ is zero in the above formula).
A power series with a given radius of convergence may or may not converge at the endpoints $\pm R$. $\sum_{n=1}^\infty \frac{x^n}{n}$ turns out to have radius of convergence $1$ and converges at $-1$ but does not converge at $1$. In the interior of its interval of convergence, a power series may be differentiated term by term; thus in your example you can deduce the derivative of $-\ln(1-x)$ is $\frac{1}{1-x}$ for $|x|<1$ by differentiating its series term by term. In general differentiation may change how the series behaves at its endpoints, as you found here.
A: It's well-known that $$\ln(1+y)=y-\frac{y^2}{2}+\frac{y^3}{3}-\frac{y^4}{4}+\cdots,~~~\forall y \in (-1,1].\tag1$$
Thus, let $y=-x.$ we have $$\ln(1-x)=-x-\frac{x^2}{2}-\frac{x^3}{3}-\frac{x^4}{4}+\cdots,~~~\forall x \in [-1,1).\tag2$$
As result, $$S=1+x+\frac{x^2}{2}+\frac{x^3}{3}+\frac{x^4}{4}+\cdots=1-\left(-x-\frac{x^2}{2}-\frac{x^3}{3}-\frac{x^4}{4}+\cdots\right)=1-\ln(1-x).$$
Notice that, $(1)$ demands $-1<y\leq 1$. then in $(2)$, we demand $-1<-x\leq 1,$ namely, $-1\leq x<1.$
A: It is best to use elementary arguments for such well known power series rather than start integrating power series. While power series methods work fine in the interior of region of convergence, the behavior at boundary needs additional analysis (for example Abel's theorem).
Below I prove the formula $$\log(1+x)=x-\frac{x^2}{2}+\frac{x^3}{3}-\frac{x^4}{4}+\dots\tag{1}$$ for all values of $x$ satisfying $-1<x\leq 1$. The series in question is obtained by replacing $x$ with $-x$.
Let's start with the algebraic identity $$\frac{1}{1+t}=1-t+t^2-\dots+(-1)^{n-1}t^{n-1}+(-1)^{n}\frac{t^{n}}{1+t}\tag{2}$$ which holds for all $t\neq -1$ and all positive integers $n$. Integrating this identity with respect to $x$ over interval $[0,x]$ where $x>-1$ we get $$\log(1+x)=x-\frac{x^2}{2}+\dots+(-1)^{n-1}\frac{x^n}{n}+(-1)^nR_n\tag{3}$$ where $$R_n=\int_{0}^{x}\frac{t^n}{1+t}\,dt$$ Our job is done if we can show that $R_n\to 0$ as $n\to\infty$ for all $x\in(-1,1]$. If $x=0$ then $R_n=0$. If $0<x\leq 1$ then we can see that $$0<R_n\leq \int_{0}^{x}t^n\,dt=\frac{x^{n+1}}{n+1}\leq\frac{1}{n+1}$$ so that $R_n\to 0$. If $x=-y$ and $y\in(0,1)$ then $$R_n=(-1)^{n+1}\int_{0}^{y}\frac{t^n}{1-t}\,dt$$ The integral above is clearly less than or equal to $$\frac{1}{1-y}\int_{0}^{y}t^n\,dt=\frac{y^{n+1}}{(1-y)(n+1)}$$ which tends to $0$ as $n\to\infty$ and hence $R_n\to 0$. It is thus established that $R_n\to 0$ as $n\to\infty$ for all $x\in(-1,1]$. Taking limits as $n\to\infty$ in equation $(3)$ gives us the series $(1)$ which is valid for $x\in(-1,1]$.
