1. Oct 5, 2014

### cqfd

I am encountering a paradox when calculating the integral $\int sin(x)\cos(x)\,dx$ with integration by parts:

Defining $u = sin(x), v' = cos(x)$:

$\int sin(x)cos(x) dx = sin^2(x) - \int cos(x) sin(x) dx$

$\Leftrightarrow \int sin(x) * cos(x) dx = +1/2*sin^2(x)$.

On the other hand, defining $u = cos(x), v' = sin(x)$:

$\int sin(x)cos(x) dx = -cos^2(x) - \int cos(x) sin(x) dx$

$\Leftrightarrow \int sin(x) * cos(x) dx = -1/2*cos^2(x)$.

$1/2*sin^2(x) \neq -1/2*cos^2(x)$, and I know that the second one is the correct one. But I can't find an error in my upper calculation. Does somebody see the error I made?

Thanks!

2. Oct 5, 2014

### ShayanJ

$\frac 1 2 \sin^2 x=\frac 1 2 (1-\cos^2 x)=-\frac 1 2 \cos^2 x + \frac 1 2=-\frac 1 2 \cos^2 x + const$.
So they are equivalent solutions for the integral!

3. Oct 5, 2014

### cqfd

Oh, ok. So there's just a constant offset between the two solutions that we do not care about. :)

4. Oct 5, 2014

### gopher_p

The correct version of your first solution is that $\int\sin x\cos x\ dx=\frac{1}{2}\sin x+C$, where $\frac{1}{2}\sin^2 x+C$ indicates the family of functions which differ from $\frac{1}{2}\sin x$ by a constant. $\frac{1}{2}\sin^2 x$ is a member of that family, as is $-\frac{1}{2}\cos^2 x$. $-\frac{1}{4}\cos 2x$, the "representative" you would have found if you had used the trig identity $\sin x\cos x=\frac{1}{2}\sin 2x$, is also a member of that family.

When you see a problem that asks you to compute $\int f(x)\ dx$, it is essentially asking you to find all of the functions $g$ satisfying $\frac{dg}{dx}=f(x)$. There's a theorem that says that any two functions $g_1$ and $g_2$ satisfying $g_1'=g_2'$ on an interval differ only by a constant on that interval. and so to answer the question of what is $\int f(x)\ dx$, we need only find one function $g$ satisfying $\frac{dg}{dx}=f(x)$ (which I called a "representative" earlier), and every other function $\tilde{g}$ satisfying $\frac{d\tilde{g}}{dx}=f(x)$ is of the form $\tilde{g}(x)=g(x)+c$ for some constant $c$.

Now you can either understand all of that, or you can just know that you can't forget the $+C$ when you're doing indefinite integral. Most students learning this stuff for the first time chose the latter, although the former is not particular hard to wrap your head around. The bottom line is that we do care about the "constant offset", and it most definitely does matter.