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?