f(x) = cosax between pi and -pi and a is a constant
can find the an coefficent to be (sin(n+a)x)/(n+a) + (sin(n-a)x)/(n-a) but cant get any further.
This makes no sense. The coefficient can't be a function of x. Did you forget to evaluate at $\displaystyle \pi$ and $\displaystyle -\pi$?
cos(ax) is an even function- it will have no "sin(nx)" terms in it. The coefficient of cos(nx) will be
$\displaystyle \frac{1}{\pi}\int_{-\pi}^{\pi} cos(ax) cos(nx) dx=$$\displaystyle \frac{1}{2\pi}\left(\int_{-\pi}^\pi cos((n+a)x)dx+ \int_{-\pi}^\pi cos(n- a)x dx\right)$
for n> 0.
The n= 0 term is $\displaystyle \frac{1}{2\pi}\int_{-pi}^{\pi} cos(ax)dx$.
As I said above, all coefficients of "sin(nx)" will be 0.
You can also use by-parts here.
$\displaystyle C_n= \frac{1}{\pi}\int_{-\pi}^{\pi} cos(ax) cos(nx) dx $
$\displaystyle U = cos(ax) $ and $\displaystyle dV = cos(nx)dx $
$\displaystyle du = -asin(ax) $ and $\displaystyle V= \frac{ sin(nx) }{n} $
$\displaystyle \frac{1}{\pi}\int_{-\pi}^{\pi} cos(ax) cos(nx) dx = \frac{a}{\pi} [ \frac{ sin(nx)cos(ax) }{n} + \frac{a}{n} \int_{-\pi}^{\pi} sin(ax)sin(nx) dx] $
$\displaystyle \frac{a^2}{n \pi} [ \int_{-\pi}^{\pi} sin(ax)sin(nx) dx] $
$\displaystyle U = sin(ax) $ and $\displaystyle dV = sin(nx) dx $
$\displaystyle du = acos(ax) $ and $\displaystyle V= - \frac{ cos(nx) }{n} $
$\displaystyle \frac{a^2}{n \pi} [ \int_{-\pi}^{\pi} sin(ax)sin(nx) dx] = \frac{a^2}{n \pi} [ -\frac{ cos(nx)sin(ax) }{n} + \frac{1}{n} \int_{-\pi}^{\pi} cos(ax)cos(nx)dx ] $
$\displaystyle
C_n = \frac{a^2}{n \pi} [ -( \frac{ (-1)^n sin(a \pi ) }{n} - \frac{ (-1)^n sin(- a \pi ) }{n} ) + \frac{ \pi }{n} C_n] $
$\displaystyle
C_n = \frac{a^2}{n^2 \pi} [ -2 (-1)^n sin(a \pi ) + \pi C_n] $
$\displaystyle C_n (1 - \frac{a^2}{n^2} ) = -2 (-1)^n sin(a \pi ) $
$\displaystyle C_n = - \frac{ 2 (-1)^n sin(a \pi ) } { (1 - \frac{a^2}{n^2 } ) } $
I'm fairly certain I've missed something or forgot something major (spidy sense is tingling...).