# Why does this ratio of sums of square roots equal $1+\sqrt2+\sqrt{4+2\sqrt2}=\cot\frac\pi{16}$ for any natural number $n$?

Why is the following function $f(n)$ constant for any natural number $n$? $$f(n)=\frac{\sum_{k=1}^{n^2+2n}\sqrt{\sqrt{2n+2}+{\sqrt{n+1+\sqrt k}}}}{\sum_{k=1}^{n^2+2n}\sqrt{\sqrt{2n+2}-{\sqrt{n+1+\sqrt k}}}}=1+\sqrt2+\sqrt{4+2\sqrt2}=\cot {\frac{\pi}{16}}.$$

I've been asking the following question at MSE:

Simplify $$\frac{\sum_{k=1}^{2499}\sqrt{10+{\sqrt{50+\sqrt{k}}}}}{\sum_{k=1}^{2499}\sqrt{10-{\sqrt{50+\sqrt{k}}}}}.$$

Simplify $\left({\sum_{k=1}^{2499}\sqrt{10+{\sqrt{50+\sqrt{k}}}}}\right)\left({\sum_{k=1}^{2499}\sqrt{10-{\sqrt{50+\sqrt{k}}}}}\right)^{-1}$

I've just got the following result:$$\frac{\sum_{k=1}^{2499}\sqrt{10+{\sqrt{50+\sqrt k}}}}{\sum_{k=1}^{2499}\sqrt{10-{\sqrt{50+\sqrt k}}}}=1+\sqrt2+\sqrt{4+2\sqrt2}.$$

Proof: Suppose that $\sum$ represents $\sum_{k=1}^{2499}$. Let the numerator and the denominator be $A$ and $B$ respectively. Letting $a_k=\sqrt{10+\sqrt{50+\sqrt k}}, b_k=\sqrt{10-\sqrt{50+\sqrt k}}$, we can represent $A, B$ as $A=\sum a_k, B=\sum b_k.$ Letting $p_k=\sqrt{50+\sqrt k}$ and $q_k=\sqrt{50-\sqrt k}$, since ${p_k}^2+{q_k}^2=10^2$ and $p_k\gt0, q_k\gt0$, there exists a real number $0\lt x_k\lt \frac{\pi}{2}$ such that $p_k=10\cos x_k, q_k=10\sin x_k$. Then, we get $$a_k=\sqrt{10+10\cos x_k}=\sqrt{10+10\left(2{\cos^2{\frac{x_k}{2}}}-1\right)}=\sqrt{20}\cos \frac{x_k}{2},$$$$b_k=\sqrt{10-10\cos x_k}=\sqrt{10-10\left(1-2{\sin^2{\frac{x_k}{2}}}\right)}=\sqrt{20}\sin \frac{x_k}{2}.$$

Then, since $\sum a_k=\sum a_{2500-k}$, let's consider $a_{2500-k}$.$$a_{2500-k}=\sqrt{10+\sqrt{50+\sqrt{(50+\sqrt k)(50-\sqrt k)}}}=\sqrt{10+\sqrt{50+{p_kq_k}}}=\sqrt{10+\sqrt{50+100\cos {x_k}\sin {x_k}}}=\sqrt{10+\sqrt{50(\cos {x_k}+\sin {x_k})^2}}=\sqrt{10+\sqrt{50}\cdot\sqrt2\sin \left(x_k+\frac{\pi}{4}\right)}=\sqrt{10+10\cdot2\cos \left(\frac{x_k}{2}+\frac{\pi}{8}\right)\sin \left(\frac{x_k}{2}+\frac{\pi}{8}\right)}=\sqrt{10\left(\cos \left(\frac{x_k}{2}+\frac{\pi}{8}\right)+\sin \left(\frac{x_k}{2}+\frac{\pi}{8}\right)\right)^2}=\sqrt {10}\left(\cos \left(\frac{x_k}{2}+\frac{\pi}{8}\right)+\sin \left(\frac{x_k}{2}+\frac{\pi}{8}\right)\right)=\frac{\left(\cos \left(\frac{\pi}{8}\right)+\sin \left(\frac{\pi}{8}\right)\right)a_k+\left(\cos \left(\frac{\pi}{8}\right)-\sin \left(\frac{\pi}{8}\right)\right)b_k}{\sqrt2}=\sqrt{\frac{\sqrt2+1}{2\sqrt2}}a_k+\sqrt{\frac{\sqrt2-1}{2\sqrt2}}b_k.$$ Hence, $$A=\sqrt{\frac{\sqrt2+1}{2\sqrt2}}A+\sqrt{\frac{\sqrt2-1}{2\sqrt2}}B.$$ So, the proof is completed with $$\frac AB=1+\sqrt2+\sqrt{4+2\sqrt2}.$$

