Prove $\sum_{n\geq1}\frac{2^n (1-\cos\frac{x}{2^n})^2}{\sin\frac{x}{2^{n-1}}}=\tan\frac{x}{2}-\frac{x}{2}$ How to prove for $|x|<\pi$:

*

*$\sum_{n\geq1}\frac{2(1-\cos(\frac{x}{2^n}))}{\sin(\frac{x}{2^{n-1}})}=\tan(\frac{x}{2})$

*$\sum_{n\geq1}\frac{2^n (1-\cos(\frac{x}{2^n}))^2}{\sin(\frac{x}{2^{n-1}})}=\tan(\frac{x}{2})-\frac{x}{2}$
Any help will be appreciated.


Here is a geometric proof for 
$$\sum_{n\geq1}\frac{2(1-\cos\frac{x}{2^n})}{\sin\frac{x}{2^{n-1}}}=\tan\frac{x}{2}$$
Let $OA_1,\>OA_2,\>OA_3 …$ successively bisect the vextex angle $\angle O=\frac x2$ of the right triangle $OTA$, which leads to $\frac{AA_1}{TA_1} = \frac{OA}{OT}$, or,
$$AA_1= OA\cdot TA_1 = \sec\frac x2\tan\frac x4 = \frac{2\sin^2\frac x4}{\cos\frac x2\sin\frac x2} = \frac{2(1-\cos\frac x2)}{\sin x}$$
and, likewise,
$$A_1A_2 = \frac{2(1-\cos\frac x4)}{\sin \frac x2},\>\>\>\>\>
A_2A_3 = \frac{2(1-\cos\frac x8)}{\sin \frac x4},\>\>\>\>\>A_3A_4 = ...$$
From the diagram, we have
$$\tan \frac x2 = AT = AA_1 + A_1A_2 + A_2A_3 + … = \sum_{n\geq1}\frac{2(1-\cos\frac{x}{2^n})}{\sin\frac{x}{2^{n-1}}}$$
