Integral of $\sin x \cos x$ using two methods differs by a constant? [duplicate]
$$ \int \sin \theta\cos \theta~d \theta= \int \frac {1} 2 \sin 2\theta~ d \theta=-\frac {1} 4 \cos 2\theta$$ But, if I let $$ u=\sin \theta , \text{ then }du=\cos \theta~d\theta $$ Then $$ \int \sin \theta\cos \theta~d \theta= \int u ~ du =\frac { u^2 } 2 =\frac {1} 2 \sin^2 \theta $$ Since $$ \sin^2 \theta =\frac {1} 2 - \frac {1} 2 \cos 2\theta$$ The above can be written as $$ \int \sin \theta\cos \theta~d \theta= \frac {1} 2 \sin^2 \theta =\frac {1} 2 \left( \frac {1} 2 - \frac {1} 2 \cos 2\theta \right)=\frac {1} 4-\frac {1} 4 \cos 2\theta $$ Why are the two results differ by the constant $1/4$? Thank you.
Solution 1:
The answer to the indefinite integration is the family of functions, which differ by a constant on every connected area of the domain.
That is, the correct way to write the answer to $\int f(x)dx$ (where $f$ is defined on a continuous area) is $g(x) + C$.
Note that $C-\dfrac{1}{4}\cos{2\theta}$ defines the same family of functions as $C+\dfrac{1}{4}-\dfrac{1}{4}\cos{2\theta}$.