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.

  • $\begingroup$ 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$? $\endgroup$
    – mallan
    May 14, 2018 at 19:14
  • $\begingroup$ @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.$$ $\endgroup$ May 14, 2018 at 19:30

1 Answer 1


It looks right to me, a way to make sure you're on the right track is just plotting

$$ 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$

enter image description here


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .