Explaining $\int_{-1}^1\frac{1}{1+x^2}\,dx = \frac{\pi}{2}$.

How would you explain to a student that $$ \int_{-1}^1\frac{1}{1+x^2}\,dx = \arctan(1) - \arctan(-1) = \frac{\pi}{2} $$ and not $$ \int_{-1}^1\frac{1}{1+x^2}\,dx = \arctan(1) - \arctan(-1) \neq \frac{\pi}{4} - \frac{3\pi}{4} = -\frac{\pi}{2}$$ besides the obvious fact that $\arctan x$ cannot map to two distinct values?


Well, you can also use the even function 'card',
i.e, since $f(x) = f(-x)$, $$ \int_{-1}^{1}\frac{1}{1+x^2}=2\int_{0}^{1}\frac{1}{1+x^2}=2(\arctan 1 +\arctan 0) = 2 \, \left(\frac{\pi}{4} \right) =\frac{\pi}{2} $$


We are actually using the substitution $x=\tan\theta$.

$$ \int_{-1}^1\frac{1}{1+x^2}dx=\int_{\frac{-\pi}{4}}^{\frac{\pi}{4}} \left(\frac{1}{1+\tan^2\theta}\right)(\sec^2\theta)d\theta=\int_{\frac{-\pi}{4}}^{\frac{\pi}{4}} d\theta=\frac{\pi}{2}$$

We take the $\displaystyle \theta\in\left(-\frac{\pi}{2},\frac{\pi}{2}\right)$ as $\tan\theta$ is differentiable in the range.

If we want to take $\displaystyle \theta=\frac{3\pi}{4}$, the interval cannot be $\displaystyle \left(\frac{\pi}{4},\frac{3\pi}{4}\right)$ as $\displaystyle \tan\frac{\pi}{2}$ does not exist.

We have to break down the interval as $\displaystyle \left(\frac{3\pi}{4},2\pi\right)$ and $\displaystyle \left(0,\frac{\pi}{4}\right)$ to avoid the trouble.

\begin{align*} \int_{-1}^1\frac{1}{1+x^2}dx&=\int_{-1}^0\frac{1}{1+x^2}dx+\int_0^1\frac{1}{1+x^2}dx\\ &=\int_{\frac{3\pi}{4}}^{2\pi}d\theta+\int_0^{\frac{\pi}{4}}d\theta\\ &=\frac{\pi}{4}+\frac{\pi}{4}\\ &=\frac{\pi}{2} \end{align*}


When we write $\arctan$ we usually mean the inverse of $\tan\colon (-\pi/2,\pi/2)\to \mathbb R$.

This is, of course, an arbitrary choice. When explaining it to students, I would compare it to inverting $x\mapsto x^2$. Non-injectivity (and continuity) forces us to consider two different maps, one defined on non-negative and the other on non-positive reals with their inverses denoted by $\sqrt x$ and $-\sqrt x$.

Analogously, one can define $\tan_k\colon (-\pi/2 + k\pi,\pi/2 +k\pi)\to \mathbb R$ and their corresponding inverses $\arctan_k\colon\mathbb R\to (-\pi/2 + k\pi,\pi/2 +k\pi)$. For each of them, it is easy to show that $\arctan_k'x=\frac 1{1+x^2}$, since they differ by a constant. Thus, all $\arctan_k$ are primitive functions of $\frac 1{1+x^2}$. Note that you can't mix different branches to make another primitive function because primitive function needs to be differentiable, and mixing would make it not even continuous.

Now, the fundamental theorem of calculus tells us that $\int_a^b f(x)\,dx = F(b)-F(a)$ for some primitive function $F$. In no way does it even insinuate that you could calculate the above integral as $F(b)-G(a)$ for distinct primitive functions of $f$.

Finally, writing $$ \int_{-1}^1\frac{1}{1+x^2}\,dx = \arctan(1) - \arctan(-1) = \frac{\pi}{4} - \frac{3\pi}{4} = -\frac{\pi}{2}$$ would be an error of the kind described in the previous paragraph.