There are moments in a programmer’s journey when a concept feels almost magical—when something that looks mathematically heavy and intimidating suddenly reveals itself as a powerful, almost elegant tool that can drastically change how you solve problems. The Fast Fourier Transform, or simply FFT, is one of those concepts. It’s the kind of algorithm that may appear, at first glance, like it belongs in a physics lab or a university research paper rather than in the high-pressure world of competitive programming. And yet, once you understand how it works and what it can do, FFT becomes something you reach for with confidence whenever you see large polynomial operations or convolution-like patterns.
FFT is one of the groundbreaking algorithms of the 20th century. It didn’t just influence mathematics and engineering—it reshaped computing altogether. In contests, it’s the kind of weapon you pull out when constraints are too large for naïve solutions. It lets you multiply numbers with tens or hundreds of thousands of digits, convolve sequences quickly, analyze patterns, and speed up calculations that would otherwise take minutes into operations that finish in milliseconds. It’s rare to find an algorithm that blends such heavy theory with such practical speed, but FFT fits that description perfectly.
If you’ve ever wondered how people perform polynomial multiplication with (10^5)-degree polynomials in under a second, or how certain pattern-matching tricks run on huge arrays effortlessly, FFT is usually the silent force behind the scenes. But despite its immense impact, the algorithm often intimidates beginners because of its mathematical flavor. Many learners hear terms like “roots of unity”, “complex numbers”, or “frequency domain” and feel overwhelmed before even writing a single line of code.
This course aims to change that. Across 100 articles, we will demystify FFT from the ground up. You’ll see not just how to implement it, but how to understand it intuitively, how to apply it to a wide range of competitive programming problems, and how to push it to its limits using optimizations, variations, and clever techniques. The goal is to make FFT feel less like an advanced mathematical ritual and more like a natural extension of your problem-solving skills.
One of the first realizations many competitive programmers have is that polynomial multiplication sits at the heart of many problems that don’t look like polynomial problems. Convolution, correlation, large integer multiplication, matching, sequences, or even certain dynamic programming transitions can be transformed into polynomial operations. And while multiplying small polynomials is trivial, contest problems often push multisets or arrays to lengths that make naïve (O(n^2)) multiplication far too slow.
That’s where FFT changes everything. It reduces the complexity to (O(n \log n)), which is fast enough to handle sizes that would otherwise be impossible. This performance boost doesn’t just shave off time—it opens up entirely new solution concepts. Problems that once looked unsolvable suddenly become approachable. Long integer multiplication becomes simple. Convolutions with large datasets become feasible. Pattern matching between sequences becomes surprisingly straightforward.
You also begin to see patterns: anywhere two sequences interact in a way that resembles “for all i and j, combine A[i] and B[j] if i + j = something”, FFT might be lurking nearby, waiting to be applied. Once you recognize this, whole classes of problems become much easier.
Some solvers think of FFT as a specialized tool. But the truth is that the more you use it, the more you realize it’s a Swiss Army knife. It excels not only at polynomial multiplication but at many transformations that let you compress, manipulate, and recombine information at scale.
The heart of the FFT algorithm lies in one brilliant idea: evaluating a polynomial at cleverly chosen points. Instead of multiplying polynomials using standard coefficient-by-coefficient expansion, FFT transforms polynomials into a representation where multiplication is simple and fast: pointwise multiplication.
Think of it in terms of perspectives. In one perspective (coefficient form), multiplying polynomials feels heavy and clunky. In another perspective (value form), it becomes astonishingly easy. FFT is the bridge between these two worlds: it transforms the polynomial into its frequency-domain representation quickly, allows you to multiply them effortlessly, and then transforms the result back to get the final coefficients.
In simpler terms, FFT is like switching from one language to another—a language where multiplication becomes much smoother. Once done, you translate everything back.
What makes FFT even more impressive is the mathematical symmetry it exploits. By using the complex roots of unity, the algorithm identifies repeating patterns and recursively reduces the task size. This symmetry is the key to its speed. And even if you don't fully understand complex numbers at first, the computational idea behind FFT will still make sense as we break it down step by step.
Just like backtracking or dynamic programming is more than a set of instructions, FFT requires a shift in perspective. You begin to think in terms of transforms, convolutions, and frequency representations. Suddenly, you see connections between problems that initially looked very different.
For example:
All these can be transformed into polynomial multiplication at their core. And once you’re comfortable with that perspective, you start recognizing when a convolution trick might collapse a seemingly complex problem into something much simpler.
FFT also rewards algorithmic discipline. You learn about precision issues, rounding, padding lengths to powers of two, handling imaginary numbers, and ensuring numerical stability. These details sharpen your coding instincts and improve your understanding of efficient algorithms in general.
Although our focus is competitive programming, FFT shines far beyond that. Once you understand it, you’ll realize how deeply it influences technology. FFT powers signal processing, audio compression, image transformations, communication systems, and even machine learning. It's behind MP3s, JPEGs, digital filtering, and scientific simulations.
Knowing FFT means you’re touching the same tools used in physics, engineering, and computer graphics. There’s a certain sense of achievement in understanding something so widely impactful. And that is another reason this journey is worth taking. Competitive programming is just the beginning; the intuition you build here connects to real-world computational thinking.
FFT is elegant in a way few algorithms are. It takes something that seems inherently slow—evaluating polynomials at many points—and transforms it into something efficient through symmetry and clever divide-and-conquer. It’s almost like compressing the universe of polynomial information into a more structured form.
What programmers admire about FFT is that it rewards deeper understanding. Once you grasp the structure of roots of unity, butterflies, recursion, and bit-reversal permutations, FFT implementations feel almost calming. There’s a rhythm to the algorithm: splitting into even and odd components, combining results, halving angles, doubling precision. When implemented right, it’s like watching mathematics come alive in code.
Even better, the moment you apply FFT to a hard problem, you feel a genuine sense of power. Problems that previously seemed far too large simply dissolve. A convolution that once took millions of operations suddenly finishes before you blink. That feeling of unlocking new strength is one of the reasons seasoned competitive programmers love FFT so much.
This course isn’t about memorizing formulas or copying code from the internet. It’s about building a complete, intuitive understanding of FFT from the foundations upward. We're going to explore the why, the how, and the when of FFT.
You’ll see everything—from the most basic ideas about polynomials and complex numbers to the more sophisticated variants such as:
By the time you finish, you won’t just know how to write a working FFT. You’ll understand how to adapt it, debug it, modify it, and apply it to problems in creative ways.
And perhaps more importantly, you’ll develop an instinct for detecting FFT-friendly patterns. You’ll recognize when a problem is secretly a convolution challenge. You’ll know when FFT is the right tool—and when another transformation might suit the problem better.
Before going deeper, it helps to adopt a mindset of exploration. FFT is not something you memorize; it’s something you internalize. The best way to learn it is through:
You'll realize quickly that FFT is not as mystical as it appears. Like any great algorithm, it’s built on a simple idea that unfolds into beautiful complexity.
If you come into this course with patience, curiosity, and an open mind, the journey will feel both inspiring and rewarding. FFT may seem like a heavy topic, but once you break it down, everything starts to click into place.
The world of FFT can feel like stepping into a new landscape—one filled with geometric intuitions, rotating vectors, harmonics, patterns, and recursive structure. But once you understand the terrain, it becomes one of the most empowering tools in your competitive programming arsenal.
You are about to enter a domain where mathematical elegance meets raw computational speed. Over the next 100 articles, you’ll gradually build mastery over this remarkable algorithm. You’ll see how a single idea has changed the world of computing, and how you can use that idea to solve problems more efficiently and creatively.
Whether you're here to boost your competitive programming skills, explore deeper algorithmic concepts, or simply satisfy your curiosity, this journey will leave you better equipped, more confident, and more capable as a problem solver.
Let’s begin, step by step, transformation by transformation, as we unravel the power and beauty of the Fast Fourier Transform.
1. Introduction to Fast Fourier Transform (FFT) in Competitive Programming
2. Understanding Polynomials and Their Representations
3. Coefficient Representation of Polynomials
4. Point-Value Representation of Polynomials
5. Converting Between Coefficient and Point-Value Representations
6. Introduction to Complex Numbers
7. Properties of Complex Numbers
8. Roots of Unity: Definition and Properties
9. Discrete Fourier Transform (DFT): Definition and Applications
10. Naive DFT Algorithm: Implementation and Limitations
11. Introduction to Divide and Conquer in Polynomial Multiplication
12. Fast Fourier Transform (FFT): Intuition and Overview
13. Recursive FFT Algorithm: Implementation
14. Iterative FFT Algorithm: Implementation
15. Inverse FFT: Recovering Coefficients from Point-Values
16. Multiplying Polynomials Using FFT
17. Comparing FFT with Naive Polynomial Multiplication
18. Understanding the Time Complexity of FFT
19. Handling Edge Cases in FFT
20. FFT for Convolution: Introduction
21. FFT for Cross-Correlation: Introduction
22. FFT for Signal Processing: Basic Concepts
23. FFT for Image Processing: Basic Concepts
24. FFT for Audio Processing: Basic Concepts
25. FFT for String Matching: Basic Concepts
26. FFT for Number Theory: Basic Concepts
27. FFT for Combinatorics: Basic Concepts
28. FFT for Geometry: Basic Concepts
29. FFT for Probability: Basic Concepts
30. Basic Problems on FFT in Competitive Programming
31. Optimizing FFT: Bit-Reversal Permutation
32. Optimizing FFT: In-Place Computation
33. Optimizing FFT: Precomputing Roots of Unity
34. Optimizing FFT: Using SIMD Instructions
35. Optimizing FFT: Parallelization Techniques
36. FFT with Arbitrary Moduli: Introduction
37. Number Theoretic Transform (NTT): Definition and Applications
38. Implementing NTT for Polynomial Multiplication
39. Comparing FFT and NTT
40. FFT for Large Integers: Multiplication
41. FFT for Large Integers: Division
42. FFT for Large Integers: Exponentiation
43. FFT for Large Integers: Factorials
44. FFT for Large Integers: Binomial Coefficients
45. FFT for Large Integers: Fibonacci Numbers
46. FFT for Large Integers: Catalan Numbers
47. FFT for Large Integers: Eulerian Numbers
48. FFT for Large Integers: Stirling Numbers
49. FFT for Large Integers: Bell Numbers
50. FFT for Large Integers: Partition Numbers
51. FFT for Large Integers: Harmonic Numbers
52. FFT for Large Integers: Bernoulli Numbers
53. FFT for Large Integers: Generating Functions
54. FFT for Large Integers: Recurrence Relations
55. FFT for Large Integers: Linear Recurrences
56. FFT for Large Integers: Matrix Exponentiation
57. FFT for Large Integers: Dynamic Programming
58. FFT for Large Integers: Graph Theory
59. FFT for Large Integers: Game Theory
60. Intermediate Problems on FFT in Competitive Programming
61. Advanced Techniques for FFT: Mixed-Radix FFT
62. Advanced Techniques for FFT: Bluestein's Algorithm
63. Advanced Techniques for FFT: Rader's Algorithm
64. Advanced Techniques for FFT: Cooley-Tukey Algorithm
65. Advanced Techniques for FFT: Good-Thomas Algorithm
66. Advanced Techniques for FFT: Bruun's Algorithm
67. Advanced Techniques for FFT: Winograd's Algorithm
68. Advanced Techniques for FFT: Prime Factor Algorithm
69. Advanced Techniques for FFT: Split-Radix Algorithm
70. Advanced Techniques for FFT: Vector-Radix Algorithm
71. Advanced Techniques for FFT: Multidimensional FFT
72. Advanced Techniques for FFT: Non-Power-of-Two FFT
73. Advanced Techniques for FFT: Real-Valued FFT
74. Advanced Techniques for FFT: Half-Complex FFT
75. Advanced Techniques for FFT: Fast Hartley Transform
76. Advanced Techniques for FFT: Fast Cosine Transform
77. Advanced Techniques for FFT: Fast Sine Transform
78. Advanced Techniques for FFT: Fast Walsh-Hadamard Transform
79. Advanced Techniques for FFT: Fast Wavelet Transform
80. Advanced Techniques for FFT: Fast Gabor Transform
81. Advanced Techniques for FFT: Fast Chirplet Transform
82. Advanced Techniques for FFT: Fast Curvelet Transform
83. Advanced Techniques for FFT: Fast Ridgelet Transform
84. Advanced Techniques for FFT: Fast Contourlet Transform
85. Advanced Techniques for FFT: Fast Shearlet Transform
86. Advanced Techniques for FFT: Fast Radon Transform
87. Advanced Techniques for FFT: Fast Hough Transform
88. Advanced Techniques for FFT: Fast Sparse FFT
89. Advanced Techniques for FFT: Fast Approximate FFT
90. Advanced Problems on FFT in Competitive Programming
91. Designing Custom FFT Algorithms for Specific Applications
92. Designing Custom FFT Algorithms for Real-Time Systems
93. Designing Custom FFT Algorithms for Large-Scale Systems
94. Designing Custom FFT Algorithms for Parallel Systems
95. Designing Custom FFT Algorithms for Distributed Systems
96. Designing Custom FFT Algorithms for Secure Systems
97. Designing Custom FFT Algorithms for High-Performance Systems
98. Open Problems in FFT and Competitive Programming
99. Research Trends in FFT
100. Future Directions in FFT