Evaluate the following product: $$\newcommand{\T}[1]{\frac{\sin\frac{\theta}{#1}}{\tan^2\frac{\theta}{#1}\tan\frac{2\theta}{#1} + \tan\frac{\theta}{#1}}} \\ P(\theta) = \T{2} \times \T{2^2} \times \T{2^3} \times .... \infty$$ For $\theta = \frac \pi 4$
Simplified, $P(\theta)$ is $$P(\theta) = \lim_{n \to \infty}\prod_{r=1}^n T(\theta,r)= \lim_{n \to \infty}\prod_{r=1}^n\T{2^r}$$ The denominator can be simplified as follows: $$D = \tan\frac{\theta}{2^r}\left( \tan\frac{\theta}{2^r}\tan\frac{\theta}{2^{r-1}} + 1\right) \\ = \tan\frac{\theta}{2^{r-1}} - \tan\frac{\theta}{2^{r}}$$ After this, $P(\theta)$ becomes $$P(\theta) = \lim_{n \to \infty}\prod_{r=1}^n \frac{\sin\frac{\theta}{2^r}}{\tan\frac{\theta}{2^{r-1}}- \tan\frac{\theta}{2^r}}$$
One more detail I found out is that $\lim_{n \to \infty} T(\theta,n) = 1$, but I couldn't proceed further from here. Any hints/solutions are appreciated.
EDIT: After the hints in the comments, $T(\theta, r)$ resolves to $\cos \frac \theta {2^{r-1}} \cos \frac \theta {2^r}$ as follows (assuming $\frac \theta {2^r} = t$) $$\begin{gather} T(\theta, n) = \frac{\sin t}{\tan^2t\tan 2t + \tan t} \\ = \frac{\cos t}{\tan t \tan 2t + 1} \\ = \frac{\cos t(1-\tan^2t)}{1+\tan^2t} \\ = \cos t \cos 2t \\ = \cos \frac \theta {2^{r-1}} \cos \frac \theta {2^r} \end{gather}$$
Now, $$P(\theta) = \lim_{n \to \infty} \frac{ \left( \cos\theta\cos\frac\theta2... \cos \frac{\theta}{2^n} \right)^2 }{\cos\theta} = \frac{\sin^2\theta}{2^{2n}\sin^2 \frac \theta {2^n}\cos \theta} = \frac{\sin^2 \theta}{\theta^2 \cos \theta}$$ Therefore, $$\boxed{P(\pi/4) = \frac{8\sqrt2}{\pi^2}}$$
However, the answer mentioned in the textbook is $\frac{2}{\pi}$. Where am I going wrong? (I think there's a silly mistake somewhere here; just not able to find it :(