Proving that $\arctan(x)+\arctan(1/x)=\pm \pi/2$, could this line of reasoning possibly be correct? 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. 
 A: I just figured I'd throw this in.
Let $f(x) = \arctan(x) + \arctan(1/x)$ for all $x \in (0, \infty)$.
Then $f'(x) = \dfrac{1}{1+x^2} - \dfrac{\dfrac{1}{x^2}}{1 + \dfrac{1}{x^2}} = 0$.
Hence $f(x)$ is constant on $(0, \infty)$. 
Since $f(1) = \dfrac{\pi}{4} + \dfrac{\pi}{4} = \dfrac{\pi}{2}$,
we conclude that
$f(x) = \dfrac{\pi}{2}$ for all $x \in (0, \infty)$.

Addendum
If you're not ready for calculus, for the same
$x \in (0, \infty)$,
Consider the point
$P = (1, x)$, in the first quadrant, with corresponding angle 
$0 \lt \theta \lt \dfrac{\pi}{2}$.
Let $\hat{\theta} = \dfrac{\pi}{2} - \theta$.
Then, also, $0 \lt \hat{\theta} \lt \dfrac{\pi}{2}$ and
$\tan(\hat \theta)
 = \tan \left( \dfrac{\pi}{2} - \theta \right)
 = \cot \theta = \dfrac 1x$
It follows that
$\arctan x + \arctan \dfrac 1x 
 = \theta + \hat \theta
 = \dfrac{\pi}{2}$

For all $x \in (-\infty, 0)$, we have
$\arctan x + \arctan \dfrac 1x = 
 -\left(\arctan(-x) + \arctan \left(-\dfrac 1x \right) \right) =
 -f(-x) = -\dfrac{\pi}{2}$.
A: Whatever you have done is correct and nothing is wrong there.You could get the same as follows also:
Note that : $\tan^{-1}x=\tan^{-1}1/x -\pi$, when $x\lt0$...(A) and is equal to $\tan^{-1}1/x$ when $x\gt0$..(B)
PROOF:I am proving for $x$ being negative.For +ve $x$ it's quite easy to prove.
Suppose, $y=-z$, ($z$ is positive ), hen $\cot^{-1}(y)=\cot^{-1}(-z)=\pi -\cot^{-1}(z)$ Now you might be knowing :$\cot^{-1}(z)=\tan^{-1}(1/z)$ for positive $z$, hence $\cot^{-1}(-z)=\pi - \tan^{-1}(1/z)$. Now substitue $z=-y$, then use $\tan^{-1}(-1/y)=-\tan^{-1}(1/y)$ and you get the result.
Now you may argue: why $\cot^{-1}(-z)=\pi-\cot^{-1}z$?
Well, it's because :Let $z=\cot\theta$, $0<\theta<\pi$[principal branch of $\cot$]. So $-z=\cot(\pi-\theta)$ , Note that $\pi- \theta$ is also in between $0$ and $\pi$. So you can define $\cot^{-1}(-z)$, which in this case will be: $\pi -\theta$, Now put $\theta=\cot^{-1}(z)$, Hence proved.
So coming to: $\tan^{-1}x +\tan^{-1}1/x=I$, say
So $I=\tan^{-1}x +\cot^{-1}x=\pi/2$, when $x\gt0$ [by (B)]
And $I=\tan^{-1}x +\cot^{-1}x-\pi=\pi/2-\pi=-\pi/2$, when $x \lt0$ [by (A)]
A: Here's a proof
in the case when
$x > 0$.
Draw a right triangle
with legs $1$ and $x$,
with the leg of length $x$
opposite angle $A$.
Then
$\tan(A) = x$
and
$\tan(B) = 1/x$,
so $A = \arctan(x)$
and
$B = \arctan(1/x)$.
Since $A+B = \pi/2$,
$\arctan(x)+\arctan(1/x)
= \pi/2
$.
A: An alternative proof using calculus. 
Let $f(x) = \arctan(x) + \arctan(1/x)$ for all real $x$ except $0$.
$$\frac {df(x)} {dx}= \frac{1}{x^2+1} + \frac {1}{1+1/x^2}*\frac{-1}{x^2} = \frac{1}{x^2+1} - \frac{1}{x^2+1} = 0 $$ 
Integrating on both sides we get 
$$f(x) = \arctan(x) + \arctan(1/x) = C,$$ where $C$ is a constant.
Since the function is discontinuous at $x=0$ the constant value can be different on both sides. 
It can be obtained for $x>0$ by for example setting $x=1$:
$$f(1) = \arctan(1) + \arctan(1) = \pi/4 + \pi/4 = \pi/2 $$
Similarly, for $x=-1$: 
$$f(1) = \arctan(-1) + \arctan(-1) = -\pi/4 -\pi/4 = -\pi/2 $$
So, in conclusion, $$\arctan(x) + \arctan(1/x) = \pi/2 $$ for $x>0$ 
and
$$\arctan(x) + \arctan(1/x) = -\pi/2 $$ for $x<0$.
A: Right triangle with legs $1$ and $x$, just remembering the sum of all the angles of a triangle, is $\pi$. In case of a right triangle,  $\alpha+\beta={\pi\over2}$ for any $x$.

