TITLE: Proving that $\arctan(x)+\arctan(1/x)=\pm \pi/2$, could this line of reasoning possibly be correct?
QUESTION [29 upvotes]: I know that two questions have already been asked about this exercise, but what I'm asking here is if this solution, which sounds rather strange to me, could possibly be correct. The problems is as follows:

Prove that $\,f(x)=\arctan(x)+\arctan(1/x)= \pi/2\,$ if $\,x>0\,$ and $\,-\pi/2\,$ if $\,x<0$.

What I did was this: first of all we note that, since $-\pi/2<\arctan y<\pi/2$ for all $y$, $-\pi<f(x)<\pi$. Now , consider 
$$
\tan\big(f(x)\big)
= \tan\left(\arctan(x)+\arctan\left(\frac{1}{x} \right)\right)
= \frac{\tan\left(\arctan(x)\right) + \tan\left(\arctan\left(\frac{1}{x} \right)\right)}
{1 - \tan\big(\arctan\left(x\right)\big) \tan\left(\arctan\left(\frac{1}{x} \right)\right)}=\frac{x+(1/x)}{0},
$$ 
which is undefined. Since the tangent function is undefined, in $[-\pi, \pi]$, if and only if its argument is $\pm \pi/2$, then $f(x)=\pm \pi/2$. It's easy to see that if $x<0$, then $\arctan(x)<0$, hence $f(x)=-\pi/2$ and viceversa.
I have found a few other solution to this problem, but I wanted to know if this one is logically acceptable.

REPLY [2 votes]: Let $F:(0, \infty)$ be the function
$$\forall x\in(0,\infty):F(x) = \int _0 ^x \frac{1}{1+t^2}dt +\int _0 ^{1/x} \frac{1}{1+t^2}dt$$.
Now, we can see that
$$\lim _{x \to \infty} F(x) = \lim _{x \to \infty} 
\left(\int _0 ^x \frac{1}{1+t^2}dt + \int _0 ^{1/x} \frac{1}{1+t^2}dt \right) \\
= \lim _{x \to \infty} \int _0 ^x \frac{1}{1+t^2}dt + \lim _{x \to \infty} \int _0 ^{1/x} \frac{1}{1+t^2}dt$$
We can define $z \in \left(0, \infty \right)$ to $z = \frac{1}{x}$ and gets
$$\lim _{x \to \infty} \int _0 ^x \frac{1}{1+t^2}dt = \lim _{z \to 0 ^+} \int _0 ^{1/z} \frac{1}{1+t^2}dt \\
\lim _{x \to \infty} \int _0 ^{1/x} \frac{1}{1+t^2}dt = \lim _{z \to 0^+} \int _0 ^z \frac{1}{1+t^2}dt \\
\Rightarrow \lim _{x \to \infty} \int _0 ^x \frac{1}{1+t^2}dt + \lim _{x \to \infty} \int _0 ^{1/x} \frac{1}{1+t^2}dt = \lim _{z \to 0^+} \int _0 ^{1/z} \frac{1}{1+t^2}dt + \lim _{z \to 0^+} \int _0 ^{z} \frac{1}{1+t^2}dt \\
\Rightarrow \lim _{x \to \infty} F(x) = \lim _{z \to 0^+} F(z)$$
From the first fundamental theorem of calculus we know that &F& differentiable and therefore its continouos. Thus, because $\lim _{x\to\infty} F(x) = \lim _{x\to 0^+} F(x)$ then $F$ is constant function. We can compute its value by
$$
\forall x\in\left(0,\infty\right) F(x)=F(1) \\
=\int _0 ^x \frac{1}{1+t^2}dt + \int _0 ^{1/x} \frac{1}{1+t^2}dt \\
=2 \int_0^x\frac{1}{1+t^2}dt \\
=2\left(\arctan(1)-\arctan(0)\right) \\
=2(\frac{\pi}{4})=\frac{\pi}{2} 
$$
$forall x \in \left(-\infty, 0\right)$ we can notice that
$$
F(x)=\int _0 ^x \frac{1}{1+t^2}dt + \int _0 ^{1/x} \frac{1}{1+t^2}dt \\
= -\int _0 ^{-x} \frac{1}{1+t^2}dt - \int _0 ^{1/-x} \frac{1}{1+t^2}dt \\
= -F(-x)=-\frac{\pi}{2}
$$