Fourier Series Approximation to Equilateral Triangle

This Demonstration shows Fourier series approximations to the function tracing an equilateral triangle, shown in green, in the complex plane. The vector representing each additional term (gray) is shown, along with its encompassing circle (orange). The blue curve represents a partial sum of the Fourier series, with the selected number of terms. The red dot shows the parametrization of the triangle.
  • Contributed by: Walden Freedman
  • After work by: Grant Sanderson (3Blue1Brown)


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


Let be the piecewise-continuous function giving a parametrization of the equilateral triangle in the complex plane:
The function is defined in the initialization code using the function UnitStep. The Fourier series is then given by .
The function defined in the initialization code produces the sequence ; the function then sums the terms of the Fourier series in the same order.
The slider marked "angle" controls the angle between the gray vector from the origin and the positive axis between and . The slider marked "number of terms" controls the number of terms in the partial sum, which equals the number of orange circles and gray vectors, from 1 to 50. The accuracy of the approximations, in the sense of the norm, improves as increases. But interestingly, the graph "wobbles" more when is odd. This is presumably because in that case the last term (which rotates in the positive direction) has no term with opposite rotation to compensate. The blue curve is the Fourier approximation, while the red dot shows the parametrization of the triangle.
This Demonstration is inspired by the videos on Fourier Series by Grant Sanderson of 3Blue1Brown. There are other related animations online, such as
[1] E. M. Stein and R. Shakarchi, Fourier Analysis: An Introduction, Princeton, NJ: Princeton University Press, 2003.
[2] F. A. Farris, Creating Symmetry: The Artful Mathematics of Wallpaper Patterns, Princeton, NJ: Princeton University Press, 2015.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.