# Quick integral question

1. Dec 12, 2009

### iamsmooth

1. The problem statement, all variables and given/known data
$$\int \! \cos^2xdx$$

3. The attempt at a solution
Letting u = x2 and du/dx = 2x

To get 2x in to the integral, I multiply the outside by 1/2x?
$$\frac{1}{2x} \int \! \cos (u) du$$

$$\frac{1}{2x} \sin (x^2) 2x + C$$

Even if I play around with this, I don't get anywhere near the correct answer, which is:

$$\frac{1}{2}x + \frac{1}{4}\sin (2x) + C$$

2. Dec 12, 2009

### tiny-tim

Hi iamsmooth!

(try using the X2 tag just above the Reply box )
Yes, you're confusing (cosx)2 with cos(x2)

Try again, first using one of the standard trigonometric identities to get cos2x = a function of cos(2x) or sin(2x).

3. Dec 12, 2009

### iamsmooth

Oh man, I'm an idiot... anyways...

Trying with integration by parts (failing miserably):

$$\int \cos^2dx$$

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

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

$$= x(\cos^2x-sin^2x) = x(\cos2x)$$

Nope, still not getting anywhere.

4. Dec 12, 2009

### tiny-tim

Hi iamsmooth!

No, the integral should be 2xcosxsinx …

anyway, you can see that using v = x just makes it more complicated.

If you must use integration by parts, use v = cosx, but my idea of rewriting cos2x first is much easier.

5. Dec 12, 2009

### iamsmooth

Do you mean to rewrite it as:

$$\int \cos 2x + \sin^2x dx$$

I can see that in this case cosx can be the derivative of sinx, does that mean I can use u-substitution and reverse chainrule this? I'm still unsure of how to tackle integrals. Like I know there's all these different ways of solving them, but I'm not sure how to identify what the situation is and thus know which method to use.

From what I would do:
1) If you see an expression and its derivative, use substitution
2) If you see polynomial, just use reverse derivative rules
3) Parts integration when all else fails?

Last edited: Dec 12, 2009
6. Dec 12, 2009

### tiny-tim

Hi iamsmooth!

To pass your exams, you really must learn your trigonometric identities …

in this case, cos2x = 1/2 (1 + cos(2x))

7. Dec 12, 2009

### iamsmooth

How do you derive that equation from trig identities?

$$cos^2x\,+\,sin^2x\,=\,1$$

If I manipulate this, I get cos2x = 1 - sin2x which is way wrong I guess :(

I vaguely know trig identities, but I guess I'm really rusty on them... Am I supposed to just commit all of the stuff on this page: ( https://www.physicsforums.com/library.php?do=view_item&itemid=18 ) to memory?

As you can see, I guess I wrongly tried to change this:

$$\cos^2x\,-\,\sin^2x\,=\,\cos2x$$

into

$$\cos^2x = \cos 2x + \sin^2x dx$$

Is there an easier trick for memorizing trig identities so I can derive them when I need them?

8. Dec 12, 2009

### tiny-tim

Hi iamsmooth!
cos2x + sin2x = 1
cos2x - sin2x = cos2x​
2cos2x = 1 + cos2x​
subtract:
2sin2x = 1 - cos2x
Sorry, but you do need to memorise all of them except the last four.

The last four are too difficult to remember, but when needed you can work them out as follows …

Sum or difference of sin always has a cos and a sin, just as in sin(A±B).

Sum or difference of cos always has two coses or two sines, just as in cos(A±B).

And a sum doesn't depend on the order, so it has to have cos the difference, which also doesn't; while a difference does, so it has to have sin the difference, which also does.

9. Dec 12, 2009

### iamsmooth

I'll start trying to remember them then.

Anyways this is what I have:

$$\int \cos^2xdx = \int \frac{1+\cos 2x}{2}dx$$

Letting:
$$u = 2x, du = 2dx, \frac{1}{2}du = dx$$

$$\int 1 + \cos (u) \frac{1}{2}du$$

$$= \frac{1}{2} \int 1 + \cos (u) du$$

$$= \frac{1}{2} [ x + \sin 2x ] + K$$

$$= \frac{x}{2} + \frac{\sin(2x)}{2} + K$$

I'm close to the right answer, but the second term should be $$\frac{\sin(2x)}{4}$$, where did I mess up? If I raise the u inside the cose by 1 exponent and divide, I get 1/4 but the exponent remains... not sure what's wrong here.

Thanks.

10. Dec 12, 2009

### tiny-tim

Hi iamsmooth!

You messed up twice
You've left out the 2 in the original denominator.
And you've left out a whole line, which is a really bad idea, especially since in this case you've made a mistake in the process …

the integral of 1du is u (=2x), not x.

11. Dec 12, 2009

### iamsmooth

$$\int \cos^2xdx = \int \frac{1+\cos 2x}{2}dx = \int (\frac{\cos2x}{2}+\frac{1}{2})dx$$

I was trying to group the +1/2 with the dx to remove it, but I guess you can't do that. Why is the integral of du = 2x?

I let u = 2x, so the derivative would be du/dx = 2, which would make du = 2dx. I understand 2x would be the correct answer since the math works out, but I don't seem to be getting that for some reason.

Is it the $+\frac{1}{2}$ term that becomes 2x? I got 1 = x (without denominator) because I just took the antiderivative.

Last edited: Dec 12, 2009
12. Dec 13, 2009

### tiny-tim

Hi iamsmooth!

(just got up :zzz: …)
Yes, du = 2dx.

Now integrate that … ∫du = ∫2dx, which is the same as ∫du = 2x (+ constant).

I can't help feeling that if you wrote it out with the missing line inserted, you'd automatically get the right answer.

13. Dec 14, 2009

### iamsmooth

Okay, I think I got this:

$$\int \cos^2xdx = \int \frac{1+\cos 2x}{2}dx = \int (\frac{\cos2x}{2}+\frac{1}{2})dx$$

Moving the 1/2 to the side:
$$\frac{1}{2} \int \cos2x + 1$$

Now keeping in mind that u = 2x, du = 2dx, 2du = dx, I can do the substitution:
$$\frac{1}{4} \int \cos(u) + 2du$$
(Placing another 1/2 to the left of the integral to balance out the 2du)

Now evaluating the integral:
$$\frac{1}{4}\sin(u) + 2x$$

Subbing back in the value of u, and simplifying:
$$\frac{\sin(2x)}{4} + \frac{x}{2}$$

I hope that's right. I just wasn't sure if the way I inserted the 2du was a legal move. Appreciate all the help, tiny-tim :D

14. Dec 14, 2009

### tiny-tim

Yes, that's ok, except

i] about half-way down you got bored, and started leaving out the dx or du …

you must keep them in …

an ∫ is meaningless without a d(something) after it (and you'll lose marks in the exam unless the examiner thinks it's a typo), and if you keep them in you're much less likely to make a mistake (eg a factor of 2) when you change variables

ii] you never needed to substitute for the ∫ 1/2 dx, did you?

iii] don't say "keeping in mind" … say "putting (or "let") u = 2x, du = 2dx"

So the whole thing should look like:

∫cos2x dx

= ∫(1 + cos2x)/2 dx

putting u = 2x. du = 2dx,

= x/2 + constant + ∫ 1/4 cosu du

= x/2 + constant + 1/4 sinu

= x/2 + 1/4 sin2x + constant