Skip to content

Lesson 1 of 315 min Essential path

Shifting, reversing and scaling time

Predict exactly where a shifted, reversed or sped-up copy of a signal lands, and why order changes the answer.

Before thisKinds of signals (1.2)

Before this1.2
Chapter 2 · Lesson 1 of 3

First, the picture

Drag Delay from −3-3 toward +3+3 and watch the solid pulse slide against its faint outline.

Sliding in time

The shape never changes, only its position.

originaldelayed
+2.0 s
Describe this picture

One plot, amplitude against time in seconds: a pulse drawn as a faint outline labelled “original”, and a solid copy of it. The “Delay” slider runs from −3-3 to +3+3 s and starts at +2.0+2.0 s. The key names the solid copy “delayed” for a positive delay, “advanced” for a negative one and “unchanged” at zero.

Moving a signal around, without changing it

So far we’ve looked at signals as they are: a heartbeat trace, a musical note, a burst of static. This page asks a different question. Take a signal you already have. Instead of changing what happens in it, move it around: play it a little later, play it backward, play it at double speed. The shape stays the same. Only where, or how fast, you get to hear it changes.

You already do this without thinking. An echo is the same handclap, heard again a moment later. Playing a word backward is the same sound, read in the opposite order. Playing a clip at double speed is the same recording, squeezed into half the time. Each of these is one of three moves you can make on the time axis of any signal. Once you can read the notation for them, you can predict where any marked feature, like a peak, ends up.

Sliding in time: shift

Picture clapping once in a canyon. You hear the clap, then a moment later you hear it again, the echo: the exact same sound, delayed. Nothing about the clap’s shape changed, only when you got to hear it.

To write this down, take a signal x(t)x(t) you already have, pick a fixed number of seconds t0t_0, and build a new signal y(t)=x(t−t0)y(t) = x(t - t_0). Every place you see tt in the original, you plug in t−t0t - t_0 instead.

Here is the part that confuses many readers: a minus sign in x(t−t0)x(t - t_0) sounds like it should make things earlier, since subtracting usually makes a number smaller. It actually means later, when t0t_0 is positive. To see why, ask what y(t)y(t) equals at a specific time, say t=5t = 5, with t0=2t_0 = 2. That is x(5−2)=x(3)x(5 - 2) = x(3): whatever the original signal was doing at time 3, the shifted signal is doing at time 5, two seconds after. The whole trace got pushed later by t0t_0, even though the formula subtracts. If t0t_0 is negative, the same reasoning pushes everything earlier.

A sampled signal shifts the same way, in whole samples. With n0n_0 a whole number, y[n]=x[n−n0]y[n] = x[n - n_0] is xx delayed by n0n_0 samples: the value xx had at sample nn now appears at sample n+n0{n + n_0}.

Go back to the picture at the top of the page. The solid copy has the same shape as the outline at every setting. Only its position along the time axis changes: negative delay slides it before the outline, positive delay slides it after.

Playing it backward: reversal

Say a word into a recorder, then play the clip backward. You hear the exact same sound, but with its order flipped: whatever came last now comes first.

This move replaces tt with −t-t: y(t)=x(−t)y(t) = x(-t). Whatever the original signal was doing at some time tt, the reversed signal does at time −t-t instead, its mirror image across the instant t=0t = 0. Something that used to happen shortly before t=0t = 0 now happens shortly after it, and the other way around.

Switch between Forward and Backward on a lopsided pulse, one with a fast rise and a slow decay, and watch where its peak goes.

Playing it backward

What happens just before t = 0 happens just after it, in reverse order.

originalreversed
Direction
Describe this picture

One plot, amplitude against time in seconds, of a lopsided pulse with a fast rise and a slow decay, and two “Direction” buttons, “Forward” and “Backward”. Forward, it peaks at t=1.5t = 1.5. Backward, the reversed pulse peaks at t=−1.5t = -1.5, with the original faint behind it.

Forward, the peak is at t=1.5t = 1.5; backward, it is carried to t=−1.5t = -1.5. Reversing the pulse swaps which end is fast and which is slow, so the shape looks different. A pulse that is symmetric about t=0t = 0 does not change at all under this move.

Speeding up or slowing down: scaling

