Equal trigonometric expressions?

I was doing $\int \frac12 \sin(2\theta)~\mathrm{d}\theta$, and got all the way to the second to last step, $-\frac{1}{4}\cos(2\,\theta\,)$. However, I don't understand the next step, which converts that expression to $-\frac{1}{2}\cos^2\,\theta$. Shouldn't there be a sine squared as well?

Also, if I plot out the two, the graphs do indeed look different. What is happening here?

(In case it matters, the original integral I was doing was $\int \sin\theta\cos\theta~\mathrm{d}\theta$, which I subsequently converted to the first integral I linked to)

-
When I plot the two, they look the same except for the constant added at the end, i.e. one of them is the other one moved vertically. Concerning your notation: when you write \cos with a backslash in TeX, it does not only prevent italicization, but also results in proper spacing, so you don't need \, before and after it. (I've edited your posting accordingly.) The same thing applies to \max, \det, \log, \exp, \tan, etc. In the case of \max, when it's in a"displayed" rather than in an "inline" setting, then subscripts are properly placed directly under "max". –  Michael Hardy Oct 7 '11 at 5:53
I thought that not including all the relevant information on the page, for example by relegating it to exterior links, was something explicitly frowned upon on this site. Every link I see here could be replaced with advantage by an explicit formula inside the post, with the possible exception of the one linking to a plot (but even for this one there are ways to include it). –  Did Oct 7 '11 at 6:20
@Didier Sorry, did not know about that. Will definitely put everything in the question next time! –  wrongusername Oct 8 '11 at 5:13
No problem. Glad to help. –  Did Oct 9 '11 at 9:22

3 Answers

Recall the double-angle trigonometric identities $$\cos(2\theta)=2\cos^2(\theta) -1=\cos^2(\theta)-\sin^2(\theta)=1-2\sin^2(\theta).$$ (We only need the first equality, but I might as well mention the other two common forms.)

It follows that $$-\frac{1}{4}\cos(2\theta)=-\frac{1}{2}\cos^2(\theta) +\frac{1}{4}.\qquad\text{(Equation 1)}$$ So your two expressions are indeed not equal.

By Equation 1, $-\frac{1}{4}\cos(2\theta)$ and $-\frac{1}{2}\cos^2(\theta)$ differ by a constant. When we are finding antiderivatives (indefinite integrals) there is always an arbitrary constant of integration.
Thus the two answers $-\frac{1}{4}\cos(2\theta)+C$ and $-\frac{1}{2}\cos^2(\theta)+C$ are both correct.

Here is a more obvious example. The result $\int 2x\,dx=x^2+C$ is correct. The result $\int 2x\,dx=x^2-\pi^3+C$ is also correct.

Comment: If we had used the identity $\cos(2\theta)=1-2\sin^2(\theta)$, we would have found in the same way that $\frac{1}{2}\sin^2(\theta)+C$ is another perfectly correct answer! It is the one I like best, no minus signs. But overall, there does not appear to be any urgent reason to fiddle with the correct $-\frac{1}{4}\cos(2\theta)+C$ that you first obtained. (Without the $+C$, all the various answers would be incorrect.)

If the original integral you were doing was, as you indicate, $\int \sin(\theta)\cos(\theta)\,d\theta$, there are two natural approaches.

1.) Use the identity $\sin(2\theta) =2\sin\theta\cos\theta$ to express the integral as $\int \frac{1}{2}\sin(2\theta)\,d\theta$. That seems to be how you approached things, and it works quickly.

2.) Note that the derivative of $\sin\theta$ is $\cos\theta$. Make the substitution $u=\sin(\theta)$. Then $du=\cos(\theta)\,d\theta$. We find that $\int \sin(\theta)\cos(\theta)\,d\theta=\int u\,du=\frac{u^2}{2}+C$. Substitute back, to get $\frac{\sin^2(\theta)}{2}+C$. This answer can be turned into various shapes by using trigonometric identities.

Or else we can start by making the substitution $v=\cos\theta$. Then $dv=-\sin(\theta)\,d\theta$, and we end up with $\int -v\,dv$.

-
Heh, I was doing this with a definite integral, so the constant does matter, and I got an incorrect answer. What did I do wrong with my integration? –  wrongusername Oct 7 '11 at 6:20
In a definite integral, the constant of integration does not matter. It is impossible to tell what went wrong if I am not told the interval of integration. That is not given in your question. Neither is the answer that you obtained. Once I know both I can tell you whether you are right, and maybe guess what went wrong otherwise. You should add to your original question, or (less satisfactorily, because comments can be cramped) leave a comment. –  André Nicolas Oct 7 '11 at 6:31
Actually, I have figured it out. I accidentally put cos 0 = 0 instead of 1. Thank you for the help! –  wrongusername Oct 8 '11 at 5:21
Good. At this stage, sometimes little numerical slips can make one doubt one's understanding. It would have been helpful to have the full question, to make diagnosis easier. But it turned out OK, since the issue of apparently different answers does come up moderately often in calculus. –  André Nicolas Oct 8 '11 at 5:31

The double angle formula gives $$\cos2\theta=\cos^2\theta-\sin^2\theta=2\cos^2\theta-1.$$ You can plug that in and subsume the extra explicit constant into the arbitrary $+C$. (It's this vertical translation that explains why the two graphs look different; they are still both primitives.)

-

If we apply $\cos 2\theta = \cos^2{\theta}-\sin^2{\theta}$ and use identity $\cos^2{\theta} +\sin^2{\theta}=1$ we get next solution:

$\frac{-1}{2}\cos^2{\theta} + \frac{1}{4} +C$ and Wolfram Alpha made substitution $C'=\frac{1}{4} +C$, which is valid since $\frac{1}{4}$ is constant, so final solution is of the form

$\frac{-1}{2}\cos^2{\theta}+C$

-