I am trying to get a closed form expression for the following sum:
$$x + 2x^2 + 3x^3 + \cdots + nx^n$$
so by perturbation method:
$$S = x + 2x^2 + 3x^3 + \cdots + nx^n$$
$$xS= x^2 + 2x^3 + \cdots + (n-1)x^n + nx^{n+1}$$
$$(1-x)S = x + x^2 + x^3 + \cdots + x^n - nx^{n+1}$$
Now here is where it gets weird. The professor writes that this can be simplified to this well-known sum: $1+ x+ x^2 + \cdots + x^n = \frac{1-x^{n+1}}{1-x}$
Giving us:
$$(1-x)S = \frac{1-x^{n+1}}{1-x} - nx^{n+1} - 1$$
I see the $-1$ is because there is no $1$ in our sum but can't I do the following:
$$(1-x)S = x(1 + x + x^2+\cdots+x^{n-1}) - nx^{n+1}$$
$$(1-x)S = x \left( \frac{1-x^n}{1-x} \right) - nx^{n+1}$$
So I went to wolfram to see if this was possible and got a peculiar result when I went to test:
Now I might be using wolfram wrong but is it fair to assume that these two statements:
1.) $(1-x)S = (1-x^(n+1))/(1-x) - nx^(n+1) - 1$
2.) $(1-x)S = x((1-x^n)/(1-x)) - nx^(n+1)$
are equal? And if not: where did I go wrong to get the second statement?


Both of your results are correct, You are just using Wolfram wrong.
Here's the actual output,