Studying the derivative of the integral function $\frac{1}{x}\int_0^x\arctan(e^t)\mathrm{d}t$

I was trying to calculate the derivative of the function $$F(x) =\frac{1}{x}\int_0^x\arctan(e^t)\mathrm{d}t$$ I thought the fastest way was to use the Leibniz's rule for the derivative of a product, $$(f\cdot g)' = f'g + g'f$$ and, choosing as $f(x) = \frac{1}{x}$ and as $g(x) = \int_0^x\arctan(e^t)\mathrm{d}t$, applying for the second one's derivative the fundamental theorem of calculus, I obtained $$-\frac{1}{x^2}\int_0^x\arctan(e^t)\mathrm{d}t + \frac{1}{x}\left[\arctan(e^t)\right]\Bigg|_{t = 0}^{t = x} = -\frac{1}{x^2}\int_0^x\arctan(e^t)\mathrm{d}t + \frac{1}{x}\left[\arctan(e^x)-\frac{\pi}{4}\right]$$ Now there come the problems, since I don't know how to evaluate the limit as $x\rightarrow0$ for the first term of the expression, while the second one, as $x\rightarrow0$, $g'(x)f(x)\rightarrow\frac{1}{2}$. So I plotted the whole thing and I saw something very strange:

The blue one is the function (which is right), the red one it's the derivative as calculated before. As you can notice looks like the derivative have a discontinuity in the point 0, while looking at the graph of the function $F(x)$ one would say that there's not such a discontinuity. I tried to evaluate the whole thing with Mathematica, but I did not solve the problem: there are strange things happening at the origin.

Now, there are two possibilities:

1. The derivative is wrong, but I wonder where, as it's so simple and linear
2. Grapher app from Mac OS X cannot handle with such functions in a proper way

Can you find out the bug?

• Are you sure the blue graph (of $F$) is correct? One of the factors of $F(x)$ is $1/x$ which does have a discontinuity at $x=0$. Commented Jun 5, 2017 at 20:01
• Shouldn't $d/dx \int_0^x \arctan (e^t) dt = \arctan (e^x)$? Commented Jun 5, 2017 at 20:03
• You have a factor of $\pi/4$ that doesn't belong, giving you the singularity. Commented Jun 5, 2017 at 20:04
• you have a mistake in the last part, it should be $0$ instead of $\frac { \pi }{ 4 }$ you forgot derivatives of boundry functions Commented Jun 5, 2017 at 20:04
• Ok, but apart the factor $\pi/4$ the discontinuity depends on the $-1/x^2 * I$, where $I$ is the integral function $g(x)$... Commented Jun 5, 2017 at 20:48

With your notation $$g(x)=\int_0^x\arctan(e^t)\,dt$$ we have $$F'(x)=\frac{xg'(x) - g(x)}{x^2}=\frac{x\arctan(e^x)-g(x)}{x^2}$$ for $x\ne0$. On the other hand, the function $F$ can be extended by continuity at $0$ as $$\lim_{x\to0}F(x)=\frac{\pi}{4}$$ and $$\lim_{x\to0}F'(x)= \lim_{x\to0}\frac{1}{2x}\frac{xe^x}{1+e^{2x}}=\frac{1}{4}$$ so $F$ (extended) is also differentiable at $0$.

I used l’Hôpital for both limits.

The bug in your argument is that you wrongly do $$\frac{d}{dx} g(x) = \Bigl[ \arctan(e^t)\Bigr]_{t=0}^{t=x}$$ instead of $$\frac{d}{dx}g (x) =\arctan(e^x)$$ according to the fundamental theorem of calculus.

• Yes, this was kind of stupid mistake... Anyway beyond is the derivative $-\frac{1}{x^2}\int_0^x\arctan(e^t)\mathrm{d}t + \frac{1}{x}\left[\arctan(e^x)\right]$ is right as well as your derivative that you get with the derivative of a function quotient rule $\frac{g(x)}{f(x)}$? Are the solution the same? Commented Jun 5, 2017 at 21:06
• @opisthofulax Product rule and quotient rule give the same answer. Commented Jun 5, 2017 at 21:07
• Yes I know they give the same result, but our results are different (we have the + and the - inverted, you have $-\frac{1}{x}g(x)$ and $+\frac{1}{x^2}g(x)$ I have the opposite) so I was wondering if someone of we two has make a mistake in the derivative... Commented Jun 5, 2017 at 21:22
• ok looks like you've inverted the signs applying the derivative rule for a quotient function, then our two results match perfectly. Thanks for your advices and for your help, sorry it was only a stupid mistake! Commented Jun 5, 2017 at 21:31
• @opisthofulax Everybody makes stupid mistakes, as you saw! ;-) Thanks for the edit. Commented Jun 5, 2017 at 21:40

So the "bug" was in the application of the foundamental theorem of calculus in which does not appear the derivative calculated at the starting point, so that the right derivative is $$-\frac{1}{x^2}\int_0^x\arctan(e^t)\mathrm{d}t + \frac{1}{x}\left[\arctan(e^t)\right]\Bigg|_{t = 0}^{t = x} = -\frac{1}{x^2}\int_0^x\arctan(e^t)\mathrm{d}t + \frac{1}{x}\left[\arctan(e^x)\right]$$

which is the red function in the graph below