TITLE: Integration by parts: "math is broken"
QUESTION [5 upvotes]: just trying to solve a small example on integration by parts, and a weird thing happens: I come to an original expression increased by one. Please help me find out where the flaw is!
The task is to calculate the following indefinite integral:
$$
\int\tan^{-1}x\text{d}x
$$
Integration by parts formula (just in case):
$$
\int f(x)g'(x)dx = f(x)g(x) - \int f'(x)g(x)\text{d}x
$$
Let's expand our original integral:
$$
\int\tan^{-1}x\text{d}x = \int\cos x \sin^{-1}x\text{d}x
$$
If
$$
f(x) = \sin^{-1}x
$$
$$
g'(x) = \cos x
$$
then
$$
f'(x) = -\sin^{-2}x\cos x
$$
$$
g(x) = \sin x
$$
Applying integration by parts formula:
$$
\int\cos x \sin^{-1}x\text{d}x = \sin^{-1}x\sin x - \int-\sin^{-2}x\cos x\sin x\text{d}x = 1 + \int\tan^{-1}x\text{d}x 
$$
So, where have I made a mistake?

REPLY [25 votes]: You haven't made a mistake.
Remember how integrals have " ${}+C$ " at the end? This is why. The ${}+C$ 'absorbs' all constants together into an unknown constant. Indefinite integrals don't give you a single function: they give you a set of functions that differ by a constant.

REPLY [6 votes]: So, $\tan^{-1}(x)$ is not equal to $\dfrac{1}{\tan(x)}$. Instead, that is $\cot(x)$.
For the integration by parts, let $u=\tan^{-1}(x)$ and $dv=1\quad\!\!\!\!dx$
Remember that the formula is $uv-\int vdu$