<s>[INST] Find the formula for the sum: $1+3x^2+5x^4+7x^6+...+(2n+1)x^{2n}$ The formula is supposed to be valid for $x \neq \pm 1$.
Here is how I did it:
$$\bar{S}_n = \frac{d}{dx}\left( x+x^3+x^5+...+x^{2n+1} \right)$$
The term in the brackets is the geometric sequence. So call the sum up to term $x^{2n+1}$ as $S_n$, then:
$$S_n = \frac{x(1-x^{2n})}{1-x^2}$$
and so:
$$\bar{S}_n = \frac{d}{dx} \left( S_n \right)$$
which gives me:
$$\frac{2x^2 (1-x^{2n})}{(1-x^2)^2}+\frac{1}{1-x^2}\left( 1-x^{2n}(1+2n) \right)$$
apparently, that's wrong. Embarrassing I cannot solve such a simple problem.
 [/INST] Without calculus:
$$S_3:=1+3x^2+5x^4+7x^6
\\=2(1+x^2+x^4+x^6)-1+x^2(1+3x^2+5x^4)
\\=2\frac{1-x^8}{1-x^2}-1+x^2(S_3-7x^6)$$
and more generally
$$S_n=2\frac{1-x^{2n+2}}{1-x^2}-1+x^2(S_n-(2n+1)x^{2n}).$$
So
$$(1-x^2)S_n=2\frac{1-x^{2n+2}}{1-x^2}-1-(2n+1)x^{2n+2}.$$
</s>