Skip to content
ENExplore Calculators

Fourier Series Calculator

Compute Fourier cosine and sine coefficients for standard periodic waveforms.

About Fourier Series Calculator

The Fourier series represents a periodic function as a sum of sines and cosines: f(x) = a₀/2 + Σ[aₙcos(nx) + bₙsin(nx)]. This calculator provides exact coefficients for standard waveforms (square, sawtooth, triangle) and numerical coefficients via integration for custom functions on [-π, π].

Formulas

Fourier series

f(x) = a₀/2 + Σ [aₙ·cos(nx) + bₙ·sin(nx)]

a₀
DC component (average)
aₙ
Cosine coefficients
bₙ
Sine coefficients
n
Harmonic number

Coefficients

aₙ = (1/π)∫[-π,π] f(x)cos(nx)dx, bₙ = (1/π)∫[-π,π] f(x)sin(nx)dx

aₙ
n-th cosine coefficient
bₙ
n-th sine coefficient

Worked example

With the default values below, Fourier Series Calculator returns Fourier sum at x of 0.88709926. Change any input above and every figure here is recalculated in your browser.

Inputs used

Waveformone of Square wave, Sawtooth wave, Triangle wave, Custom f(x) on [-π, π]
Square wave
f(x) (for custom)
x
Number of terms (N)accepts 1–50
5
Evaluate at x
1

Results

Fourier sum at x
0.88709926
a₀ (DC term)
0.00000000
Coefficients (first terms)
b1=1.27324, b3=0.42441

Step by step

  1. 1Values used
  2. 2Fourier series
  3. 3Coefficients
  4. 4Fourier sum at x= 0.88709926
  5. 5a₀ (DC term)= 0.00000000
  6. 6Coefficients (first terms)= b1=1.27324, b3=0.42441

Assumptions and limits

  • The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 8 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

Why do square waves only have sine terms?

The square wave is an odd function, so all cosine (even) coefficients are zero. Only odd harmonics appear: b₁, b₃, b₅, ...

How many terms do I need for a good approximation?

Smooth functions converge quickly (5-10 terms). Discontinuous functions like square waves converge slowly due to Gibbs phenomenon.

Fourier Series Calculator | Calcrivo