After a while, I got the following theorem in the same way as above.

Theorem: For any natural number $n$, $$\frac{\sum_{k=1}^{n^2+2n}\sqrt{\sqrt{2n+2}+{\sqrt{n+1+\sqrt k}}}}{\sum_{k=1}^{n^2+2n}\sqrt{\sqrt{2n+2}-{\sqrt{n+1+\sqrt k}}}}=1+\sqrt2+\sqrt{4+2\sqrt2}=\cot {\frac{\pi}{16}}.$$

Note that the case $n=49$ in this theorem is the question at the top.

I was surprised to get this theorem. Here is my question.

Question: Why is the function $f(n)$ constant for any natural number $n$? How can we explain this theorem in a geometrical aspect? Is there any geometrical background?

My question is about the background of this equation, and about the reason, not about the proof of it. This theorem has been already proved. Though I've already proved it, I wonder why it is constant.

Any help would be appriciated.

• Note that you can post your proof for case $n=49$ as an answer to your own question (the otherone) and accept it so that it gets some kind of closure – Jean-Sébastien Aug 11 '13 at 5:21
• @Jean-Sébastien: Thanks. I'll do so. – mathlove Aug 11 '13 at 6:55

## 1 Answer

$\frac {\cos (a+b) + \cos (a - b)}{\sin (a+b) + \sin (a -b)} = cotan (a)$ is independent of $b$.

In particular, with $a = \frac \pi {16}$, $\frac{\cos x + \cos (\frac \pi 8 - x)}{\sin x + \sin (\frac \pi 8 - x)}$ is independant of $x$.

Since $\cos(4(\frac \pi 8 - x)) = \sin(4x)$ and $\sin(4(\frac \pi 8 - x)) = \cos(4x)$, after multiplying the angle by $4$, those will look quite the same.

So, expressing everyone in terms of $\cos (4x)$ and $\sin (4x)$, you get the similar looking expressions (valid for $x \in [0 ; \frac \pi 8]$):

$\cos x = \sqrt{\frac 1 2 + \sqrt{\frac {1+ \cos(4x)}8}} \\ \sin x = \sqrt{\frac 1 2 - \sqrt{\frac {1+ \cos(4x)}8}} \\ \cos (\frac \pi 8 -x) = \sqrt{\frac 1 2 + \sqrt{\frac {1+ \sin(4x)}8}} \\ \sin (\frac \pi 8 -x) = \sqrt{\frac 1 2 - \sqrt{\frac {1+ \sin(4x)}8}} \\$

Next, let $u = \cos(4x)^2$, you obtain that

$$\frac {\sqrt{\frac 1 2 + \sqrt{\frac {1+ \sqrt u}8}} + \sqrt{\frac 1 2 + \sqrt{\frac {1+ \sqrt{1-u}}8}}}{\sqrt{\frac 1 2 - \sqrt{\frac {1+ \sqrt u}8}} + \sqrt{\frac 1 2 - \sqrt{\frac {1+ \sqrt{1-u}}8}}}$$ is a constant.

Your equality is then obtained by obfuscating : multiply numerator and denominator with $\sqrt {2 \sqrt{2n+2}}$, and apply this with $u = \frac k {(n+1)^2}$

So the equality boils down to the original surprising equality about $cotan(a)$. I'm not sure if it can be understood geometrically.

You can get more complicated formulas (even more nested square roots !) by reflecting the angle around $a = \frac \pi {2^k}$ for $k > 4$

• Nice answer! Many thanks. – mathlove Sep 5 '13 at 15:39