A pulse and a clock
Our signal is a short smooth pulse, x(t) = 3·sinc²(3t), with t in milliseconds. Its spectrum X(f) is a triangle: it holds every frequency from 0 up to B = 3 kHz and nothing above. Such a signal is called band-limited.
The sampling clock makes very short pulses (impulses), one every Ts = 0.125 ms, so fs = 8 kHz. Its spectrum is also a row of thin lines: one at every multiple of fs, at 0, ±8, ±16 kHz and so on.
The sampler multiplies x(t) by the pulse train. Where a pulse sits, the product keeps the value x(n·Ts). Everywhere else it is zero. What is left is the samples, x[n] = x(n·Ts), as a train of weighted pulses.
Copies in the spectrum
Multiplying in time means convolving in frequency. Convolving X(f) with a line at k·fs slides a copy of X(f) to k·fs. So the samples' spectrum is X(f) repeated every 8 kHz: same shape, centred on 0, ±8, ±16 kHz.
Each copy reaches 3 kHz either side of its centre. With fs = 8 kHz the first copy starts at 8 − 3 = 5 kHz, above B = 3 kHz. A 2 kHz gap separates the copies. Nothing overlaps, so nothing is lost.
A low-pass filter passes only frequencies below fs/2 = 4 kHz, with gain Ts. It keeps the middle copy and blocks the rest. What comes out is X(f) again, so x(t) comes back exactly, from the samples alone.
Sampling too slowly
Now slow the clock from 8 down to 4 kHz. Fewer samples per millisecond, and the lines, with their copies, move closer together. At fs = 2B = 6 kHz the copies just touch at 3 kHz. Below that they run into each other.
At fs = 4 kHz the copy centred on 4 kHz reaches down to 1 kHz. From 1 to 3 kHz two copies add, and the sum is a flat shelf at 2/3. High frequencies now pose as low ones. This mixing is aliasing.
The filter now passes below fs/2 = 2 kHz. Inside it the shelf is wrong (2/3 where X(f) falls to 1/3), and 2 to 3 kHz is gone. The rebuilt pulse misses x(t), and no filter can undo the overlap.
Check and rule
With numpy, compute the spectrum straight from the samples, as a sum over n. At 1, 7 and 9 kHz it prints 0.667 each time: X(1 kHz) = 1 − 1/3, repeated around 8 kHz. The copies are really there.
The copies stay apart when fs > 2B, the Nyquist rate. Then an ideal low-pass at fs/2 rebuilds x(t). If fs is fixed, remove everything above fs/2 before sampling, with an anti-alias filter.
The working
# step 1/11 · signal
x(t) = B·sinc²(B·t), B = 3 kHz, t in ms
sinc(u) = sin(πu) / (πu)
X(f) = 1 − |f| / B for |f| < 3 kHz
= 0 above
x(0) = 3 (peak); X(0) = 1
band-limited: nothing above B = 3 kHz
(pair: sinc² <-> triangle)
The pulse x(t) = 3·sinc²(3t) is chosen because its spectrum is an exact triangle up to 3 kHz; the rates 8 and 4 kHz keep the numbers small (Oppenheim & Willsky, ch. 7). Every curve and value in the figure is computed from this model. The spectrum plot shows Ts·Xs(f), the sum of the copies, so every copy keeps height 1; the true Xs(f) is fs times taller. The comb lines stand for impulses and are drawn at height 1.