# Calculate: $\sum_{k=0}^{n-2} 2^{k} \tan \left(\frac{\pi}{2^{n-k}}\right)$

Calculate the following sum for integers $n\ge2$:

$$\sum_{k=0}^{n-2} 2^{k} \tan \left(\frac{\pi}{2^{n-k}}\right)$$

I'm trying to obtain a closed form if that is possible.

• Is this a contest problem, or a question of your own creation? I see no reason a priori to believe this has a nice closed form. Jun 20, 2012 at 9:22
• @Potato: my colleague sent me a while ago this problem to solve and told me that it has a nice closed form. However, it looks bad and so far i see no resonable way to go. Jun 20, 2012 at 9:26

We have this nice identity $$\tan(\theta) = \cot(\theta)-2 \cot(2 \theta)$$ Making use of this, and denoting $\displaystyle \sum_{k=0}^{m} 2^k \tan(2^k \theta)$ as $S$, we get that \begin{align}S & = \tan(\theta) + 2 \tan(2 \theta) + 4 \tan(4 \theta) + \cdots + 2^m \tan(2^m \theta)\\ & = \cot(\theta) -2 \cot(2 \theta) +2 \cot(2\theta) - \cdots + 2^m \cot(2^m \theta) - 2^{m+1} \cot(2^{m+1} \theta)\\ & = \cot(\theta) - 2^{m+1} \cot(2^{m+1} \theta) \end{align} In your case, $\theta = \dfrac{\pi}{2^n}$ and $m= n-2$. Hence, we get the sum to be $$S = \cot \left(\dfrac{\pi}{2^n} \right) - 2^{n-1} \cot \left( 2^{n-1} \cdot \dfrac{\pi}{2^n}\right) = \cot \left(\dfrac{\pi}{2^n} \right) - 2^{n-1} \cot \left( \dfrac{\pi}2\right) = \cot \left(\dfrac{\pi}{2^n} \right)$$
Proof for $\tan(\theta) = \cot(\theta)-2 \cot(2 \theta)$
$$\cot(\theta) - \tan(\theta) = \dfrac{\cos(\theta)}{\sin(\theta)} - \dfrac{\sin(\theta)}{\cos(\theta)} = \dfrac{\cos^2(\theta) - \sin^2(\theta)}{\sin(\theta) \cos(\theta)}= 2\dfrac{\cos(2\theta)}{\sin(2 \theta)} = 2 \cot(2 \theta)$$
Consider $$\prod_{k = 0}^{n - 2}\cos(2^k \theta)$$ Multiplying numerator and denominator by $2\sin(\theta)$ we get, $$\frac{2\sin(\theta)\cos(\theta)}{2\sin(\theta)}\prod_{k = 1}^{n - 2} \cos(2^k\theta) = \frac{\sin(2\theta)}{2\sin(\theta)}\prod_{k = 1}^{n - 2} \cos(2^k\theta)$$ Now, repeatedly multiplying and dividing by 2, we can reduce the above to, $$\prod_{k = 0}^{n - 2}\cos(2^k \theta) = \frac{\sin(2^{n - 1} \theta)}{2^{n - 1} \sin(\theta)}$$ Take logs on both sides, $$\sum_{k = 0}^{n - 2}\ln(\cos(2^k \theta)) = \ln(\sin(2^{n - 1} \theta)) - \ln(2^{n - 1}) - \ln(\sin(\theta))$$ Differentiating both sides w.r.t $\theta$ we get, $$-\sum_{k = 0}^{n - 2}2^k\tan(2^k \theta) = 2^{n - 1}\cot(2^{n - 1} \theta) - \cot(\theta)$$ Substitute $\theta = \frac{\pi}{2^n}$ above to get, $$\sum_{k = 0}^{n - 2}2^k\tan\left(\frac{\pi}{2^{n - k}}\right) = \cot\left(\frac{\pi}{2^n}\right)$$