# Should the phase coefficients of the DFT of a real, even input signal all be zero?

The phase coefficients of a real, even input signals should all apparently be $0$ or a multiple of $\pi$. That's a property of the DFT I've learned about in the Audio Signal processing course on coursera. However, the example they use completely confuses me.

They create a triangle wave that looks like this: and then showed the phase spectrum to be this: They explained that this phase spectrum was not zero, because the original triangle function wasn't even because it wasn't centered around zero - it had a phase shift that was messing things up. So they adjusted the positioning of the triangle wave so the peak was at zero, like this: And the phase spectrum duly went to zero (note the minuscule scale on the $y$-axis) Bearing in mind I'm new to DSP, the thing that is really confusing is that surely both forms of the triangle wave are even - shifting by half a wavelength just creates another even function, doesn't it? Why must the triangle wave be positioned so the peak is at the center rather than the trough, or vice-versa?

• No, shifting by half a wavelength usually does not create another even function. Jul 20 '16 at 21:25
• @DSPLearner: If any of the answers was helpful, please accept it by clicking on the check mark to its left. You can also upvote any answer that was useful by clicking on the up arrrow. Jul 22 '16 at 19:41
• Your question has beeen answered. Do not hesitate to vote for the useful ones and accept the most suitable Feb 9 '17 at 17:10

You are right, of course it's not necessary to position the peak of the triangle in the center. The only condition for the DFT of a sequence to be real-valued is that the sequence satisfies

$$x[n]=x^*[N-n],\qquad 0\le n<N\tag{1}$$

where $*$ denotes complex conjugation, and $N$ is the DFT length. If $x[n]$ is real-valued, $(1)$ reduces to

$$x[n]=x[N-n],\qquad 0\le n<N\tag{2}$$

Conditions $(1)$ and $(2)$ require the periodic continuations of $x[n]$ (period $N$) to be even with respect to $n=0$.

$$x[n]=x[N-1-n]\tag{3}$$

with $N=15$. Of course this corresponds to a certain symmetry condition, but note that its periodic continuation is not even around $n=0$, as required by $(1)$ and $(2)$.

A simple example of a triangular signal similar to your example but with a purely real-valued DFT (i.e., satisfying $(2)$) is

x = [0 1 2 1]

Its purely real-valued DFT is given by

X = fft(x)
X =

4  -2   0  -2


What follows is an explanation why the DFT coefficients $X[k]$ are real-valued if (and only if) condition $(1)$ is satisfied. If $X[k]$ is real-valued, we have

$$X[k]=X^*[k]\tag{4}$$

With

$$X[k]=\sum_nx[n]e^{-j2\pi nk/N}\tag{5}$$

where the sum is over one period, i.e., over $N$ adjacent indices, and where we assume that $x[n]$ is continued periodically, such that $x[n]=x[n+N]$. Using Eq. $(5)$ we can write $(4)$ as

\begin{align}\sum_nx[n]e^{-j2\pi nk/N}&=\sum_nx^*[n]e^{j2\pi nk/N}\\&=\sum_nx^*[N-n]e^{j2\pi (N-n)k/N}\\&=\sum_nx^*[N-n]e^{j2\pi k}e^{-j2\pi nk/N}\\&=\sum_nx^*[N-n]e^{-j2\pi nk/N}\tag{6}\end{align}

where I've used the index transformation $n\rightarrow N-n$, and the fact that $e^{j2\pi k}=1$. From $(6)$, Eq. $(1)$ follows immediately. Note that $(1)$ is dual to the fact that the DFT of a real-valued sequence is conjugate symmetric. In the case we've considered here, we have a conjugate symmetric sequence, leading to a real-valued DFT.

• how do you get $x[n] = x^*[N-n]$? I guess if I accept that, your explanation is fantastic, but I'm having trouble proving $x[n] = x^*[N-n]$ Oct 13 '16 at 9:23
• @GrowinMan: I've added an explanation to my answer. Oct 13 '16 at 10:55

Even has a precise definition. You may have in mind instead the notion of symmetry (or antisymmetry). This is a property used quite often when choosing a window or a filter (or a filter bank). Your triangle could be seen as a form of Bartlett window or averaging filter.

There is a more general property: if you choose among FIR filters exhibiting four type of "symmetry" (combining even or odd length, symmetry or antisymmetry), they have a linear phase, or at least with respect to the $2\pi$ periodicity. When filtered by such a filter, a signal sees its frequency components shifted by the same amount.

The case where the filter is centered at $0$ falls in this category, as a degenerated case.