Find a function for the infinite sum $\sum_{n=0}^\infty \frac{n}{n+1}x^n$

I need to find a function $f(x)$ which is equal to the sum $$ \sum_{n=0}^\infty \frac{n}{n+1}x^n, $$ for every $x\in \mathbb{R}$ for which the series converge.

Now, using WolframAlpha, I've found the answer $$f(x)=\frac{-x+x\ \text{log}(1-x)-\text{log}(1-x)}{(x-1)x},\ \ \ \text{when}\ |x|<1$$ However I'm trying to figure out how to find this function $f(x)$ on my own. I've tried to combine the Maclaurin series of $\ln(1+x)$, $\sin(x),$ and several other functions but I don't seem to succeed. Any suggestions how to work out this problem from scratch?


Solution 1:

Hint. One may write, for $0<|x|<1$, $$ \begin{align} \sum_{n=0}^\infty \frac{n}{n+1}x^n&=\sum_{n=0}^\infty \frac{(n+1)-1}{n+1}x^n \\\\&=\sum_{n=0}^\infty x^n-\sum_{n=0}^\infty\frac{x^n}{n+1} \\\\&=\frac1{1-x}-\frac1x\sum_{n=0}^\infty\int_0^xt^ndt \\\\&=\frac1{1-x}-\frac1x\int_0^x\sum_{n=0}^\infty t^ndt \\\\&=\frac1{1-x}-\frac1x\int_0^x\frac1{1-t}dt \\\\&=\frac1{1-x}+\frac1x \log(1-x). \end{align} $$

Solution 2:

Hint: write $$ \sum_{n=0}^\infty \frac{n}{n+1}x^n=\sum_{n=0}^\infty \frac{(n+1)-1}{n+1}x^n=\sum_{n=0}^\infty x^n-\frac1x\sum_{n=0}^\infty \frac{1}{n+1}x^{n+1} $$ and take the derivative of the last series.