Trig integral $\int{ \cos{x} + \sin{x}\cos{x} dx }$

Assume we have:

$\int{ \cos{x} + \sin{x}\cos{x} dx }$

2 ways to do it:

Use $\sin{x}\cos{x} = \frac{ \sin{2x} }{2}$

Then $\int{ \cos{x} + \frac{\sin{2x}}{2} dx }$

$= \sin{x} - \frac{ cos{2x} }{ 4 } + C$

Or the other way, just see that $u = \sin(x), du = \cos(x)dx$

$\int{ \cos{x} + \sin{x}\cos{x} dx }$

$= \sin{x} + \frac{\sin^2{x}}{2} + C$

Now the part I don't see fully is, why aren't these results completely equal?

Taking the 2nd result,

$\sin{x} + \frac{\sin^2{x}}{2}$

$= \sin{x} + \frac{1}{2} ( \frac{1 - cos{2x}}{2} )$

$= \sin{x} + \frac{1}{4} - \frac{\cos{2x}}{4}$

So you have to absorb $\frac{1}{4}$ into C for them to be equal.

Shouldn't they be equal straight away?

-
Why should the two $C$'s be equal? (Ceci n'est pas cette 'c'!) When dealing with indefinite integrals, what's important is that you end up with two expressions with identical derivatives, which in this case they are. – Willie Wong Apr 15 '11 at 18:56

Your question boils down to this:

If $\int f(x) dx = F(x) + C$ and $\int f(x) dx = G(x) +C$ are both correct, then shouldn't it be true that $F(x)=G(x)$?

The answer is no. $\int f(x)dx=F(x) +C$ means that (on the relevant interval, in this case all of $\mathbb{R}$) every antiderivative of $f(x)$ has the form $F(x)+C$ for some constant $C$. The indefinite integral is really referring to a set of functions, namely all of the functions (on the relevant interval) whose derivatives equal $f(x)$. If $F'(x)=f(x)$, then that set can be written as $\{F(x)+C:C\in \mathbb{R}\}$. But the set of functions of the form $F(x)+C$ for some constant $C$ is precisely the same as the set of functions of the form $F(x)+22+C$ for some constant $C$, for instance. Explicitly, $\{F(x)+C:C\in\mathbb{R}\}=\{F(x)+22+C:C\in\mathbb{R}\}$. That is, if $F(x)$ and $G(x)$ only differ by a constant and $F(x)$ is an antiderivative of $f(x)$, then $\int f(x)dx=G(x)+C$ is also correct.

-
Ran into an even more illustrative one: $\int{ \frac{ -2x }{ (1+x^2)^2 } } dx$ becomes either $\frac { -x^2 }{ 1 + x^2 }$ or $\frac{ 1 }{ 1 + x^2 }$. Both work. – bobobobo Apr 21 '11 at 22:53
@bobobobo: Good example. If you have $\frac{f(x)}{g(x)}$ where $f$ and $g$ are polynomials of the same degree, then polynomial division gives you $k+\frac{r(x)}{g(x)}$ where $k$ is constant and $r$ has lower degree than $g$. Thus $\frac{r(x)}{g(x)}$ and $\frac{f(x)}{g(x)}$ have the same derivative. – Jonas Meyer Apr 22 '11 at 15:36

If you write

$\int{ \cos{x} + \frac{\sin{2x}}{2} dx }=\sin{x} - \frac{ cos{2x} }{ 4 } + C_1$

and

$\int{ \cos{x} + \sin{x}\cos{x} dx }= \sin{x} + \frac{\sin^2{x}}{2} + C_2$,

then you can see what's going on with the constants in your two cases($C_1$ and $C_2$). Being careful with choosing the notation is good for understanding.

-