A question we looked at in class:

If $f(x) = \arctan(x) + \arctan\br{\frac{1-x}{1+x}}$, find $f’(x)$. Hence, or otherwise, find a simple expression for $f(x)$.

I’m not sure if I like this question, but there’s a good deal of depth to it.

Have a go if you want to – I’ll tackle it below the line, where there be spoilers.

Option 1: brutal calculus

I don’t know the derivative of $\arctan(x)$ off the top of my head ((I should note that the student did!)), but it’s not too hard to work out.

If $y = \arctan(x)$ then $\tan(y) = x$; differentiating implicitly, $\sec^2(y) \dydx = 1$, but $\sec^2(y) = 1 + \tan^2(y)$, or $1+x^2$. Therefore $\dydx = \frac{1}{1+x^2}$.

So the first term isn’t too bad. The second term… well, yuk. The obvious options are the chain rule and some monstrous rearrangement/implicit differentiation dance that I don’t fancy. Let’s chain rule it.

We’ve got $y = \arctan(u)$, where $u = \frac{1-x}{1+x}$.

$\diff{y}{u} = \frac{1}{1+u^2}$. We could use quotient rule on $u$, but I’d sooner spot that it’s $\frac{2}{1+x} - 1$, which differentiates easily to $\diff{u}{x} = \frac{-2}{(1+x)^2}$.

So, $\dydx = \frac{1}{1+u^2}\times \frac{-2}{(1+x)^2}$, or $\frac{-2}{\br{1+u^2}\br{1+x}^2}$.

I’ve written it like that because it makes the bottom turn out nicely: $\br{1+u^2}\br{1+x}^2 = (1+x)^2 + (1-x)^2$, which is $2 + 2x^2$.

So that leads us to $\dydx = \frac{-2}{2+2x^2}$, or $\frac{-1}{1+x^2}$ for the second term.

Adding the first and second terms together gives a derivative of zero, so the function is clearly ((“Gosh! He’s using italics there! I wonder why?”)) constant, and sticking in $x=0$ gives $f(x) = \frac{\pi}{4}$.

Option 2: moderate trigonometry

Let $A=\arctan(x)$ and $B = \arctan\br{\frac{1-x}{1+x}}$, so $f(x) = A+B$.

Let $y = f(x)$, so that $\tan(y) = \tan(A+B)$.

$\tan(A+B) = \frac{\tan(A)+\tan(B)}{1-\tan(A)\tan(B)}$

But we know what $\tan(A)$ and $\tan(B)$ are!

$\tan(A+B) = \frac{x + \frac{1-x}{1+x}}{1 - x \frac{1-x}{1+x}}$. Ugh! We can simplify that.

$\dots = \frac{x(1+x) + (1-x)}{(1+x) - x(1+x)}$

$\dots = \frac{x^2 + 1}{1+x^2} = 1$.

So, $\tan(f(x)) = 1$ and $f(x)$ is clearly $\piby4$.

Option 3: simple trigonometry

$\tan\br{\piby4-t} = \frac{1-\tan(t)}{1+\tan(t)}$, so $\arctan\br{\frac{1-x}{1+x}} = \piby4 - \arctan(x)$.

$f(x) = \arctan(x) + \piby4 - \arctan(x)$, or $\piby4$.

How lovely! All three of the methods give the same answer.

Unfortunately, it’s the wrong answer

Again, have a little think and see if you can spot anywhere I’ve gone wrong. It’s a little subtle.

Did you spot it? The problem is that I’ve implicitly said that $f’(x) = 0$ everywhere – and there’s one exception to that.

When $x=-1$, $f(x)$ is undefined – the bottom of the fraction in the second term is zero, and we can’t be having that. There’s a discontinuity there.

In fact, if we put a huge negative number ($-X$) in for $x$, we get $\arctan(-X) + \arctan\br{\frac{1+X}{1-X}}$, which approaches $-\piby2 - \piby4$, or $-\frac{3}{4}\pi$ as $X \to \infty$.

The correct answer is:

\[f(x) = \begin{cases} -\frac{3}{4}\pi, & x < -1 \\\\ \text{undefined}, & x=-1 \\\\ \piby 4, & x>1 \end{cases}\]

Just when I thought it had come out nicely, it turned out gnarly after all.

Did you get it? Did you use a different approach? I’d love to hear about it in either case.