# Fourier coefficients of shifted sawtooth function

Determine the Fourier coefficients of $$f:(-\pi,\pi]\to\mathbb{R},f(x)=\begin{cases}0,&x<0,\\x,&x\geq 0.\end{cases}$$

My attempt thus far is the following: \begin{align*} \frac{1}{2\pi}\int_0^{\pi}x\exp(-\mathrm ikx)\,\mathrm dx &= \frac{1}{2\pi}\left(\left[x\cdot\frac{\exp(-\mathrm ikx)}{-\mathrm ik}\right|_{x=0}^{x=\pi} - \int_0^{\pi}\frac{\exp(-\mathrm ikx)}{-\mathrm ik}\,\mathrm dx\right) \\ &= \frac{1}{2\pi}\left(\frac{\pi}{-\mathrm ik}\exp(-\mathrm ik\pi) - \int_0^{\pi}\frac{\exp(-\mathrm ikx)}{-\mathrm ik}\,\mathrm dx\right) \\ &= \frac{1}{2\pi}\left(\frac{\pi}{-\mathrm ik}\left(\cos(-k\pi)+\mathrm i\sin(-k\pi)\right) - \int_0^{\pi}\frac{\exp(-\mathrm ikx)}{-\mathrm ik}\,\mathrm dx\right) \\ &= \frac{1}{2\pi}\left(\frac{\pi}{-\mathrm ik}(-1)^{k} - \int_0^{\pi}\frac{\exp(-\mathrm ikx)}{-\mathrm ik}\,\mathrm dx\right) \\ &= \frac{1}{2\pi}\left(\frac{(-1)^{k}\mathrm i\pi}{k} - \int_0^{\pi}\frac{\exp(-\mathrm ikx)}{-\mathrm ik}\,\mathrm dx\right) \\ &= \frac{1}{2\pi}\left(\frac{(-1)^{k}\mathrm i\pi}{k} - \left(-\frac{1}{\mathrm ik}\left[\frac{\exp(-\mathrm ikx)}{-\mathrm ik}\right|_{x=0}^{x=\pi}\right)\right) \\ &= \frac{1}{2\pi}\left(\frac{(-1)^{k}\mathrm i\pi}{k} - \left(-\frac{1}{k^2}\left(\exp(-\mathrm ik\pi)-1\right)\right)\right) \\ &= \frac{1}{2\pi}\left(\frac{(-1)^{k}\mathrm i\pi}{k} - \left(-\frac{1}{k^2}\left(\cos(-k\pi)+\mathrm i\sin(-k\pi)-1\right)\right)\right) \\ &= \frac{1}{2\pi}\left(\frac{(-1)^{k}\mathrm i\pi}{k} - \left(-\frac{1}{k^2}\left((-1)^{k}-1\right)\right)\right) \\ &= \frac{1}{2\pi}\left(\frac{(-1)^{k}\mathrm i\pi}{k} - \left(-\frac{(-1)^k}{k^2}+\frac{1}{k^2}\right)\right) \\ &= \frac{1}{2\pi}\left(\frac{(-1)^k\mathrm ik\pi+(-1)^k-1}{k^2}\right) \\ &= \frac{(-1)^k(\mathrm ik\pi+1)-1}{2\pi k^2}. \end{align*}

For $k=0$ I just obtain $$\frac{1}{2\pi}\int_0^{\pi}x\,\mathrm dx=\frac{\pi}{4}.$$

I'd like to know whether there are any objections or simplifications I missed.

• Do you mean express $f(x)$ as a Fourier series, $f(x)=\sum(a_n\cos(..x)+b_n\sin(..x))$ and find $a_n$ and $b_n$? May 14, 2018 at 19:14
• @Skip Almost, I want to find $c_k$ s.t. $$f(x)=\sum_{k=-\infty}^{\infty}c_k\exp(\mathrm ikx)$$ and I am using the fact that $$c_k=\frac{1}{2\pi}\int_0^{2\pi}f(x)\exp(-\mathrm ikx)\,\mathrm dx.$$ May 14, 2018 at 19:30

$$f_N(x) =\sum_{k=-N}^N c_k e^{ik x}$$
for some values of $N$ and check that by increasing it the result looks like $f$