How to solve $\int_0^\pi(\sin x +2\sin^2 x+3\sin^3 x+\dots +100\sin^{100} x)^2 dx$ 
How to solve this integration? $\int_0^\pi (\sin x +2\sin^2 x+3\sin^3 x+\dots +100\sin^{100} x)^2 dx$

I tried to solve by using geometric sequence  but couldn't solve it. Does anyone have an idea?
 A: HINT: note that
$$\sum_{k=1}^m k y^k=y\sum_{k=1}^mky^{k-1}=y\sum_{k=1}^m\frac{d}{dy} y^k=y\frac{d}{dy}\sum_{k=1}^m y^k$$

Alternatively you can try to use the following formula to expand the square of the sum
$$\left(\sum_{k=1}^m k y^k\right)^2=\sum_{k=2}^{2m}c_k y^k$$
where
$$\begin{align}c_k:=&\sum_{j=1}^k j(k-j)=k\sum_{j=1}^k j-\sum_{j=1}^k j^2\\&=\frac12k^2(k+1)-\frac13(k+1)k(k-1)-\frac12 k(k+1)\\
&=(k+1)k\left(\frac{k}2-\frac{k-1}3-\frac12\right)\\
&=\frac16(k+1)k(k-1)\end{align}$$
However the value of the integral using this method would be a sum of $2m$ terms, that you would want to write in some compact form.
A: $$S_n=\int_{0}^{\pi}[a_1sinx+a_2sin^2x+...+a_{n}sin^{200}x]dx$$ for some coefficients $a_1,a_2,...,a_n$. 
Now let's look at the coefficient of $sin^{100}x$, this is all the sine terms multiplied such that the sum of the product is 100, eg. $1\times99,2\times98,...,99\times1$. Now you can observe that the coefficient must be of the form $\sum_{i=1}^{99}i(100-i)=\sum_{i=1}^{100}i(100-i)$(since the i=100 term is just zero). Similarly, for the kth power, you can write
$$a_k=\sum_{i=1}^{k}i(k-i)=\sum_{i=1}^{k}(ik-i^2)=k\times\frac{k(k+1)}{2}-\frac{k(k+1)(2k+1)}{6}=\frac{k(k+1)(3k-2k-1)}{6}=\frac{k(k^2-1)}{6}$$
So that 
$$S_n=\int_{0}^{\pi}[\sum_{n=1}^{200}\frac{n(n^2-1)}{6}sin^{n}x]dx$$
Now, let us evaluate$\int_{0}^{\pi}sin^{n}xdx$
$I_n=\int_{0}^{\pi}sin^{n}xdx=[-cosxsin^{n-1}x]_{0}^{\pi}+\int_{0}^{\pi}(n-1)sin^{n-2}xcosx\times cosxdx=\int_{0}^{\pi}(n-1)sin^{n-2}x(1-sin^2x)dx=(n-1)\int_{0}^{\pi}sin^{n-2}x-(n-1)\int_{0}^{\pi}sin^nxdx$
$$\Rightarrow I_n=(n-1)I_{n-2}-(n-1)I_n\Rightarrow I_n=\frac{(n-1)}{n}I_{n-2}$$
Also, you can check that $I_1=\frac{\pi}{2}(\int_{0}^{\pi}sin^2xdx=\int_{0}^{\pi}\frac{1-cos2x}{2}dx)$ and $I_2=\frac{3\pi}{8}(\int_{0}^{\pi}sin^4xdx=\int_{0}^{\pi}\frac{(1-cos2x)^2}{4}dx=\int_{0}^{\pi}\frac{(1+cos^22x+2cos2x)}{4}dx=\int_{0}^{\pi}\frac{(1+\frac{1+cos4x}{2}+cos2x)}{4}dx)$(I did this mainly using the result $sin^2x=\frac{1-cos2x}{2}\ and\ cos^2x=\frac{1+cos2x}{2}$ and the fact that $\int_{0}^{\pi}cos2nxdx=0=\int_{0}^{\pi}sin2nxdx,n\in\mathbb{N}$). So, if n is odd, $I_n=\frac{(n-1)\pi}{2n}$ and $I_n=\frac{3(n-1)\pi}{8n}$ if its even.
Now, you can use this in the original sequence to find the result which would give-
$S_n=\sum_{n=1}^{100}\frac{2n(4n^2-1)\times 3(n-1)\pi}{6\times 8}+\sum_{n=1}^{100}\frac{(2n-1)(4n^2+1-2n-1)\times (n-1)\pi}{6\times 2}=\sum_{n=1}^{100}\frac{2n(2n-1)(n-1)\pi (3(2n+1)+8n-4)}{6\times 8}=\sum_{n=1}^{100}\frac{n(n-1)(2n-1)(14n-1)\pi}{24}$
