# Cosine series of $x^3$

After constructing an even extension, and evaluating over $-\pi \le x \le \pi$ $$\frac \pi2a_n=\int_0^\pi x^3\cos nx\ dx$$

Now I've tried to solve this, I wish I had the skills and the patience to mathjax-ify my steps here but it'll be too much to do. I'll write my result after evaluating the integral at least:

$$a_n = \frac{2(3(\pi^2n^2-2)\cos(\pi n) +6)}{\pi n^4}$$

Now I tried to use the fact that $\cos n\pi$ follows a pattern, but I still couldn't get it to match the answer I'm expected to derive (which is again, beyond my mathjax skills). It's a cosine series where $0\le x \le \pi$. I'm way off, not even close.

So yeah, basically I'm asking for some tips on how to proceed from here. If possible, a full solution would be brilliant so that I can once and for all understand such problems.

EDIT: Here's the answer I'm supposed to get:

-
Is the problem with "understanding" or with computing horrible integrals? Basically it sounds like you understand what to do, but are having trouble getting all the details of the integral right. Can you point out more specifically what you don't "understand" as you claim? –  Matt Dec 4 '12 at 20:15
Also, your answer is correct according to Wolfram Alpha. You could replace $\cos(\pi n)=(-1)^n$, but I don't see what more anyone could add here. If you really did this by hand and got this answer, then you will get full credit for the problem (assuming this is homework). –  Matt Dec 4 '12 at 20:22
Not homework specifically, just practicing for an exam. Actually we're supposed to 'show that' the cosine series is equal to some particular series they've shown. I'm not able to get it into that form. I'll put that required series in the answer. –  caughtinalandslide Dec 4 '12 at 20:37
We're probably supposed to divide $a_n$ into $a_{2m}$ and $a_{2m-1}$ and then proceed, but I'm still not able to get in the form required. –  caughtinalandslide Dec 4 '12 at 20:50
I know it's not my place to judge, but honestly attempting to break your answer into some neat, clever form (if that form above could be consider better at all) will be a total waste of time on an exam. Get the right answer and move on. Spend your time on the content of the problems where the points come from and not on some superficial detail like this. If your teacher takes off for something like this, then they aren't a good teacher. –  Matt Dec 4 '12 at 23:04
$$a_n=\frac{2(3(\pi^2n^2-2)\cos(\pi n) +6)}{\pi n^4}=\frac{6\pi^2n^2\cos(n\pi)}{\pi n^4}+\frac{12-12\cos(n\pi)}{\pi n^4}$$
Since $\cos(n\pi)=(-1)^n$, the right term is $0$ for $n$ even and $24/\pi n^4$ when $n$ is odd.