# What's wrong with the Newton-Leibniz formula?

What's wrong with the Newton-Leibniz formula? $$\int_0^\frac{3\pi}{4}\frac{\sin x}{1+\cos^2x}dx =\arctan(\sec x)|_0^\frac{3\pi}{4} =-\arctan \sqrt{2}-\frac{\pi}{4}$$. This gives a wrong answer. Where goes wrong?

• Your antiderivative is wrong. -$\arctan(\cos x)$ is the correct one.
– FDP
May 27 '19 at 7:45
• @FDP The OP's answer also works; differentiate it.
– J.G.
May 27 '19 at 7:47
• @JG: $\frac{3\pi}{4}>\frac{\pi}{2}$ and $\sec x$ doesn't exist for $x=\frac{\pi}{2}$
– FDP
May 27 '19 at 9:30

The function $$\arctan\sec x$$ has a discontinuity at $$x=\pi/2$$, because $$\sec x$$ becomes $$\infty$$ from below and $$-\infty$$ from above, and its arctangent changes discontinuously from just under $$\pi/2$$ to just over $$-\pi/2$$. If you split the integral at $$x=\pi/2$$, then add the two integrals together, it'll work out.
$$\int_0^\frac{3\pi}{4}\frac{\sin x}{1+\cos^2x}dx =-\arctan(\cos x)|_0^\frac{3\pi}{4} =-\arctan (-\sqrt{2}/2 )+\frac{\pi}{4} =\arctan (\sqrt{2}/2 )+\frac{\pi}{4}$$