Periodic Functions: Sawtooth and Square Waves

Category: Functions   Level: 201

f(x + T) = f(x): period T = 2, amplitude 1

A periodic function repeats one cycle forever. The period is the length of one cycle, and the amplitude is half the distance from the lowest value to the highest.

Step through it

Watch it

Animated walkthrough

Step by step

Step 1: Draw one cycle

Draw one ramp from (0, −1) up to (2, 1). The left end is solid and the right end is hollow, because the next cycle owns that spot.

f(x) = x - 1 on 0 ≤ x < 2

Step 1: Draw one cycle

Step 2: Copy it forever

Paste the same ramp every 2 units, left and right. Shifting the graph by 2 lands it on itself, so f(x + 2) = f(x).

f(x + 2) = f(x)

Step 2: Copy it forever

Step 3: Read the period

Measure from the start of one cycle to the start of the next: 2 units. That length is the period.

period T = 2

Step 3: Read the period

Step 4: Read the amplitude

The ramp runs from −1 to 1. The midline sits halfway at 0, and the amplitude is the distance from the midline to the top: 1.

amplitude = (max - min)/2 = (1 - (-1))/2 = 1

Step 4: Read the amplitude

Step 5: Build a square wave

Same recipe, new cycle: stay at 1 for one unit, then drop to −1 for one unit. Copy every 2 units. It switches like a light that someone keeps flicking.

g(x) = 1 on [0, 1), -1 on [1, 2), g(x + 2) = g(x)

Step 5: Build a square wave

Step 6: Read it the same way

One cycle is still 2 units long, and the wave still swings 1 above and below the midline. Two different shapes, same period, same amplitude.

square wave: period 2, amplitude 1

Step 6: Read it the same way

All steps at once

Storyboard

Generate it yourself

cd svg-generator
python3 -m svgmath render periodic-functions --out /tmp/periodic-functions

Source: svgmath/diagrams/function_families.py