# What is Magnitude and Phase actually represents in Fast Fourier Transform?

When we reconstruct the image from its magnitude only using Inverse Fast Fourier Transform, then why the resulting image looks nothing like but the original image? Can someone please explain me in detail, what is the role of magnitude and phase in FFT and IFFT?

This question is longstanding, and not fully resolved, IMO. It hinges upon data dimensionality (1D, 2D, 3D), size (short, large), sampling (loose, tight), and mostly morphology (smooth vs. sharp).

Basically, in natural images with distinguishable objects of different contrast/texture at different scales, the data is far from stationary. Fourier applies, but sines can have very complicated relative locations, therefore phases. And to make sense of an object, sepia or luminance-distorted images still work. So, disregarding relative amplitude of components, what may matter is their relative position. Hence, phase can be primordial.

But for more stationary 2D data, with less "objects", phase can have a minor effect.

I like this perspective:

The Fast Fourier Transform is an algorithm that implements the Discrete Fourier Transform (DFT), so I will stick with DFT in my description.

The DFT decomposes ANY single valued complex time domain function into individual spinning phasors each with a constant magnitude and starting phase. Each spinning phasor rotates at an integer spin rate starting with no spin (DC), then spinning at the fundamental frequency which is 1/T where T is the duration of the time domain signal, and then higher multiples of that frequency. The cool thing is when all those spinning phasors (in time) are summed together, then net result will land exactly on the original sample locations, at the time for that sample.

That said, the Magnitude and Phase of the DFT is the magnitude and starting phase of those spinning phasors in the time domain. This is what occurs specifically during the IDFT: it gives each component in time of the form $$Ae^{j(\omega t + \phi)}$$ (a spinning phasor) a magnitude $$A$$ and starting phase $$\phi$$ that will then properly reconstruct the time domain signal at those sample locations only.

Consider the plot below to explain this further. Here we see a complex continuous time domain function in blue plotted on a complex IQ plane. The dot corresponding to n=0 is t=0, and the function moves forward through the other sample locations as time moves forward. This function is sampled 11 times as indicated with n=0 through n =10. If you take the DFT of those 11 complex time domain samples, you will get 11 complex values for the DFT, each typically indexed with k and having a magnitude and phase given by the complex value $$X[k]$$. The inverse DFT is to assign those as magnitude and starting phase to complex phasors rotating in time such that the sum will land on the original sample locations exactly (and there will likely be large deviations at the locations in between if you observed it as a continuous time signal):

Consider the IDFT written as follows where this reconstruction in the time domain as a sum of spinning phasors ($$e^{j\omega n}$$) is clear:

$$x(n) = \frac{1}{N}\Sigma_{k=0}^{N-1}X[k]e^{jk \omega n}$$

where $$\omega = 2\pi/N$$

The reconstruction sums N phasors that each rotate as n counts from 0 to N-1. Each phasor is indexed by k, starting with k =0 (DC, does not rotate, with magnitude and phase given by X[0]. Added to this is the phasor from k=1, which rotates the slowest going from 0 to 1 sample less than $$2\pi$$ on the unit circle landing on all N samples (given by $$\omega$$). This phasor has a magnitude and starting phase given by X1. Added to this is the phasor from k=2, which rotates twice as fast, as it goes around the unit circle twice since the N samples in this case index by 2$$\omega$$. This phase has a magnitude and starting phase given by X[2]. So this continues for all N phasors, and if this is done as directed in the formula, the summation of all that will land on the original time domain samples!