method to solve an integral.

Vali

Junior Member
Joined
Feb 27, 2018
Messages
87
\(\displaystyle \int_{0}^{2\pi }cos^{2}(nx)dx\)
Why If I solve the integral by parts I get an answer and if I solve by using formula I get another answer.What's wrong ?
By parts:
I take f(x)=cos^2(nx) so f'(x)=-nsin(2nx) and g'(x)=1 so g(x)=x
I obtain \(\displaystyle xcos^{2}(nx) +n\int_{0}^{2\pi }sin(2nx)dx\)
The second integral is 0 and when I replace in the first part with 0 and 2pi I get 2pi-0=2pi

On the other hand, if I use the formula cos^2(x)=(1+cos2x)/2 and integrate I get the response pi which is the right answer.
Why solving by parts doesn't work ?
 
After applying IBP, you would have:

[MATH]I=\left[x\cos^2(nx)\right]_0^{2\pi}+n\int_0^{2\pi} x\sin(2nx)\,dx[/MATH]
This reduces to:

[MATH]I=2\pi+n\int_0^{2\pi} x\sin(2nx)\,dx[/MATH]
Now, if we apply IBP again, where:

[MATH]u=x\implies du=dx[/MATH]
[MATH]dv=\sin(2nx)\,dx\implies v=-\frac{1}{2n}\cos(2nx)[/MATH]
We then have:

[MATH]I=2\pi+n\left(\left[-\frac{x}{2n}\cos(2nx)\right]_0^{2\pi}+\frac{1}{2n}\int_0^{2\pi}\cos(2nx)\,dx\right)[/MATH]
[MATH]I=2\pi+\frac{1}{2}\left(\left[-x\cos(2nx)\right]_0^{2\pi}+\int_0^{2\pi}\cos(2nx)\,dx\right)[/MATH]
[MATH]I=2\pi+\frac{1}{2}\left(-2\pi+0\right)=2\pi-\pi=\pi\quad\checkmark[/MATH]
 
\(\displaystyle \int_{0}^{2\pi }cos^{2}(nx)dx\)
Why If I solve the integral by parts I get an answer and if I solve by using formula I get another answer.What's wrong ?
By parts:
I take f(x)=cos^2(nx) so f'(x)=-nsin(2nx) and g'(x)=1 so g(x)=x
I obtain \(\displaystyle xcos^{2}(nx) +n\int_{0}^{2\pi }sin(2nx)dx\)
The second integral is 0 and when I replace in the first part with 0 and 2pi I get 2pi-0=2pi

On the other hand, if I use the formula cos^2(x)=(1+cos2x)/2 and integrate I get the response pi which is the right answer.
Why solving by parts doesn't work ?
That is correct!

f(x) = cos2(nx)

f'(x) = 2 * cos(nx) * [-sin(nx)] * n = -2 * n * cos(nx) * sin(nx) = - n * sin(2nx)
 
I got the same result like you.I don't understand what's wrong with f'(x)
Thank you for your help :)
 
Last edited:
Top