A Fourier series drawing is a chain of circles, each spinning at its own whole-number speed, with a pen on the end of the last one. Pick the right sizes and starting angles and the pen traces any closed shape you like: a heart, your signature, a portrait outline. It is the idea behind 3Blue1Brown's famous video "But what is a Fourier series?", and it is also a neat way to put an entire drawing into Desmos as a single equation.
This guide works one shape out completely (a square), shows how many circles a shape really needs, and then turns the result into a Desmos equation. Every number below was computed with the same code the Fourier Series Drawing tool runs, at its own setting of 512 points along the shape.
The idea in one paragraph
Treat each point of the drawing as a complex number, x + iy. Walk around the shape at a steady speed, taking 512 evenly spaced points. The discrete Fourier transform rewrites those 512 points as 512 circles: circle number k turns k times per loop (negative k turns clockwise), and the transform gives each one a radius and a starting angle. Put all 512 circles end to end and the pen passes through every one of the 512 points exactly. The useful surprise is that most circles are tiny, so the biggest few already look like the drawing.
In ordinary x and y terms, one circle of radius r, speed k and starting angle φ contributes
x = r·cos(2πkt + φ)
y = r·sin(2πkt + φ)
for t from 0 to 1, and the drawing is the sum of these over all the circles.
Worked example: a square
Take a square 4 units wide, centred on the origin, starting at the corner (−2, −2) and going anticlockwise. Here are its biggest circles:
| Circle | Turns per loop | Radius | Starting angle |
|---|---|---|---|
| 1 | 1 | 2.293 | −135° |
| 2 | −3 | 0.255 | −135° |
| 3 | 5 | 0.092 | −135° |
| 4 | −7 | 0.047 | −135° |
| 5 | 9 | 0.028 | −135° |
| 6 | −11 | 0.019 | −135° |
| 7 | 13 | 0.014 | −135° |
| 8 | −15 | 0.010 | −135° |
Three things stand out, and each has a reason.
Only the speeds 1, −3, 5, −7, 9, … appear. A square looks the same after a quarter turn. Turning it by 90° and starting a quarter of the way round gives back the same path, and the only circles that survive that symmetry are the ones whose speed is one more than a multiple of 4. Every other circle has radius zero. A triangle, by the same argument, keeps only 1, −2, 4, −5, 7, …
The radii fall like 1 / k². Circle 1 is 9.0 times bigger than circle 2 (speed 3, and 3² = 9) and 25.0 times bigger than circle 3 (speed 5, 5² = 25). That fall-off happens because a square is unbroken but has sharp corners. A shape with a smooth outline loses its circles faster; a drawing with gaps, where the pen jumps, loses them more slowly (like 1 / k), and that is why jumps leave small wiggles that never quite go away.
All the starting angles are −135°. That is the direction from the centre to the starting corner (−2, −2). Because the square is symmetric about that diagonal, every circle starts pointing the same way.
The first radius even has a closed form. For a square of half-width a traced at steady speed, the biggest circle is 8√2·a / π². With a = 2 that is 22.627 / 9.870 = 2.293, the number in the table.
How many circles do you need?
Here is how far the pen strays from the true square as circles are added, measured over all 512 points (the square is 4 units wide):
| Circles | Average miss | Worst miss | What you see |
|---|---|---|---|
| 1 | 0.263 | 0.536 | a plain circle |
| 2 | 0.100 | 0.281 | a rounded square with bulging sides |
| 4 | 0.034 | 0.142 | clearly a square, soft corners |
| 8 | 0.011 | 0.071 | sharp-looking square |
| 16 | 0.003 | 0.035 | indistinguishable at normal size |
| 60 | below 0.001 | 0.008 | the tool's default |
With one circle the pen draws a circle of radius 2.293: it overshoots the middle of each side by 0.293 and cuts each corner short by 0.536 (the corner is 2√2 ≈ 2.828 from the centre). The worst miss is at a corner at every circle count we checked. By four circles the middles of the sides are already within 0.007; the corners are the last part to sharpen.
The heart that the tool opens with is a more typical shape. It is about 12 units wide, and it needs more circles before it settles:
| Circles | Average miss | Worst miss |
|---|---|---|
| 4 | 0.670 | 2.093 |
| 8 | 0.217 | 0.865 |
| 16 | 0.060 | 0.436 |
| 30 | 0.020 | 0.199 |
| 60 | 0.006 | 0.092 |
Its biggest circle has radius 5 and turns clockwise (speed −1), because the heart is drawn clockwise. The second biggest has speed 0: it doesn't spin at all. A speed-0 circle is simply where the centre of the drawing sits, here 0.881 units above the origin.
Rule of thumb: a simple outline looks right with 10 to 20 circles, a detailed sketch or signature wants 60 to 100, and anything past a couple of hundred is just making the corners crisper.
Draw your own
The Fourier Series Drawing tool does all of this in the browser:
- Press Draw your own and sketch on the canvas, or Use a picture to trace an image. One continuous line works best. If you lift the pen, the strokes are joined end to nearest end, and each join becomes a line the circles have to draw too.
- Press Animate my drawing. The drawing is resampled to 512 evenly spaced points and turned into circles, biggest first.
- Drag the circles slider (1 to 256) and watch the shape sharpen, or untick Show circles to see only the pen's line. Change the speed if the animation is too fast to follow.
- Record a video saves exactly one loop (10 seconds at 1× speed) as a video file your browser supports, ready for Reels, Shorts or a class presentation.
Nothing is uploaded: the drawing, the maths and the video all stay on your device.
Put the drawing in Desmos as one equation
Desmos treats any equation of the form (x(t), y(t)) as a parametric curve, and draws it for t from 0 to 1 by default, which is exactly one loop. So the circles can be written straight into Desmos.
The one-circle square, typed by hand:
(2.293cos(2πt-2.356), 2.293sin(2πt-2.356))
(2.356 is 135° in radians.) That draws the circle from the first row of the table. Adding the next three circles gives the soft-cornered square:
(2.293cos(2πt-2.356)+0.255cos(-6πt-2.356)+0.092cos(10πt-2.356)+0.047cos(-14πt-2.356), 2.293sin(2πt-2.356)+0.255sin(-6πt-2.356)+0.092sin(10πt-2.356)+0.047sin(-14πt-2.356))
If π doesn't paste, type pi and Desmos turns it into π. Each circle adds one cosine to the x part and the matching sine to the y part, with 2π times its speed in front of t.
Typing a hundred of those is no fun, so the tool's Copy as one Desmos equation button writes out the biggest circles for you (up to 100, or fewer if the slider is lower) in the format Desmos accepts when pasted into an expression line. Use 30 to 60 circles for a sketch; past 100 the single line gets slow to edit.
If you would rather build a picture from many short equations, one per stroke, so you can colour and restrict each part, see how Desmos graph art works and the Drawing to Desmos tool. For words, writing your name in Desmos shows the letter-by-letter method.
Common questions
Why do the circles turn in both directions? A circle turning anticlockwise and one turning clockwise at the same speed together make an ellipse, or a line back and forth. Allowing both directions is what lets the chain draw shapes that are not round.
Why is my drawing slightly different from what I drew? With fewer circles than points you get an approximation, and the sharpest corners and finest details go first. Move the slider up. At its maximum of 256 circles the square above is off by less than 0.001 anywhere; the remaining circles are too small to see.
Is this the same as a Fourier series in my maths course? It is the same idea in complex form. Course examples usually take one function over one period (a square wave, say) and write it as sines and cosines. Here the "function" is the drawing itself, x + iy against t, and each complex term is one spinning circle. The 1 / k² and symmetry patterns above are exactly what a course would derive by hand.
Why does a drawing with several separate pieces show connecting lines? One chain of circles draws one closed loop, so the pieces have to be joined into one path. Draw in one stroke where you can, or use many separate equations in Desmos instead.