# Understanding the mathematical proof for the alias frequencies in a sampled sine wave

I'm struggling to get my head round the mathematical proof for the alias frequencies in a sampled sine wave.

I understand that sampling a sine wave of frequency $f_0$ every $t_s$ seconds gives you:

$$x[n]=\sin(2\pi f_0nt_s)$$

I also understand that, because the sine wave is periodic every $2\pi$, you can add any multiple of $2\pi$ to the angle and get the same values for the sine, i.e.,

$$\sin(2\pi f_0nt_s)=\sin(2\pi f_0nt_s+2\pi m) \quad\text{(where m is any integer).}$$

The proof I'm looking at then factors out $2\pi$ and $nt_s$ to get:

$$\sin\left(2\pi(f_0+\frac{m}{nt_s})nt_s\right)$$

...but then it says to let $m$ be an integer multiple of $n$ so we can replace the $\frac{m}{n}$ ratio with an integer $k$.

I don't understand how $m$ can go from being "any integer" to "an integer multiple of $n$". If $m$ is any integer and $n$ is an integer then how can the ratio between them be an integer?

I know I'm missing something obvious here and I'm searching for that light-bulb moment but it's not happening. Because this is so fundamental to DSP I don't just want to accept the formula and move on without thoroughly understanding it.

• Can you provide a link to the whole proof? Nov 11, 2017 at 20:31
• @oxuf I don't have a link, I'm afraid. It's in a book "Understanding Digital Signal Processing by Richard G. Lyons".
– IanR
Nov 12, 2017 at 12:23

The reason is that if it is true for any $m$, it is also true for $m=kn$.

I will sketch the proof in another way.

Call $f_s = 1/t_s$ sampling frequency where $t_s$ is sampling period, the two signal $x(t) = \sin(2\pi f_0 t)$ and $x_k(t) = \sin(2\pi (f_0 + k f_s) t)$ have the same values at sampling instants (aliasing), i.e. $x[n] = x_k[n]$.

Indeed,

\begin{align} x[n] &= \sin (2 \pi f_0 n t_s) \\ x_k[n] &= \sin \left(2 \pi (f_0 + k f_s) n t_s\right) \\ &= \sin (2 \pi f_0 n t_s + 2\pi k f_s n t_s) \\ &= \sin (2 \pi f_0 n t_s + 2\pi k n) = \sin (2 \pi f_0 n t_s)\\ &=x[n] \end{align}

• Thanks for the help. I can see that if you work backwards you can show that for every value of k you get an alias frequency, but does that mean there might be other values of m that we've ignored that might also produce an alias frequency? Sorry - I'm sure I'm missing something quite fundamental and obvious. Maybe I just need to keep experimenting by plugging different values in the formulas and see which ones do/don't create alias frequencies.
– IanR
Nov 12, 2017 at 12:28
• Try changing $k f_s$ by an arbitrary $\Delta f$ and calculate the substraction $x[n] - x_{\Delta f}[n]$. To have alias, the substraction needs to be equal to 0 for all $n$ then $\Delta f$ must be a multiple of $1/t_s$. Nov 12, 2017 at 12:51
• Thanks @AlexTP that's a useful way to look at it. It also helped me see what the mathematical proof was getting at as well. If $\Delta f=\frac{m}{nts}=\frac{m}{n}f_s$ then $m=n\frac{\Delta f}{f_s}$ and the only way for $m$ to be an integer for all $n$ is if $\frac{\Delta f}{f_s}$ is also an integer, $k$. $\frac{\Delta f}{f_s}=k$ so $\Delta f=kf_s$
– IanR
Nov 13, 2017 at 13:06
• @AlexTP: your answer was great but is it independent of the nyquist frequency. you didn't mention nyquist so my guess is yes. thanks. Nov 14, 2017 at 8:15
• @markleeds it's my understanding (which admittedly is still very limited) that this formula kind of leads you to the Nyquist frequency. It's showing that, when sampling, you'll get spectral replications in the frequency domain every $f_s$, so then you need to choose a value for the sampling rate $f_s$ such that the replications won't interfere with other giving aliasing errors in your band of interest.
– IanR
Nov 14, 2017 at 12:29

I think the reason why the originally referenced proof feels unintuitive and unsatisfying is that upon first read it appears they are selecting any old integer that may satisfy the proof (the integer multiple of $$n$$ really bothered me when I first looked at). In actuality, however, they are selecting the exact and only integers that satisfy the proof for a given $$k$$ in $$\sin(2 \pi (f_0 + f_s k)n / f_s)$$. For each sample, the $$f_0 + f_sk$$ frequency goes through exactly $$nk$$ cycles more than $$f_0$$ does, and so reaches the same value at the sample.

In my opinion, graphing this really helps, so let's consider a situation where we are sampling $$32$$ times a second and start with a base frequency of $$4$$Hz. Taking $$k=1$$, we can graph frequency $$f_0=4$$ and $$f_1=4 + 32 \cdot 1$$, and mark the sample points:

Taking a look at the first two non-zero samples, you can see that $$f_1 = 4 + 32\cdot 1$$ goes though exactly $$1$$ and $$2$$ more cycles than $$f_0$$ respectively. This makes sense because $$k=1$$ and for the first sample $$n=1$$ and for the second $$n=2$$.

Next $$f_0=4$$ and $$f_2=4 + 32 \cdot 2$$:

Now $$k=2$$, and we see for $$n=1$$, $$f_2= 4+32 \cdot 2$$ goes through $$2$$ extra cycles for $$n=1$$ and $$4$$ extra cycles for $$n=2$$, and so on, all equal to $$nk$$. This is true for any integer $$n$$ and any integer $$k$$.

Key: