Prove that $$\sum_{n=1}^{\infty}\frac{1}{n^2}=\frac{\pi^2}{6}$$
I have actually got the HINT for this Proof from a very nice book:
The HINT i started with is:
$$\frac{1}{\sin^2 x}=\frac{1}{4\sin^2\left(\frac{x}{2}\right)\cos^2\left(\frac{x}{2}\right)}=\frac{1}{4}\left(\frac{1}{\sin^2\left(\frac{x}{2}\right)}+\frac{1}{\sin^2\left(\frac{x+\pi}{2}\right)}\right) \tag{1}$$
Now we have:
$$1=\frac{1}{\sin^2\left(\frac{\pi}{2}\right)}=\frac{1}{4}\left(\frac{1}{\sin^2\left(\frac{\pi}{4}\right)}+\frac{1}{\sin^2\left(\frac{3\pi}{4}\right)}\right)$$
Applying $(1)$ Repeatedly we get
$$1=\frac{1}{16}\left (\frac{1}{\sin^2\left(\frac{\pi}{8}\right)}+\frac{1}{\sin^2\left(\frac{3\pi}{8}\right)}+\frac{1}{\sin^2\left(\frac{5\pi}{8}\right)}+\frac{1}{\sin^2\left(\frac{7\pi}{8}\right)}\right)$$
So Generalizing we get:
$$1=\frac{1}{4^n}\sum_{k=0}^{2^n-1} \frac{1}{\sin^2\left(\frac{(2k+1)\pi}{2^{n+1}}\right)}$$
EDIT:
Ok let me explain the next step the author of the book has followed: $$1=\frac{1}{4^n}\sum_{k=0}^{2^n-1} \frac{1}{\sin^2\left(\frac{(2k+1)\pi}{2^{n+1}}\right)}=\frac{2}{4^n}\sum_{k=0}^{2^{n-1}-1} \frac{1}{\sin^2\left(\frac{(2k+1)\pi}{2^{n+1}}\right)}$$
My doubt is how a factor of $2$ came outside and why the upper limit has changed?