What is the difference between the Discrete Cosine Transform and the Fourier Transform?
General knowledgeIn depthAsked by Anonymous from Seattle, United States24 Oct 2026, 7:52 AM ISTUpdated
In one line
The Discrete Cosine Transform (DCT) uses only cosine waves to break down signals, while the Fourier Transform (FT) uses both sine and cosine waves to do the same job.
JPEG — Lossy compression method for reducing the size of digital images JPEG images use DCT to compress photos, making them smaller without losing much quality. Image: WikipediaFourier transform — Mathematical transform that expresses a function of time as a function of frequency Fourier Transform is used to analyze sound, radio, and many other signals. Image: Wikipedia
The rule
The Discrete Cosine Transform expresses a sequence as a sum of cosine functions with different frequencies and strengths. The Fourier Transform expresses a signal as a sum of both sine and cosine functions (or as complex exponentials) with different frequencies.
DCT formula (for N points):
X_k = Σ_{n=0}^{N-1} x_n · cos[πk(2n+1)/(2N)] for k = 0, 1, ..., N-1 Where:
X_k = DCT coefficient for frequency k
x_n = input value at position n
N = total number of points
Discrete Fourier Transform (DFT) formula:
X_k = Σ_{n=0}^{N-1} x_n · e^{-i2πkn/N} Where:
X_k = DFT coefficient for frequency k
x_n = input value at position n
N = total number of points
e = Euler's number (≈2.718)
i = square root of -1
Let's understand it simply
Imagine you are listening to a song. The song is made up of many notes (frequencies) played together. Both DCT and FT help you find out which notes are present and how strong each note is.
Fourier Transform is like a music teacher who listens to all types of notes—both those that go up and down (cosines) and those that go side to side (sines).
DCT is like a teacher who only listens to the up-and-down notes (cosines). He ignores the side-to-side ones (sines).
Why does this matter? Sometimes, only the up-and-down notes are enough to describe the whole song, especially if the song starts and ends quietly (like many images or signals).
DCT vs Fourier Transform
DCT
Fourier Transform
Waves used
Only cosine
Sine and cosine (or complex)
Output
Real numbers
Complex numbers
Best for
Images, compression
All signals, analysis
Assumes
Signal is mirrored
Signal repeats
Common use
JPEG, MP3, video
Sound, radio, MRI, maths
How it works
Fourier Transform:
Takes your signal (like a row of pixels in a photo).
Breaks it into a mix of sines and cosines (waves).
Each wave has a frequency (how fast it goes up and down) and a strength.
The result tells you how much of each frequency is in your signal.
Discrete Cosine Transform:
Takes your signal.
Breaks it into only cosine waves.
Each cosine wave has a frequency and a strength.
The result is a list of numbers showing how much each cosine wave is present.
DCT ignores sines:
DCT assumes the signal can be mirrored at the ends, so only cosines are needed.
DFT uses both sines and cosines:
DFT does not assume anything about the ends; it treats the signal as if it repeats forever.
Result:
Both give you a set of numbers (coefficients) that can be used to rebuild the original signal.
How DCT and FT work
Take the signal (like a row of pixels)
Break it into waves (cosines for DCT, sines and cosines for FT)
Find out how strong each wave is (coefficients)
Use these to rebuild or compress the original signal
The story behind it
The Fourier Transform was first developed by Joseph Fourier in the early 1800s to study heat flow. He found that any repeating pattern could be made by adding up sines and cosines. The Discrete Fourier Transform (DFT) came later, for computers to handle digital data.
The Discrete Cosine Transform (DCT) was introduced in the 1970s by Nasir Ahmed and his team. They wanted a way to compress images and signals more efficiently. DCT became famous because it works very well for images and videos, especially for compression (like JPEG photos).
Where you see it in real life
DCT:
JPEG images: When you take a photo on your phone, DCT helps shrink the file size.
MP3 music: DCT helps compress music files.
Video compression: Used in making videos smaller (MPEG, H.264).
TV broadcasting: DCT helps send clear pictures with less data.
Face recognition: DCT helps computers quickly compare faces.
Noise reduction: Removes unwanted sounds from audio recordings.
Fourier Transform:
Sound analysis: Breaking down music or speech into notes.
Medical scans: MRI and CT scans use FT to build images.
Earthquake analysis: Studying vibrations in the ground.
Communication: Mobile phones use FT to send and receive signals.
Radio: Tuning to a station uses FT to pick the right frequency.
Electrical engineering: Finding faults in power lines.
Why it matters
DCT:
Makes images and videos smaller, so you can store more on your phone.
Speeds up sending photos and videos over the internet.
Keeps important details while throwing away what the eye can't see.
Fourier Transform:
Helps us understand and process any kind of wave or signal.
Used in engineering, science, and medicine.
Forms the base for many advanced topics in maths and physics.
Essential for exams like JEE, NEET, and engineering entrance tests.
Worked example
Let's take a simple signal: x = [2, 4, 6, 8]
DCT (Type-II, most common):
Given: x = [2, 4, 6, 8], N = 4
Step 1: Use DCT formula for k = 0, 1, 2, 3
Step 2: For k = 0:
X_0 = Σ x_n * cos[π*0*(2n+1)/(2*4)] = 2+4+6+8 = 20
Step 3: For k = 1:
X_1 = 2*cos(π*1*1/8) + 4*cos(π*1*3/8) + 6*cos(π*1*5/8) + 8*cos(π*1*7/8)
(Calculate each term and sum)
Step 4: Repeat for k = 2 and k = 3
Step 5: Result: Four DCT coefficients (numbers)
DFT:
Given: x = [2, 4, 6, 8], N = 4
Step 1: Use DFT formula for k = 0, 1, 2, 3
Step 2: For k = 0:
X_0 = 2*e^0 + 4*e^0 + 6*e^0 + 8*e^0 = 20
Step 3: For k = 1:
X_1 = 2*e^{-i2π*1*0/4} + 4*e^{-i2π*1*1/4} + 6*e^{-i2π*1*2/4} + 8*e^{-i2π*1*3/4}
(Calculate each term using complex numbers)
Step 4: Repeat for k = 2 and k = 3
Step 5: Result: Four DFT coefficients (can be complex numbers)
Common mistakes
Thinking DCT and FT are the same: DCT uses only cosines; FT uses both sines and cosines (or complex exponentials).
Forgetting about boundaries: DCT assumes the signal is mirrored at the ends; FT assumes the signal repeats.
Mixing up real and complex numbers: DCT gives only real numbers; FT (DFT) gives complex numbers (with real and imaginary parts).
Using DCT for signals that are not suited for it: DCT works best for signals that start and end smoothly (like images), not for all types of signals.
Remember it
DCT = Only cosines, real numbers, best for images. FT = Sines and cosines, complex numbers, best for all signals.
Check yourself
Which transform is used in JPEG image compression?
DCT, because it uses only cosines and gives real numbers.
Why does the Fourier Transform give complex numbers?
Because it uses both sines and cosines, which together form complex exponentials.
What is the main difference in the type of waves used by DCT and FT?
DCT uses only cosines; FT uses both sines and cosines.
If a signal starts and ends smoothly, which transform is usually better for compression? Why?
DCT, because it works best when the signal is smooth at the ends and can be mirrored.
Quick recap
DCT uses only cosine waves; FT uses both sine and cosine waves.
DCT gives real numbers; FT gives complex numbers.
DCT is mainly used for image and video compression (like JPEG).
FT is used for analyzing all types of signals (sound, radio, medical scans).
DCT assumes the signal is mirrored; FT assumes the signal repeats.