Q:

Showing the constants in the complex Fourier series is equal to $\frac {a_n}{2}$ for an even periodic function.

So I have a problem that says "Consider a triangle wave that goes from a minimum value of O volts to a maximum value of V. It has a period T, and is a maximum value at t = 0". And I want to show that $c_n = \frac {a_n}{2} $.
I calculated  $a_n = \frac {2V}{\pi^2n^2} ( 1 - (-1)^n)$, which I assume is accurate. 
However, solving for $c_n$ I set up the integral as 2 times one leg of the triangle:
$$c_n=2 \frac 1T \int_0^\frac T2 \frac {2V}{T}t e^{\frac {-2\pi int}{T}}\, dt  $$
And, after much simplification, I get: 
$$c_n = \frac {\cos({\pi n}) (V\pi in - V) -V}{\pi^2 n^2}$$
This appears overwhelmingly far from $\frac {a_n}{2}$, theres even an imaginary part!. Did I make an obvious mistake in my set-up, or is there a way to simplify my expression for $c_n$?

A:

You didn't define the notation, but I guess you are trying to write the function as
$$
f(t)=\sum_{n\geq 0} a_n \cos (2\pi n t/T)+\sum_{n>0} b_n \sin(2\pi n t/T)=\sum_{-\infty<n\leq \infty} c_n e^{2\pi i n t/T}
$$
Then you already figure out $b_n=0$ by parity and found $a_n$ by integrating only over half a period and multiplying by two. However this only works because $f$ and $\cos$ are even functions! As $e^{-2\pi i n t/T}$ is not even you have to integrate over the whole period.
$$
c_n=\frac{1}{T}\int_{-T/2}^{T/2}f(t)e^{-2\pi i nt/T}dt=\frac{1}{T}\int_{-T/2}^{0}\frac{2V}{T}(t+T/2)e^{-2\pi i nt/T}dt+\frac{1}{T}\int_{-T/2}^{0}\frac{2V}{T}(T/2-t)e^{-2\pi i nt/T}dt
$$
I leave you to fill out the details, but it follows from there. :). By the way $\cos(\pi n)=e^{i\pi n}=(-1)^n$.