A: You can't compute $\tan\theta$ when $\theta=\pm\frac\pi2$, but you can compute $\cos\theta$ instead. 
For $a,b\in \mathbb{R}$ with $ab\ne 1$ we have
\begin{eqnarray}
\cos^2(\arctan(a)+\arctan(b))&=&\frac{1}{1+\tan^2(\arctan(a)+\arctan(b))}=\frac{1}{1+\left(\frac{a+b}{1-ab}\right)^2}\\
&=&\frac{(1-ab)^2}{(1-ab)^2+(ab)^2}.
\end{eqnarray} 
It follows that
$$
\cos^2(f(x))=\lim_{a\to x,b\to x^{-1}}\cos^2(\arctan(a)+\arctan(b))=\lim_{a\to x,b\to x^{-1}}\frac{(1-ab)^2}{(1-ab)^2+(ab)^2}=0,
$$
i.e. $f(x)=\pm\frac\pi2$. Since $f$ is continuous on $(-\infty,0)$ and on $(0,\infty)$, we deduce that
$$
f(x)=f(-1)=2\arctan(-1)=-\frac\pi2 \quad \forall x<0,
$$
and
$$
f(x)=-f(-x)=\frac\pi2 \quad \forall x>0 
$$

Added
The function $f: x\mapsto f(x)=\arctan(x)+\arctan(x^{-1})$ defined and differentiable of $\mathbb{R}\setminus\{0\}$. For every $x\ne 0$ we have
$$
f'(x)=\dfrac{1}{1+x^2}+\dfrac{-x^{-2}}{1+x^{-2}}=\dfrac{1}{1+x^2}-\dfrac{1}{x^2+1}=0
$$
Therefore, $f$ is constant on each connected component of $\mathbb{R}\setminus\{0\}$.
Since 
$$
f(1)=2\arctan(1)=2\dfrac{\pi}{4}=\dfrac{\pi}{2},\quad f(-1)=-f(1)=-\dfrac{\pi}{2},
$$
it follows that
$$
\arctan(x)+\arctan\left(\dfrac{1}{x}\right)=\begin{cases}-\dfrac{\pi}{2} &\text{ if } x<0\\
\dfrac{\pi}{2} &\text{ if } x>0
\end{cases}.
$$
A: 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}
$$
A: The tangent function should be defined to take the value $\infty$ at $\pm\pi/2$, and this $\infty$ is neither $+\infty$ or $-\infty$, but is the $\infty$ that is approached by going either in the positive direction or the negative direction.  That makes the tangent function everywhere continuous, including continuity at $\pm\pi/2$.
If one also identifies $+\pi/2$ with $-\pi/2$ so that the domain of the tangent function is topologically a circle one of whose points is $+\pi/2=-\pi/2$, then the tangent function is one-to-one.  There is only one point in its domain that maps to $\infty$, namely $+\pi/2=-\pi/2$.
After that, there remains the question of whether the standard identity for the tangent of a sum applies when $\infty$ occurs among the values of the functions involved.  To address that we should also take $\infty$ (not $+\infty$ and not $-\infty$) to be the value of a rational function wherever it has a vertical asymptote.  This makes rational functions everywhere continuous.  Then we have
\begin{align}
\tan(\alpha+\beta) & \overset{\huge\text{?}}=\  \frac{\sin(\alpha+\beta)}{\cos(\alpha+\beta)} \tag 1 \\[10pt]
& {} = \frac{\sin\alpha\cos\beta+\cos\alpha\sin\beta}{\cos\alpha\cos\beta-\sin\alpha\sin\beta}. \tag 2
\end{align}
Notice that in $(1)$, the sine and cosine cannot both be $0$, so we need not consider what happens then.
In the standard argument, we divide both the numerator and the denominator by $\cos\alpha\cos\beta$, getting this:
$$
\frac{\sin\alpha\cos\beta+\cos\alpha\sin\beta}{\cos\alpha\cos\beta-\sin\alpha\sin\beta} = \frac{\frac{\sin\alpha}{\cos\alpha} - \frac{\sin\beta}{\cos\beta}}{1 - \frac{\sin\alpha}{\cos\alpha}\cdot\frac{\sin\beta}{\cos\beta}} \tag 3
$$
All this is valid when there are no $0$s in denominators. We need to deal with $0$s in denominators.
First consider the case in which the denominator in $(1)$ is $0$ but $\cos\alpha\ne0\ne\cos\beta$.  Then the denominator on the right side of $(3)$ is $0$. But the numerator on the right is not $0$, since the numerator on the left is not $0$; the numerator on the left side of $(3)$ cannot be $0$ since $\sin(\alpha+\beta) \ne 0$.  Hence the standard identity holds in that case.
Next consider the case where $\cos(\alpha+\beta)=0$ and $\cos\alpha=0$.  Then
$$
\frac\pi2 = - \frac\pi2 = \alpha+\beta = \frac\pi2+\beta = -\frac\pi2 + \beta
$$
and we're done.
A: Your logic is entirely correct. 
The functions $\tan^{-1} x $ and $\tan^{-1} (1/x ) $ are both odd functions.  Accordingly their additive $\tan^{-1} x + \tan^{-1} (1/x ) $ must be  odd with $ + \pi/2 $ value for positive arguments and $ - \pi/2 $ value for negative arguments.
This function results by subtracting $ \pi/2$ from the step function  0 to $\pi$ jump at x = 0  and so making it an odd function of opposite sign for arguments of opposite sign,   defining  the $ f(x) $ to be  $\pi/2 $ for $ x>0, 0$ for $ x=0 $ and $ - \pi/2 $ for $ x<0. $ 
A: Here's a fun route - suppose 
\begin{eqnarray}\arctan(p)+\arctan(q)+\arctan(r)+\arctan(s)&=\pi \\ 
\implies \arg[(1+ip)(1+iq)(1+ir)(1+is)]&=\pi \\ 
\implies p+q+r+s-pqs-pqt-qst-pst&=0\end{eqnarray}
which is solved by e.g. $(p,q,r,s)=(x,\frac{1}{x},y,\frac{1}{y})$. We can set
\begin{equation}2[\arctan(x)+\arctan(\frac{1}{x})]=\pi\end{equation}
A: Let prove that $arctan(x) + arctan(\frac{1}{x}) = \pm \frac{\pi}{2}$
You know that $arctan(x) = \theta \iff tan(\theta) =x$ for $\theta \in (-\frac{\pi}{2},\frac{\pi}{2})$
Similarly for $arctan(\frac{1}{x}) = \alpha \iff tan(\alpha) = \frac{1}{x} \iff cot(\alpha) = x$ for $\alpha \in (-\frac{\pi}{2},\frac{\pi}{2}) $
With this, you have that $tan\theta = cot\alpha$
Let prove it by cases, i.e $x > 0, x < 0$ Note that $x \neq 0 $ because $arctan(\frac{1}{x})$ will be undefined.
First case: $x > 0$
$arctan(x) \iff tan\theta = x = \frac{sin\theta}{cos\theta} > 0$, Since angles of the principal branch of $arctan$ are defined in $(-\frac{\pi}{2},\frac{\pi}{2})$, the $cos\theta$ is always positive, so the sign of $tan\theta = x$ will depend of the $sin\theta$ sign.
So, $sin\theta > 0 \iff \theta \in (0, \frac{\pi}{2})$
For $arctan(\frac{1}{x}) \iff cot(\alpha) = x$ and similarly, the sign only depends of $sin\alpha$, therefore $\alpha \in (0, \frac{\pi}{2})$
Since $cot\alpha = x = tan(\theta)$ expressing in terms of $sin, cos$ you will get that $cos(\theta + \alpha) = 0$
And you know that $cos$ will be $0 \iff \theta + \alpha = \frac{\pi}{2} \cdot k$ with $k \in \mathbb{Z}$, also $0 < \theta + \alpha < \pi$ and the unique root of $cos$ in this interval is $\frac{\pi}{2}$, therefore $\theta + \alpha = \frac{\pi}{2}$ with $x > 0$
For $x < 0$, the procedure is quite similar, but $sin\alpha, sin\theta$ are negatives. This implies that $\alpha,  \theta \in (-\frac{\pi}{2}, 0) \iff -\pi < \theta + \alpha < 0$ and therefore the unique root of $cos(\theta + \alpha)$ in this interval is equal to $-\frac{\pi}{2}$. Hence, $\theta + \alpha = -\frac{\pi}{2}$ with $x < 0$
Finally, $arctan(x) + arctan(\frac{1}{x})= sign(x) \frac{\pi}{2}$
