Evaluating $\int _{-\pi}^{\pi}x^2cos(nx)dx $

398 Views Asked by At

Hello I'm trying to evaluate $$\int_{-\pi}^{\pi} x^2\cos(nx)dx$$

I understand you have to apply integration by parts twice but I always get zero and I know this is wrong.

I always end up with $$-\int_{-\pi}^{\pi} \frac{2x\sin(nx)}{n} dx$$ which when integrated by parts again just gives me zero. Is there something I'm doing wrong?

1

There are 1 best solutions below

4
On BEST ANSWER

Check your integration by parts again. You should get $$\int_\ x^2\cos(nx)dx = \frac{x^2\sin(nx)}{n}+\frac{2x\cos(nx)}{n^2}-\frac{2\sin(nx)}{n^3}$$