Fourier Series Calculator
CalculusFreeNo sign-up
A Fourier series writes a periodic function as a sum of sines and cosines. On [−π, π], \(f(x) = x\) has \(b_{n} = -\frac{2(-1)^{n}}{n}\), so x = 2(sin x − ½ sin 2x + ⅓ sin 3x − …).
Type the problems from this lesson and check each step.
\(x\)
\(1\)
Type pi for the interval [−π, π].
The function repeated with period 2L (gray) and the partial sum (green). Jumps cause the Gibbs overshoot.
| a₀ | 0 |
| n = 1: aₙ, bₙ | 0, 2 |
| n = 2: aₙ, bₙ | 0, −1 |
| n = 3: aₙ, bₙ | 0, 0.6666667 |
| n = 4: aₙ, bₙ | 0, −0.5 |
| n = 5: aₙ, bₙ | 0, 0.4 |
| n = 6: aₙ, bₙ | 0, −0.3333333 |
| n = 7: aₙ, bₙ | 0, 0.2857143 |
| n = 8: aₙ, bₙ | 0, −0.25 |
| Root-mean-square error of the 10-term sum | 0.43627 |
Show steps
- On \([-\pi, \pi]\), \(f(x) = \frac{a_{0}}{2} + \sum_{n=1}^{\infty}\left[a_{n}\cos\left(nx\right) + b_{n}\sin\left(nx\right)\right]\).
- \(a_{0} = \frac{1}{\pi}\int_{-\pi}^{\pi} f(x)\,dx = 0\)
- \(a_{n} = \frac{1}{\pi}\int_{-\pi}^{\pi} f(x)\cos\left(nx\right)dx = 0\) (f is odd, so all cosine terms vanish)
- \(b_{n} = \frac{1}{\pi}\int_{-\pi}^{\pi} f(x)\sin\left(nx\right)dx = -\frac{2\left(-1\right)^{n}}{n}\)
How to use the Fourier series calculator
- Enter f(x), or choose piecewise and enter the formula on each half.
- Enter the half-period L (pi for [−π, π]).
- Choose how many terms to draw. Press Compute to see the coefficient formulas, a table of values and the graph.
Fourier coefficient formulas
\(f(x) \sim \frac{a_{0}}{2} + \sum_{n=1}^{\infty}\left[a_{n}\cos\frac{n\pi x}{L} + b_{n}\sin\frac{n\pi x}{L}\right]\)
- \(a_{0} = \frac{1}{L}\int_{-L}^{L} f(x)\,dx\)
- \(a_{n} = \frac{1}{L}\int_{-L}^{L} f(x)\cos\frac{n\pi x}{L}\,dx\)
- \(b_{n} = \frac{1}{L}\int_{-L}^{L} f(x)\sin\frac{n\pi x}{L}\,dx\)
Useful facts: \(\sin(n\pi) = 0\) and \(\cos(n\pi) = (-1)^{n}\).
Even and odd functions
An odd function (like x or the square wave) has only sine terms: all \(a_{n} = 0\). An even function (like x² or |x|) has only cosine terms: all \(b_{n} = 0\). Checking symmetry first halves the work.
Worked example: square wave
f = −1 on (−π, 0) and 1 on (0, π). It is odd, so \(a_{n} = 0\) and \(b_{n} = \frac{2}{n\pi}\left(1 – (-1)^{n}\right)\), which is \(\frac{4}{n\pi}\) for odd n and 0 for even n: \(f(x) = \frac{4}{\pi}\left(\sin x + \frac{\sin 3x}{3} + \frac{\sin 5x}{5} + \cdots\right)\). Near the jumps the partial sums overshoot by about 9% (the Gibbs phenomenon).
Fourier series practice quiz: 10 questions
Test yourself with 10 multiple-choice questions. Choose an answer and press Submit to see if you are right and why. Your score appears at the end.
Quiz complete
Frequently asked questions
What is a Fourier series?
A way to write a periodic function as a constant plus an infinite sum of sines and cosines with frequencies that are whole-number multiples of a base frequency.
How are the coefficients calculated?
By integrating f(x) times cos(nπx/L) or sin(nπx/L) over one period and dividing by L.
Can I enter a piecewise function?
Yes, with one formula on (−L, 0) and another on (0, L), which covers square waves, triangle waves and half-wave functions.
Why are the formulas sometimes not shown?
When nerdamer cannot find a closed form that passes the numerical check for n = 1 to 6, the calculator shows the numerical coefficients instead.
What do the partial sums show?
They show how adding more terms makes the series approach the function, and the overshoot (Gibbs phenomenon) near jumps.
Sources
- Paul’s Online Math Notes: Fourier Series
- MIT OpenCourseWare 18.03: Differential Equations
- NIST Digital Library of Mathematical Functions §1.8: Fourier Series
Related calculators
- Integral Calculator
- Taylor Series Calculator
- Series Convergence Calculator
- Laplace Transform Calculator
- Trigonometry Calculator
More calculus calculators
Related to This Article
More math articles
- KG to LBS Converter
- The Ultimate SHSAT Math Formula Cheat Sheet
- How to Solve Inverse Variation?
- Intelligent Math Puzzle – Challenge 83
- The Ultimate STAAR Algebra 1 Course (+FREE Worksheets)
- 7th Grade TCAP Math Worksheets: FREE & Printable
- Making Inferences From a Sentence
- Speed Calculator
- How to Use Pythagorean Theorem Converse: Is This a Right Triangle?
- South Dakota Smarter Balanced Grade 7 Math Worksheets: 95 Free Printable PDFs


What people say about "Fourier Series Calculator - Effortless Math"?
No one replied yet.