# Periodicity of sum of discrete signals

In my lecture slides for school and from this website here

"The sum $$z[n] = x[n] + y[n]$$ of periodic signals $$x[n]$$ with fundamental period $$N1$$, and $$y[n]$$ with fundamental period $$N2$$ is periodic if the ratio of periods of the summands is rational, i.e., $$\frac{N2}{N1}=\frac{p}{q}$$ and $$p$$ and $$q$$ are integers not divisible by each other. If so, the fundamental period of $$z[n]$$ is $$qN2 = pN1$$."

I'm confused with a number of things. First if $$y[n]$$ and $$x[n]$$ were periodic, then wouldn't the ratio of their periods $$\mathbf{always}$$ be rational since each period is always integer? Also if each signal is not periodic then this would imply their sum could be $$cos[n]+cos[n]=2cos[n]$$ is not rational but the ratio of their "periods" is $$1$$ which is rational. So, I'm assuming that this requirement is just redundant if the original signals are periodic?

First if y[n] and x[n] were periodic, then wouldn't the ratio of their periods always be rational since each period is always integer?

No. I mean. Yes.

$$x(t)$$ might be e.g. $$2\pi T$$-periodic, and $$y(t)$$ could be $$5T$$-periodic ($$T$$ being the sample period). The choice of using capital $$N$$ for the period was a confusing one, but signals don't need to have integer sample-multiples as periods.

BUT, and that's where I'm with you, if you say $$x[n]$$ is periodic, it means the sampled signal $$x[n]$$ is periodic – which it can't be, if the original sample would have a rational-amount-of-samples period.

And thus, you're right: if the sampled signals are periodic, they need to have a rational ratio in periods, and thus, their sum will always also be periodic.

• how can a discrete signal have a non integer period. Isn't the period defined $x[n+N]=x[n]$ for smallest value $N$. If $N$ were not an integer, then how would you compute $x[N]$ ? – Colin Hicks Mar 12 '19 at 22:40
• ??? exactly what I wrote. – Marcus Müller Mar 12 '19 at 22:43
• Oh wait, I think I get what you're trying to say. You were referencing the underlying continuous signal each discrete signal is sampling. – Colin Hicks Mar 12 '19 at 22:43
• yep, that's why I made the distinction between $x(t)$ and $x[n]$. – Marcus Müller Mar 12 '19 at 22:44
• @MarcusMüller Is it reasonable to conclude from your argument that sampling a sine wave of frequency $\sqrt{2}$ always results in a non-periodic signal? – MBaz Mar 13 '19 at 0:00

It is a commonly understood (but not necessarily universally followed) convention that square brackets as in $$x[n]$$ means discrete-time signals where $$n$$ is an integer (in accordance with the common convention that variables denoted by the letters $$i,j,k,l,m,n$$ or $$I,J,K,L,N$$ (or variable names beginning with those letters) are generally used for integer-valued variables (though $$j$$ is often reserved for the square root of $$−1$$ in DSP circles). Thus, $$x[n]$$ is the $$n$$-th element (remember that $$n$$ is an integer) of the sequence $$x$$ where $$x$$ understood to be a mapping from $$\mathbb Z$$ to $$\mathbb R$$ or to $$\mathbb C$$.

The sequence $$x$$ is said to have period $$N$$ (or to be periodic with period $$N$$) if there exists a positive integer $$N$$ such that $$x[n+N] = x[n] ~ \text{for all} ~ n \in \mathbb Z.\tag{1}$$

Now, if $$x$$ has period $$N$$, then it also can be said to have period $$kN$$ where $$k$$ is a positive integer. The smallest integer that is a period of a periodic sequence is called the fundamental period of the sequence, and all other possible periods are necessarily integer multiples of the fundamental period.

Thus, if $$x$$ and $$y$$ are periodic sequences with fundamental periods $$N_1$$ and $$N_2$$ respectively, then their sum $$z$$ (that is, $$z[n] = x[n]+y[n]$$ for all $$n \in \mathbb Z$$) is also a periodic sequence with a period equal to the least common multiple $$\operatorname{lcm}(N_1, N_2)$$ of $$N_1$$ and $$N_2$$.

The fun starts when people start thinking of sampling continuous-time signals $$x(t)$$ and $$y(t)$$ once every $$T_s$$ seconds and calling the sample values $$x[n]$$ and $$y[n]$$, e.g.

$$x[n] = x(nT_s), ~ y[n] = y(nT_s), ~ \text{for all} ~ n \in \mathbb Z.\tag{2}$$

Now, a continuous-time signal $$x(t)$$ is said to be periodic with period $$T_0$$ if there is a positive real number $$T_0$$ such that $$x(t+T_0) = x(t)$$ for all $$t\in \mathbb R$$, and, as with sequences, we can define the fundamental period of a periodic signal as the smallest of all the possible periods of the signal (and all other periods are multiples of the fundamental period). But,

If $$x(t)$$ is a periodic continuous-time signal with fundamental period $$T_0$$, then it is not necessary that the sampled sequence $$x$$ (where $$x[n] = x(nT_s)$$) be a periodic sequence.

The canonical example is $$\cos(t)$$ which is a continuous-time signal with fundamental period $$2\pi$$ sampled once per second to give $$\cos[n]$$ which is not a periodic sequence. (It breaks down right at $$n=0$$, there is no integer $$N$$ such that $$\cos[0+N] = \cos(N)$$ equals $$\cos = \cos(0) = 1$$). "But, but, but," you splutter, "you aren't sampling at or above the Nyquist rate!" Well, the Nyquist rate has nothing to do with the matter since we are not interested in reconstruction or perfect representation etc, but you can take any rational sample interval $$\ll 1$$ that you like and you still won't get a periodic sequence out of $$\cos(t)$$ (or any other continuous-tine periodic signal, for that matter) unless the ratio $$T_0/T_s$$ of signal period $$T_0$$ to sampling interval $$T_s$$ is a rational number.