# Geometry problem boils down to finding a closed form for $\sum_{n=1}^{k}{\arctan{\left(\frac{1}{n}\right)}}$

I was solving the following problem:

"Find $\angle A + \angle B + \angle C$ in the figure below, assuming the three shapes are squares." And I found a beautiful one-liner using complex numbers:

$(1+i)(2+i)(3+i)=10i$, so $\angle A + \angle B + \angle C = \frac{\pi}{2}$

Now, I thought, what if I want to generalize? What if, instead of three squares, there were $2018$ squares? What would the sum of the angles be then? Could I make a formula for $k$ squares?

Essentially, the question boiled down to finding a closed form for the argument of the complex number

$$\prod_{n=1}^{k}{(n+i)}=\prod_{n=1}^{k}{\left(\sqrt{n^2+1}\right)e^{i\cot^{-1}{n}}}$$

This we can break into two parts, finding a closed form for $$\prod_{n=1}^{k}{(n^2+1)}$$ and $$\sum_{n=1}^{k}{\cot^{-1}{n}}$$

This I don't know how to solve.

• It seems you summed under the square root -- that would work if the square root were a logarithm, but it doesn't work for square roots. You can check that your result doesn't give the right values for the first few values of $k$. (Speaking of which, the products and summations run to $k$, whereas $n$ is just the summation index, so the free variable in the results should be $k$, not $n$.) – joriki Jul 19 '18 at 0:15
• Oops, it seems that I mixed up my products and summations. – Shrey Joshi Jul 19 '18 at 0:31

With CAS help:

$$\sum _{n=1}^k \tan ^{-1}\left(\frac{1}{n}\right)=\\\int \left(\sum _{n=1}^k \frac{\partial }{\partial a}\tan ^{-1}\left(\frac{a}{n}\right)\right) \, da=\\\int \left(\sum _{n=1}^k \frac{n}{a^2+n^2}\right) \, da=\\\int \frac{1}{2} \left(-H_{-i a}-H_{i a}+H_{-i a+k}+H_{i a+k}\right) \, da=\\-\frac{1}{2} i (\text{log\Gamma }(1-i a)-\text{log\Gamma }(1+i a)-\text{log\Gamma }(1-i a+k)+\text{log\Gamma }(1+i a+k))+C$$

where $a=1$ and $C=0$ then:

$$\color{blue}{\sum _{n=1}^k \tan ^{-1}\left(\frac{1}{n}\right)=-\frac{1}{2} i (\text{log\Gamma }(1-i)-\text{log\Gamma }(1+i)-\text{log\Gamma }((1-i)+k)+\text{log\Gamma }((1+i)+k))}$$

Where: $H_{i a}$ is harmonic number and $\text{log$\Gamma $}(1-i)$ is logarithm of the gamma function

MMA code:

HoldForm[Sum[ArcTan[1/n], {n, 1, k}] == -(1/2)
I (LogGamma[1 - I] - LogGamma[1 + I] - LogGamma[(1 - I) + k] + LogGamma[(1 + I) + k])] // TeXForm

• An integral sign is missing on the second line. By the way, great answer! – Szeto Jul 20 '18 at 3:28
• Moreover, I don’t think that $C=0$. Consider the case $a=0$. – Szeto Jul 20 '18 at 3:30
• @Szeto. Case is only $a=1$,there are No others cases. :) – Mariusz Iwaniuk Jul 20 '18 at 7:17
• cute starting point ! (+1). Now use the fact that $\Gamma (\tilde z) = \tilde \Gamma (z)$ to simplify a further step and reach to the same conclusion as in my answer : $Im(ln(\Gamma(1+i+k) / \Gamma(1+i)))$ – G Cab Jul 20 '18 at 15:52

Playing around with Wolfy suggests that $s(n) =\sum_{k=1}^n \arctan(1/k) =\frac{3\pi}{4}-\frac12\arctan(g(n))$ where $g(n)$ is an increasingly complicated fraction.

Some values are $g(4) = 15/8, g(5) = 140/71, g(6) = 2848/7665, g(7) = 14697/203896$.

To get a recurrence for $g(n)$,

