# Computation of Complex Fourier Series Coefficients for sawtooth function

I just derived the Real Fourier Series for a sawtooth function with period one and amplitude one ( $$f(x) = x$$ on $$x = [0, 1]$$ and $$f(x+1) = f(x)$$). For the fourier series

$$f(x) = c + \sum_{n=1}^\infty a_n cos(n \omega x) + \sum_{m=1}^\infty b_msin(m \omega x)$$

$$c = \frac{1}{T}\int_0^T f(x)dx$$

$$a_n = \frac{2}{T}\int_0^Tf(x)cos(n \omega x)dx$$

$$b_m = \frac{2}{T}\int_0^Tf(x)sin(m \omega x)dx$$

I found $$a_n = 0$$ and $$b_m = -\frac{1}{\pi m}$$ and $$c= 0.5$$, resulting in the expansion

$$f(x) = \frac{1}{2} - \frac{1}{\pi}sin(2\pi x) - \frac{1}{2\pi}sin(4\pi x) - \frac{1}{3\pi}sin(6\pi x) - ... - \frac{1}{m\pi}sin(2\pi m x)$$

This works as expected.

Now I want to find the complex Fourier series form for this function. I derived the complex Fourier series (using Euler's formula) as

$$f(x) = \sum_{k=-\infty}^{\infty} \frac{1}{2} (a_k - i b_k) e^{i k \omega x}$$

Solving for the coefficient $$c_k = \frac{1}{2} (a_k - i b_k) = \frac{i}{2\pi k}$$.

$$f(x) = \sum_{k=-\infty}^{\infty}\frac{i}{2\pi k} e^{i k \omega x}$$

I tried plotting this in Matlab but it did not look like I imagined it. Also, I'm worried because I'm getting complex numbers in the result (which should not be since f(x) is real). Also, in the summation, if k = 0, the term is undefined (since we're dividing by k). I'm sure I'm making a mistake somewhere but I've been following my formulas carefully and I just can't spot it. I would appreciate any insight and help. Thank you!