# Different function with the same derivative

Today at school I entered in a problem when the professor asked us to differentiate the following function:

$$f(x)=\arctan\left(\frac {x-1}{x+1}\right)$$

With the basic rules of differentiation I came to a confusing result:

$$f'(x)=\frac 1{1+x^2}$$

And the teacher agreed, and so does Wolfram (I checked at home) but what surprised me is that it's the same derivative as

$$f(x)=\arctan x$$ $$f'(x)=\frac 1{1+x^2}$$

So I'm wondering: is that wrong in some sense ? Are the two function equals indeed ? If I integrate $\frac 1{1+x^2}$ what should I choose from the two ? Are there any other examples of different functions with the same derivative?

• What's the derivative of $f(x)=x^2+1$ and of $g(x)=x^2$? Dec 3 '15 at 13:47
• This is a matter of constants, my case is pretty different. @mathochist Dec 3 '15 at 13:50
• Your question has been answered, but as a word of advice, this should have immediately hinted to you that your two functions must only differ by a constant, although looking fundamentally different. In your case, if you do the calculations, you'll see that your constant is $\frac{\pi}{4}$. Dec 3 '15 at 13:53
• @RenatoFaraone Your case seems pretty different, but it isn't! Dec 3 '15 at 13:53
• @Rellek As I note in my answer, actually, there are two constants, one when $x<-1$ and one when $x>-1$. Dec 3 '15 at 13:55

Note:

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

If $x=\tan A$ and $\tan B=1$, then you get:

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

So $$\arctan x - B = \arctan\left(\frac{x-1}{x+1}\right)$$ So the functions differ by a constant.

(Well, close enough - they actually differ by a constant locally, wherever both functions are defined. The differences will be constant in $(-\infty,-1)$ and in $(-1,\infty)$, but not necessarily the entire real line.)

• @AdityaAgarwal $x=\tan A$ so $A=\arctan x$. But yes, some care is needed to pick $A$. Dec 3 '15 at 13:51

Are you surprised from $3-2=10-9$? ;-) I guess you aren't.

Are you surprised from the fact that $f(x)=x^2$ and $g(x)=x^2+1$ have the same derivative? Not at all, I believe.

The same holds in this case, and it's not the only one! For instance, $f(x)=\arcsin x$ and $g(x)=-\arccos x$ have the same derivative! Also $f(x)=\log x$ and $g(x)=\log(3x)$ do.

The conclusion you can draw is that the two functions differ by a constant on each interval where they are both defined. Since $\arctan\frac{x-1}{x+1}$ is defined for $x\ne-1$, you know that there exist constants $h$ and $k$ such that $$\begin{cases} \arctan\dfrac{x-1}{x+1}=h+\arctan x & \text{for x<-1}\\[12px] \arctan\dfrac{x-1}{x+1}=k+\arctan x & \text{for x>-1} \end{cases}$$

You can now compute $h$ and $k$, by evaluating the limit at $-\infty$ and at $\infty$: $$\frac{\pi}{4}=\lim_{x\to-\infty}\arctan\dfrac{x-1}{x+1}= \lim_{x\to-\infty}(h+\arctan x)=h-\frac{\pi}{2}$$ and $$\frac{\pi}{4}=\lim_{x\to\infty}\arctan\dfrac{x-1}{x+1}= \lim_{x\to\infty}(k+\arctan x)=k+\frac{\pi}{2}$$