$\begin{array}\\ s(n+1)-s(n) &=\arctan(1/(n+1))\\ &=(\frac{3\pi}{4}-\frac12\arctan(g(n+1)))-(\frac{3\pi}{4}-\frac12\arctan(g(n)))\\ &=\frac12(\arctan(g(n))-\arctan(g(n+1))\\ \end{array}$

so, using $\arctan(x)\pm\arctan(y) =\arctan(\frac{x\pm y}{1\mp xy})$,

$\begin{array}\\ \arctan(g(n+1)) &=\arctan(g(n))-2\arctan(1/(n+1))\\ &=\arctan(g(n))-\arctan(\frac{2/(n+1)}{1-1/(n+1)^2})\\ &=\arctan(g(n))-\arctan(\frac{2(n+1)}{(n+1)^2-1})\\ &=\arctan(g(n))-\arctan(\frac{2(n+1)}{n^2+2n})\\ &=\arctan(\frac{g(n)-\frac{2(n+1)}{n^2+2n}}{1+g(n)\frac{2(n+1)}{n^2+2n}})\\ &<\arctan(g(n)-\frac{2}{n+1})\\ \end{array}$

so, assuming that the proper branch of arctan is taken, $g(n+1) =\frac{g(n)-\frac{2(n+1)}{n^2+2n}}{1+g(n)\frac{2(n+1)}{n^2+2n}} \lt g(n)-\frac{2}{n+1}$.

Since $\sum 1/n$ diverges, this shows that exentually $g(n) < 0$. At this point the next branch of arctan has to be taken.

For example, Wolfy calculates that $s(20) =\frac{5 π}{4} - \frac12 \arctan(\frac{47183650393321137025}{17864397263976449928})$ and $s(40) =\frac{5π}{4} + \frac12 \arctan(\frac{41279370979134545450499387615832498927444174194743607}{269197868658553203529942799672226208517623565372926024})$.

I'll leave it at this.

• Sadly no matches for fraction on OEIS. – qwr Jul 19 '18 at 2:55

We have that $$\prod\limits_{1\, \le \,n\, \le \,k} {\left( {i + n} \right)} = {1 \over i}\prod\limits_{0\, \le \,n\, \le \,k} {\left( {i + n} \right)} = {1 \over i}i^{\,\overline {\,k + 1\,} } = \left( {1 + i} \right)^{\,\overline {\,k\,} } = {{\Gamma \left( {1 + i + k} \right)} \over {\Gamma \left( {1 + i} \right)}} = k!\left( \matrix{ i + k \cr k \cr} \right)$$ where $x^{\,\overline {\,k\,} } = {{\Gamma (x + k)} \over {\Gamma (x)}}$ denotes the Rising Factorial and $x^{\,\underline {\,k\,} } = \left( {x - k + 1} \right)^{\,\overline {\,k\,} }$ the Falling Factorial.
By means of the expression through The Gamma Function, they are defined as meromorphic functions even for complex $x$ and $k$.

Then $$\ln \left( {z^{\,\overline {\,k\,} } } \right) = \ln \left( {\left| {z^{\,\overline {\,k\,} } } \right|} \right) + i\arg \left( {z^{\,\overline {\,k\,} } } \right) = \ln {{\Gamma (z + k)} \over {\Gamma (z)}}$$

The above tells us that your question is related to the absolute value and argument of the Gamma Function, which unfortunately do not have a closed expression, better than the above.

• I get the first and second steps but I don't understand what $\overline{k+1}$ and $\Gamma$ are. Could you please explain? – Shrey Joshi Jul 19 '18 at 1:40
• @ShreyJoshi From context I assume it's a strange factorial variant: $a^{\overline{b}} = (a+b)!/a!$? – user7530 Jul 19 '18 at 1:43
• Actually the third, fourth and fifth steps are not necessary. This can be derived directly from the definition of generalized binomial coefficients. – Szeto Jul 19 '18 at 1:45
• The Gamma function ($\Gamma (x)$) is the same as an offset factorial ($(x - 1)!$), but defined in such a way that it is usable for non-integer values of $x$. $i^{\,\overline {\,k + 1\,}}$ in this context is the rising factorial: $i(i + 1)(i + 2) \cdots (i + k - 1)(i + k)$. – Bladewood Jul 19 '18 at 2:21
• @above, thank you for clearing it all up, I see how it fits together much better now. One thing I find funny is how we can define factorials and choose functions for imaginary numbers. It would also be interesting to see what would happen for fractional $k$. – Shrey Joshi Jul 19 '18 at 2:53

Note that the addition formula for the arctangent gives $\arctan(x)+\arctan(y)=\arctan(\dfrac{x+y}{1-xy})$; thus, if we define $\alpha_n$ by $\arctan(\alpha_n)=\sum_{i=1}^n\arctan(\frac1i)$, then we have $\alpha_n=\dfrac{\alpha_{n-1}+\frac1n}{1-\frac{\alpha_{n-1}}{n}}$ $=\dfrac{n\alpha_{n-1}+1}{n-\alpha_{n-1}}$; alternately, setting $\alpha_n=\frac{a_n}{b_n}$, we can write this as $a_n=na_{n-1}+b_{n-1}, b_n = -a_{n-1}+nb_{n-1}$ - or $\begin{pmatrix}a_n \\ b_n \end{pmatrix} = \begin{pmatrix}n & 1 \\ -1 & n\end{pmatrix}\begin{pmatrix}a_{n-1} \\ b_{n-1} \end{pmatrix}$. This 'blows up' at $n=3$ (since there's a division by zero), but because the equation in terms of $a_n$ and $b_n$ is homogeneous, we can continue through that point with a rescaling: $(a_n, b_n) (1\leq n\leq 3) =\langle(1, 1), (3, 1), (10, 0)\rangle$, and rescaling to take $a_3=1, b_3=0$ we get $a_4=4, b_4=-1$; $a_5=19, b_5=-9$; $a_6=105, b_6=-73$; $a_7=662, b_7=-616$; etc. Unfortunately, I also can't find any references to this series, and the OEIS doesn't seem to be any help.