# Autocorrelation of discrete signal $\sin{2\pi fn}$

Determine the autocorrelation $r_{xx}[m]$ of the discrete signal

$$x[n] = (\sin2\pi fn).$$

where $n$ and $m$ are integers.

Using the definition I get

\begin{align} r_{xx}[m] &= \sum_{n=-\infty}^{\infty}x[n]x[n-m] \\ &= \sum_{n=-\infty}^{\infty}\sin(2\pi fn) \sin\big(2\pi f(n-m)\big) \\ &= \sum_{n=-\infty}^{\infty}\sin(2\pi fn) \sin\big(2\pi fn - 2\pi fm\big) \\ \end{align}

but I can't seem to figure it out from here. I've tried using different trigonometric identities without result. I'm guessing it's something simple I'm missing.

• Standard advice: if the answer is complicated in one domain (time or frequency), try in the dual Fourier domain (frequency or time). This can give you either hints, or a proof. – Laurent Duval Mar 28 '18 at 19:24
• @robertbristow-johnson are you sure? I mean, $x[n]$ pretty certainly has a (discrete) power spectral density. And also, Wiener-Kinchin (or pick one of the several spellings I've used over the last couple years) would apply to this, wouldn't it? – Marcus Müller Mar 28 '18 at 19:34
• no, not really :) just that PSD of a discrete periodic signal would be |DFT|² (over a period, of course!), and PSD is the inverse transform of ACF under Wiener-Khinchin (which inherently applies to finite discrete signals) so, $r_{xx}$ should be IDFT(|DFT(x)|²) ? – Marcus Müller Mar 28 '18 at 19:39
• you'll never get his definition of autocorrelation to work for finite power, infinite energy signals. it has to do with how to define the inner product in the Hilbert space of discrete-time power signals vs. the definition of the inner product in the Hilbert space of discrete-time energy signals. those inner product definitions must be different. – robert bristow-johnson Mar 28 '18 at 19:56
• i dunno if i completed this answer that spells out the difference between finite power signals and finite energy signals, but it looks like i did. the point is, with the correct definition of the Hilbert spaces and the different defiintions for inner product for power signals and energy signals, the cross correlation between two discrete-time signals, $x[n]$ and $y[n]$ is always $$r_{xy}[m] \triangleq \langle x[n], y[n-m] \rangle$$ and the autocorrelation is when $x=y$. – robert bristow-johnson Mar 29 '18 at 5:54

well, there's an old trig identity that you learned pre-calculus:

$$\sin(\alpha + \beta) = \sin(\alpha)\cos(\beta) + \cos(\alpha)\sin(\beta)$$

or, alternatively

$$\sin(\alpha) \sin(\beta) = \tfrac12 \big(\cos(\alpha-\beta) - \cos(\alpha+\beta)\big)$$

and you will need to use one of those.

but you have a bigger problem because $x[n] = \sin(2\pi f n)$ is a finite power, infinite energy signal. the definition for autocorrelation is different, i believe for power signals than for energy signals.

the equation for crosscorrelation for power signals is, i believe,

$$r_{xy}[m] \ = \ \lim_{N \to \infty} \ \ \tfrac{1}{2N+1} \sum_{n=-N}^{N}x[n] \overline{y[n-m]}$$

for autocorrelation of a purely real signal

$$r_{xx}[m] \ = \ \lim_{N \to \infty} \ \ \tfrac{1}{2N+1} \sum_{n=-N}^{N}x[n] x[n-m]$$

Correlation is the normalized form of covariance. For zero meaned signals, a correlation of 1 means the two signals are proportional to each other, and -1 means they are negatively proportional. A correlation of 0 means they are orthogonal, i.e. linearly independent.

From this, it is fairly easy to intuit what the answer of the OP's original continuous version of the question was. (I don't know why it was changed it to the discrete case.) Since $fl$, since converted to $fm$, is multiplied by $2\pi$ it is in units of whole cycles. Therefore, when $fl$ is an integer, the autocorrelation is 1. At half values, the autocorrelation is -1. At the odd quarter values, the autocorrelation is 0.

So the answer ought to be: $$r_{xx}(l) = \cos(2\pi fl)$$

If you use r b-j's second trig identity, and his second autocorrelation defintion, this result is fairly easily obtained.

I am sure the former is correct, but not sure about the latter. According to Wikipedia's article the definition for autocorrelation is:

$$\rho_{xx}(m) = \mathbb{E} \left[ ( X_n - \mu_x)( X_{n+m} - \mu_x) \right] / {\sigma_x}^2$$

That's as far as I am taking this.

Hope it helps.

Ced

• There's no single valid definition of autocorrelation. It all depends on the characteristics of the signal. The definition you gave is appropriate for random processes, but the signal in the OP is a deterministic power signal, for which the definition in Robert's answer is appropriate. The third definition is the one given in the OP, which is useful for deterministic signals with finite energy, but it's not applicable to the given signal (because of its infinite energy). – Matt L. Mar 29 '18 at 13:50
• @Matt L., Thanks for the clarification. I have to disagree with you about calling your definitions "correlations". The idea behind a correlation measurement is to give a scale of 1 to -1 from being completely correlated to being inversely correlated. For either Robert's or the OP's definition, if you rescale the signal by two the result will be quadrupled, thus they are not measuring correlation. A correlation measurement should be immune to shifts and rescaling as the Wikipedia definition is. For a stationary process, I have no problem with assuming the means are zero by convention. – Cedron Dawg Mar 29 '18 at 15:55
• Dear DownVoter, I think my answer is rock solid. I gave the meaning, the reasoning, an answer, a method to solve it, and a caveat. What's not to like? – Cedron Dawg Mar 29 '18 at 15:55
• i ain't the downvoter, Ced, and i'll upvote you when i am a little more satisfied with the answer. i would say right offa the bat that the definitions of correlation in statistics have a similarity to that in signal processing but are not the same. in signal processing the definitions of correlation (auto or cross) are similar between energy signals and power signals, but the latter needs to be normalized otherwise there is no convergence of the summations. – robert bristow-johnson Mar 29 '18 at 18:53
• @robert bristow-johnson, I appreciate that. I could easily accept that the difference is that the signal processing definitions assume the means are zero. However, if the result doesn't remain in the 1 to -1 range, I don't think they should be called [cross/auto]correlation functions. I see this stemming from the dot (or inner) product definition: $$\vec a \cdot \vec b = \|a\| \|b\| \cos( \theta )$$ $$\cos( \theta ) = \frac{ \vec a \cdot \vec b }{ \|a\| \|b\| }$$ Whether a finite or infinite domain, summation or integration, you still can't ignore the denominator. Thanks. – Cedron Dawg Mar 29 '18 at 19:37