DCT vs DFT why do we need/want phase?

Why do we use complex exponentials in the Fourier transform, why do we want the phase part? As opposed to in DCT where there is no phase and only magnitude?

Moreover, what does this phase concretely mean for the signal reconstruction/decomposition? (I know it is related to a shift of a signal, i.e. i know that sin and cos are phase shifted by pi/2 rad u.e. 90 degrees but i can t really make sense of it in Fourier?

• Didn't just ask the same question here dsp.stackexchange.com/questions/59580/… – Hilmar Jul 17 at 22:40
• Why doesn't the difference between sin(t) and cos(t) make sense to you? If you input one to an FFT, you usually would not want to reconstruct the other via IFFT. – hotpaw2 Jul 18 at 0:34

A DCT is identical to a DFT, twice as long, of the input data concatenated with its mirror image. Data concatenated with its mirror results in symmetric data.

Since a symmetric vector is strictly even, there are no odd (sine or imaginary) components in the DFT result. Just cosine (or real or even) components. Thus you can reconstruct the original input without the all-zero imaginary component. (In practice, there might be some numerical rounding noise).

Not so with a DFT of just the original data (not doubled and mirrored), which likely is not exactly symmetric (even). Thus you need the full complex result of a DFT to reconstruct its input (unless it just happens to be perfectly circularly symmetric around the 1st vector element, x(0)).

• thanks for the answers. I know my questions might seem strange or not well formulated. My problem seems to be related to the link between the exponential (and trigo) form phase and magnitude and how we reconstruct the signal by matrix multiplication DFTMatrix * signal -> inv(DFTMatrix)* (DFTMatrix * signal ) to get back the signal. I see the DFT as a change of basis but that doesnt allow me directly to see what phase is doing there you see what i mean? – Machupicchu Jul 18 at 15:21
• of course i know each line of the DFT matrix is a complex exponential exp(-i*2*pikt/N) (with Euler formula relating it to sines and cos) and that the iDFTmtx if conj(DFTmtx) – Machupicchu Jul 18 at 15:25
• The change of basis requires both the sine and cosine basis vectors. Phase is simply the relationship between the two in the DFT result. – hotpaw2 Jul 18 at 15:42
• Ok but for example DCT does not have phases and still can reconstruct any signal, so why bother with these complex exp with phases? – Machupicchu Jul 18 at 15:47
• (I m sure there is a good reason but "naively" it seems like an unnecessary complication w.r.t. DCT which has no phase for example, you see what i mean? – Machupicchu Jul 18 at 15:50

For example we have a signal x[]:

x[] = [1, 1, 1, 1, 0, 0, 0, 0]


We get the DFT of x[] (only magnitude):

DFT(x)[] = [4.000,  2.613,  0.000,  1.082,  0.000,  1.082,  0.000,  2.613]


And DCT of x[]:

DCT(x)[] = [4.000,  2.563,  0.000, -0.900, -0.000,  0.601, -0.000, -0.510]


Now, we shift the signal, create new signal y[]:

y[] = [0, 0, 1, 1, 1, 1, 0, 0]


We get the DFT of y[]:

DFT(y)[] = [4.000,  2.613,  0.000,  1.082,  0.000,  1.082,  0.000,  2.613]


And DCT of y[]:

DCT(y)[] = [4.000,  0.000, -2.613, -0.000,  0.000,  0.000,  1.082,  0.000]


You can see that both x[] and y[] have same magnitude in DFT, but very different magnitude in DCT.

So, phase information in DFT allows signals with same frequency content but different phase to have same magnitude in DFT. In contrary with that, because DCT has no phase information, signal's phase information goes to magnitude in DCT. It makes signals with same frequency content but different phase give different magnitude results in DCT.

You may discard phase information of DFT. For example, when plotting spectrogram, mostly you don't need to draw the phase. But, sometimes you need the phase information. For example, when reconstructing signal, given the DFT:

DFT()[] = [4.000,  2.613,  0.000,  1.082,  0.000,  1.082,  0.000,  2.613]


You can't know whether the signal is x[] or y[].

• Nice explanation, helpful, but maybe one more step to make the "link" between exponential(trigonometric) form of a complex number in the Fourier transformed signal, lets call it capital X and the orig signal lower case x. I dont' know if i am clear... As I said to the other guy I see the DFT as a change of basis: DFTMatrix* x = X, and then recover with inv(DFTMatrix)* X=x, of course i know each line of the DFT matrix is a complex exponential exp(-i*2*pikt/N) (with Euler formula relating it to sines and cos) but I cant really fit in the comprehension of phase in there? – Machupicchu Jul 18 at 15:25
• @Machupicchu Phase gives information how signals are located in time-domain. – mfcc64 Jul 19 at 14:04
• Do you mean by that: "that e.g. take a simple signal with a single pure sine wave sin(2*pift) , the magnitude is non zero for frequencies 2 and -2 then the fact that i ve (in matlab) seens that phases are pi/2 ans -pi/2 would mean that they are they are located pi/2 out of phase wrt the cosine of the same frequency ? Is that what it means ? Otherwise I dont see "intuitively" why pi/2 ? (e.g. when doing angle(X(indexOfPosFreq)) and angle(indexOfNegFreq) for this X=fft(x) simple signal with 1 freq only, I get -157 or 1.57 which are about = to -pi/2 resp. pi/2 – Machupicchu Jul 19 at 14:11
• @Machupicchu Yes, because sin(x) = cos(x - pi/2). – mfcc64 Jul 19 at 14:24
• Hum so are you saying that the phase is always with respect to cos() in DFT ?! – Machupicchu Jul 19 at 14:28