Play an audio clip at double speed and the whole thing finishes in half the time; everything you hear is still there, compressed. Play it at half speed and it stretches out, taking twice as long.

This move replaces tt with atat, where aa is a fixed positive number: y(t)=x(at)y(t) = x(at). When a>1a > 1, the time axis gets squeezed, so the signal plays faster; when 0<a<10 < a < 1, the time axis stretches out, so it plays slower. a=1a = 1 leaves it unchanged.

In discrete time the two directions behave differently. There the speed-up factor is usually a whole number, written MM. Speeding up by MM means y[n]=x[Mn]y[n] = x[Mn]: you keep every MM-th sample you originally measured and throw the rest away. Nothing new is needed; some measurements are skipped.

Slowing down by 2 asks for y[n]=x[n/2]y[n] = x[n/2]. For odd nn that is halfway between two measured samples, an instant that was never measured, so you have to fill in a value from the samples around it.

Switch Speed from ½×, through 1× (unchanged), up to 2× and 3×, and watch which samples are skipped and which are new.

Speeding up, slowing down

Compressing skips samples you had; expanding needs samples you never measured.

Original x[n]keptskipped
Result y[n] = x[2n]result samples

Only every 2nd original sample is kept (7 of 13); the grey ones in the top row are skipped.

Speed
Describe this picture

Two rows of samples against the sample number, from n=−6n = -6 to 6, and four “Speed” buttons: ½×, 1×, 2× and 3×, starting at 2×. The top row is the “Original x[n]x[n]”. At fast settings some of its dots turn grey and are labelled “skipped”, the rest “kept”. The bottom row, “Result y[n]=x[2n]y[n] = x[2n]” at 2×, puts the kept samples on whole sample numbers, closer together. At ½×, new hollow rings appear between the originals, labelled “new in-between samples”.

At fast settings the kept samples close up and the skipped ones are gone. At ½× the hollow rings between the originals are filled-in values, not ones that were ever measured.

Order matters

What happens when you combine a shift and a scale? Say you want to build y(t)=x(2t−4)y(t) = x(2t - 4) from a signal x(t)x(t) whose peak sits at t=3t = 3. There are two orders you could do this in. If you use the numbers 4 and 2 as written, only one order gives the right answer.

Shift first by 4, then scale by 2 (the safe order). Shifting gives g(t)=x(t−4)g(t) = x(t - 4), whose peak moves to t=4+3=7t = 4 + 3 = 7. Now scale: y(t)=g(2t)y(t) = g(2t), whose peak sits where 2t=72t = 7, that is t=3.5t = 3.5.

Scale first by 2, then shift by the same raw number 4 (the common mistake). Scaling gives v(t)=x(2t)v(t) = x(2t), whose peak moves to where 2t=32t = 3, that is t=1.5t = 1.5. If you now shift by the original 4, v(t−4)v(t - 4), the peak lands at t=1.5+4=5.5t = 1.5 + 4 = 5.5, which is wrong.

The mistake is treating the “4” as if it still meant 4 seconds of real time after you’ve already rescaled the time axis by the scale factor. Speeding up squeezes the shift amount too. So shifting after scaling needs a smaller number, 4/2=24/2 = 2, not the original 4. Then v(t−2)v(t - 2) puts the peak back at t=1.5+2=3.5t = 1.5 + 2 = 3.5, matching the safe order. Shifting first, then scaling, avoids this, because the scale is applied to the whole expression, shift included, exactly once.

Switch between Shift by 4, then speed up 2× and Speed up 2×, then shift by 4 and watch where the peak lands.

Order matters

Speeding up squeezes the shift amount too, so the order you apply them in changes the answer.

original x(t)shift, then speed up (correct)speed up, then shift (the mistake)
Peak lands at
t = 3.5
Order
Describe this picture

One plot, amplitude against time in seconds, building y(t)=x(2t−4)y(t) = x(2t - 4) from a pulse x(t)x(t) that peaks at t=3t = 3, drawn faint and labelled “original x(t)”. Two “Order” buttons choose “Shift by 4, then speed up 2×”, labelled “shift, then speed up (correct)”, or “Speed up 2×, then shift by 4”, labelled “speed up, then shift (the mistake)”; the other order stays faint behind the one you chose. The “Peak lands at” readout shows t=3.5t = 3.5 for the first and t=5.5t = 5.5 for the second.

