I have to find the Fourier series of this function in complex form and transfer it to real:

\$f:(-\pi;\pi]\to \mathbb{R},\;\;\;f(x)= \begin{cases} x & -\frac{\pi}{2} \leq x \leq \frac{\pi}{2} \\ 0 & -\pi \leq x < -\frac{\pi}{2} \;\;\; \bigcup \;\;\; \frac{\pi}{2} < x \leq \pi\end{cases}\$

Calculating complex Fourier coefficients:



\$c_n=\frac{1}{2\pi}\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}xe^{-inx}dx=\frac{1}{2\pi n^2}(in\frac{\pi}{2} e^{in\frac{\pi}{2}}+in\frac{\pi}{2} e^{-in\frac{\pi}{2}}+e^{-in\frac{\pi}{2}}-e^{in\frac{\pi}{2}})\$

\$=\frac{1}{2\pi n^2}(in\frac{\pi}{2}(e^{in\frac{\pi}{2}}+e^{-in\frac{\pi}{2}})-(e^{in\frac{\pi}{2}}-e^{-in\frac{\pi}{2}})\$

\$=\frac{1}{2\pi n^2}(2in\pi cos(n\frac{\pi}{2})-2isin(n\frac{\pi}{2}))\$

\$=\frac{icos(n\frac{\pi}{2})}{n}-\frac{isin(n\frac{\pi}{2})}{\pi n^2}\$

I use such formula:

\$cos(n\frac{\pi}{2})=(-1)^n \;\;\; \;\;\; \;\;\; n, 2n\$

\$sin(n\frac{\pi}{2})=(-1)^{n+1} \;\;\; \;\;\; n, 2n-1\$

\$=\frac{i(-1)^n}{2n}-\frac{i(-1)^{n+1}}{\pi (2n-1)^2}\$

At this point I´ve no idea how to transform it further into real. How can I handle even and odd \$n\$ into a formula?

I want a Fourier series like:

\$A_0=\sum_{i=1}^{\infty}cos(n\omega_0 x+\phi_0)\$

Any help would be appreciated.

I have tried this but solution is not correct. Can you show me right result


\$=(\frac{(-1)^n}{2n}+\frac{(-1)^{n+2}}{\pi (2n-1)^2})i=(\frac{(-1)^n}{2n}+\frac{(-1)^{n+2}}{\pi (2n-1)^2})e^{i\frac{\pi}{2}}\$


\$=f(x)=\sum_{-\infty}^{\infty}(\frac{(-1)^n}{2n}+\frac{(-1)^{n+2}}{\pi (2n-1)^2})e^{i\frac{\pi}{2}x}e^{-i\frac{\pi}{2}x}\$


\$=\sum_{n=1}^{\infty}2(\frac{(-1)^n}{2n}+\frac{(-1)^{n+2}}{\pi (2n-1)^2})cos(nx+\frac{\pi}{2})\$

  • \$\begingroup\$ hello447 - Hi, Your "answer" (which wasn't an answer to your original question, & therefore should not have been posted in the "Your Answer" box) has been added to the question instead as an edit i.e. an update. Unless you are writing the full and final answer to your own question (i.e. unless you have solved the problem yourself, with no further help needed) please don't use the "Your Answer" box below. Instead, you should edit the question to add new info. This is an example of how Stack Exchange is different from typical forums. See the tour and help center for more rules. TY. \$\endgroup\$
    – SamGibson
    Commented Apr 11 at 6:20

1 Answer 1


Make use of the following two facts: $$z + z^* = 2\cdot Re(z)$$ $$ z\cdot e^a = |z|\cdot e^{a + i\cdot arg(z)}$$ The first equation comes into play when summing corresponding complex terms for +/- \$n\$. The second is used for determining the real parts in the form of \$A_n cos(\omega_n t + \varphi_n)\$.

Edit: I will show you how to apply the previously stated facts to reach the desired solution. Notice that \$c_{-n} = c_n^*\$ because \$Im(f) = 0\$. Hence $$ c_{-n}\cdot e^{-i\omega_n t} + c_{n}\cdot e^{i\omega_n t} = z_n + z_n^* $$ for \$z_n = c_{n}\cdot e^{i\omega_n t}\$. We therefore get $$ z_n + z_n^* = 2\cdot Re(z_n)$$ by making use of fact number one. To calculate \$Re(z_n)\$ in the desired form we will have make use of fact number 2. The real part follows to $$Re(z_n) = |c_n|\cdot cos(\omega_n t + arg(c_n)).$$ Hence the final answer is given by $$f(t) = c_0 + \sum_{n>0} 2\cdot |c_n|\cdot cos(\omega_n t + arg(c_n)).$$

  • \$\begingroup\$ I tried your two facts but my solution is not correct. Can you show me right result \$\endgroup\$
    – hello447
    Commented Apr 11 at 5:33
  • \$\begingroup\$ I edit my question. My final solution is wrong. Can you tell me why it is not correct? \$\endgroup\$
    – hello447
    Commented Apr 11 at 7:38
  • \$\begingroup\$ I edited my answer and expanded on how to use thw two mentioned facts to arrive at the desired series representation. \$\endgroup\$
    – Yggdrasil
    Commented Apr 11 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.