I try to simplify the sum $\sum_{j=0}^{i-2}j3^j$. My method leads to an error.
I proceed by evaluating $3(\sum_{j=0}^{i-2}3^j)'$
The derivative $(\sum_{j=0}^{i-2}3^j)'$ is equal to $\left(\frac{3^{i-1}-1}{2}\right)'$, which itself is equal to $(i-1)3^{i-2}/2$.
The problem is that $3(i-1)3^{i-2}/2$ do not seem to be equal to $\sum_{j=0}^{i-2}j3^j$.
Where is my mistake ?
The error is that the 2 in the denominator in $\left(\frac{3^{i-1}-1}{2}\right)'$ is not a constant but it is 3 - 1. You treat 3 as a variable here, so you should also treat the 3 'hidden' in the 2 in the same way.
Better yet is to use only x's and y's as variables and not numbers. Like this:
$(\sum_{j=0}^{i-2}j3^j) = 3f'(3)$ where $f(x) = \sum_{j=0}^{i-2}x^j$ (and hence $f'(x) = \sum_{j=0}^{i-1} j x^{j-1}$).
Now $f(x) = \left(\frac{x^{i-1}-1}{x - 1}\right)$ so that $f'(x) = $ [some expression in $x$] and hence $3 f'(3) = $ [some number].
You can take derivatives of functions and you can input numbers (like 3) into functions to obtain numbers, but it is generally unwise to do both at the same time. Your question is actually a very nice illustration of that.