The peak lands at t=3.5t = 3.5 for one order and t=5.5t = 5.5 for the other: the same two numbers, 4 and 2, put the peak in two different places.

Combining shift and scale, freely

Once you fix the order (shift first, then scale), you can choose any shift and any scale and predict where a marked feature lands, using the same reasoning as above: add the shift to the peak’s time, then divide by the scale.

Drag Shift and Speed to a few different settings and read Peak lands at each time. It always matches (the peak’s old time + shift) ÷ speed, the same rule you worked out by hand above.

Shift and speed, together

Always shift first, then scale: the peak's new time is exactly predictable.

original x(t)shifted, then sped up
Peak lands at
t = 2.0
1.0 s
2.0×
Describe this picture

One plot, amplitude against time in seconds, of the original pulse x(t)x(t), peak at t=3t = 3, drawn faint, and the pulse shifted, then sped up. The “Shift” slider runs from 0 to 3 s and starts at 1.0 s; the “Speed” slider runs from 0.5× to 3× and starts at 2.0×. The “Peak lands at” readout starts at t=2.0t = 2.0.

The maths behind it · shift and flip matrices

If you write a discrete-time signal as a list of its samples, shifting it by one step is the same as multiplying that list by a matrix that moves every entry over by one row. Reversal is multiplying by the matrix that flips the row order. Linear algebra builds on this idea of a move as a matrix.

Worked example

Take x[n]=1,3,2,5,4,6x[n] = 1, 3, 2, 5, 4, 6 for n=0,1,…,5n = 0, 1, \dots, 5 (zero elsewhere).

Shift. y[n]=x[n−2]y[n] = x[n-2] moves every value two samples later: y=1,3,2,5,4,6y = 1, 3, 2, 5, 4, 6 for n=2,3,…,7n = 2, 3, \dots, 7.

Reversal. y[n]=x[−n]y[n] = x[-n] mirrors the sequence about n=0n = 0: y=6,4,5,2,3,1y = 6, 4, 5, 2, 3, 1 for n=−5,−4,…,0n = -5, -4, \dots, 0.

Scaling. y[n]=x[2n]y[n] = x[2n] keeps every second sample: y[0]=x[0]=1y[0] = x[0] = 1, y[1]=x[2]=2y[1] = x[2] = 2, y[2]=x[4]=4y[2] = x[4] = 4, so y=1,2,4y = 1, 2, 4 for n=0,1,2n = 0, 1, 2. The samples x[1],x[3],x[5]x[1], x[3], x[5] are skipped.

Where you’ll meet this

Every one of these three moves comes back constantly. An echo or a room’s reverb is built out of shifted, weaker copies of a signal added together, an idea that grows into Discrete convolution (5.2). A phone’s “play at 2×” button is scaling in action. When you meet Sinusoids (3.2), you’ll see that sliding one in time is the same as changing its phase. And any time you resample a recording to a different rate, you are scaling time and meeting the “skip versus fill in” trade-off from this page.

Reference card

TransformationContinuousDiscreteEffect
Shifty(t)=x(t−t0)y(t)=x(t-t_0)y[n]=x[n−n0]y[n]=x[n-n_0], whole number n0n_0t0>0t_0>0 (or n0>0n_0>0): later (delay); t0<0t_0<0: earlier (advance)
Reversaly(t)=x(−t)y(t)=x(-t)y[n]=x[−n]y[n]=x[-n]mirror image about t=0t=0 (or n=0n=0)
Scalingy(t)=x(at)y(t)=x(at)y[n]=x[Mn]y[n]=x[Mn], whole number M≥1M\ge1 (speeding up only)a>1a>1 (or M>1M>1): faster, skips samples; 0<a<10<a<1: slower; in discrete time this needs new in-between samples
Combined (shift, then scale)y(t)=x(at−t0)y(t)=x(at-t_0), built as g(t)=x(t−t0)g(t)=x(t-t_0) then y(t)=g(at)y(t)=g(at)—shifting after scaling instead needs a shift of t0/at_0/a, not t0t_0

End of lesson 2.1

Where to go next.

Phasorium
LibraryEvery lesson, in order

Parts

About Phasorium
Look