# Help with finishing this integral, to obtain the power spectral density of a pure cosine wave

I am trying to evaluate the power spectral density $$S_{xx}(f)$$ of a cosine signal $$x(t) = A\cos(2\pi f_0t)$$, by starting from its definition for deterministic power signals $$S_{xx}(f) = \lim_{T\rightarrow\infty}\frac{1}{T}\left|X_{T}(f) \right|^2\;, \tag{1}$$ where $$X_T(f)$$ is the Fourier transform of a signal $$x(t)$$ which has been truncated to a time window $$T$$, given by $$X_T(f) = \int_{-T/2}^{T/2}x(t)\;e^{-2\pi if t}\;dt \;.\tag{2}$$

I know that the answer should be $$S_{xx}(f) = \frac{A^2}{4}\bigg[\delta(f-f_o) + \delta(f+f_o)\bigg]\;,\tag{3}$$ but I am stuck with my working. Can anyone check it so far, and help me fill in the gaps? Perhaps my mathematics is not as good as it ought to be!

\begin{align} S_{xx}(f) &= \lim_{T\rightarrow\infty}\frac{1}{T}\left|X_{T}(f) \right|^2\ \tag{4} \\ &= \lim_{T\rightarrow\infty}\frac{1}{T}\left[ \int_{-T/2}^{T/2}x(t)\;e^{-2\pi if t}\;dt \int_{-T/2}^{T/2}x^\ast(t')\;e^{2\pi if t'}\;dt' \right] \tag{5} \\ &= \lim_{T\rightarrow\infty}\frac{1}{T}\left[ \int_{-T/2}^{T/2}\int_{-T/2}^{T/2} A^2\cos(2\pi f_0t)\cos(2\pi f_0t')\;e^{2\pi if(t'-t)}\;dt \;dt'\right] \tag{6} \\ &= \lim_{T\rightarrow\infty}\frac{A^2}{2T}\left[ \int_{-T/2}^{T/2}\int_{-T/2}^{T/2} \Big[\cos\big(2\pi f_0(t+t')\big) + \cos\big(2\pi f_0(t'-t)\big)\Big]\;e^{2\pi if(t'-t)}\;dt \;dt'\right] \tag{7} \end{align} where the last line is obtained by using the product-to-sum identity for cosines. Now, I'm a little stuck. I can make the substitution $$\tau = t'-t$$, which simplifes the exponential

$$S_{xx}(f) = \lim_{T\rightarrow\infty}\frac{A^2}{2T}\left[ \int_{-T/2-t}^{T/2-t}\int_{-T/2}^{T/2} \Big[\cos\big(2\pi f_0(2t+\tau)\big) + \cos\big(2\pi f_0\tau\big)\Big]\;e^{2\pi if\tau}\;dt \;d\tau\right] \tag{8}$$

but now I am not sure how to proceed. I can also replace my cosines with complex exponentials to obtain

$$\lim_{T\rightarrow\infty}\frac{A^2}{4T}\left[ \int_{-T/2}^{T/2}\int_{-T/2}^{T/2} \Big[ e^{2\pi if_0(t+t')} + e^{2\pi if_0(t-t')} +e^{2\pi if_0(t'-t)}+e^{-2\pi if_0(t+t')} \Big]\;e^{2\pi if(t'-t)}\;dt \;dt'\right]$$

Can someone teach me how to finish this? Ideally I would like it if someone could show me how to evaluate it in terms of $$T$$, and then show how the $$\delta$$ functions arise as we finally take the limit $$T\rightarrow\infty$$.

• In line (6) try substituting in $$\cos( \theta ) = \frac{e^{i\theta}+e^{-i\theta}}{2}$$ for each of your cosine terms. This will make your resultant integral that of a sum of exponents after multiplying them all out which should be easily evaluated. – Cedron Dawg Apr 1 at 17:45
• Also, if you do your variable substitution you have to adjust the limits on your integral as well. – Cedron Dawg Apr 1 at 17:53
• I have done as you suggested (see edit), but again need a hint! Thanks! – teeeeee Apr 1 at 18:39
• It looks like you did the substitution on line (7) instead, but that should work as well. You still need to adjust the limits after your substitution. Move the brackets inside around the inner integral, then solve that first. $$\int e^{ax} dx = \frac{1}{a} e^{ax} + C$$ You need to do the definite integral version of that for each term. – Cedron Dawg Apr 1 at 18:44
• That 2 came from the transition from (6) to (7). Yes, you are going to get some ugly exponential expressions, but they are solvable. We are getting the chat prompt. I'm going to take the dog for a walk, back in about an hour. – Cedron Dawg Apr 1 at 19:16

You don't need to make it so complicated as to use two variables $$t$$ and $$t^\prime$$.

\begin{align} X_T(f) &= \int_{-T/2}^{T/2} x(t)\exp(-j2\pi ft)\,\mathrm dt\\ &= \int_{-T/2}^{T/2}\frac{\exp(j2\pi f_0t)+\exp(-j2\pi f_0t)}{2}\exp(-j2\pi ft)\,\mathrm dt\\ &= \frac 12\int_{-T/2}^{T/2} \exp(j2\pi (f_0-f)t)+\exp(-j2\pi (f_0+f)t)\,\mathrm dt\\ &= \frac 12 \left[\frac{\exp(j2\pi (f_0-f)t)}{j2\pi(f_0-f)}~ + ~\frac{\exp(j2\pi (f_0+f)t)}{j2\pi(f_0+f)}\right\vert_{-T/2}^{T/2}\\ &= \frac 12 \left[\frac{\exp(j\pi (f_0-f)T)-\exp(-j\pi (f_0-f)T)}{j2\pi(f_0-f)}\right.\\ &\qquad\qquad + \left.\frac{\exp(j\pi (f_0+f)T)-\exp(-j\pi (f_0+f)T)}{j2\pi(f_0-f)}\right]\\ &= \frac T2 \big(\operatorname{sinc}((f_0+f)T) ~+ ~\operatorname{sinc}((f_0-f)T)\big)\\ &= \frac T2 \big(\operatorname{sinc}((f-f_0)T) ~+ ~\operatorname{sinc}((f+f_0)T)\big). \end{align} So we get \begin{align}\frac 1T\big|X_T(f)\big|^2 &= \frac T4 \big(\operatorname{sinc}^2((f-f_0)T) ~+ ~(\operatorname{sinc}^2((f+f_0)T)\\ &\qquad\qquad + 2\operatorname{sinc}((f-f_0)T)(\operatorname{sinc}((f+f_0)T)\big) \end{align} In the frequency domain, the two $$\operatorname{sinc}^2$$ functions are of height $$\frac T4$$, are centered at $$\pm f_0$$ with central lobes of width $$\frac 2T$$ Hz. As $$T \to \infty$$, the central lobe widths shrink to $$0$$ and it is straightforward to show that for any value of $$f$$ other than $$\pm f_0$$, $$\lim_{T\to\infty} \frac 1T\big|X_T(f)\big|^2 =0, ~ f \neq \pm f_0.$$ Now, $$\frac 1T|X_T(\pm f_0)|^2$$ diverges to $$\infty$$ and with the usual trick of pulling a Dirac delta out of the hat in such cases, we get that it must be that $$S_{xx}(f) = \lim_{T\to\infty} \frac 1T|X_T(f)|^2 = \frac 14 \big(\delta(f-f_0) + \delta(f+f_0)\big), ~~ \text{when} ~x(t) = \cos(2\pi f_0 t).$$

• Looks like you took that step back and did (2). You missed a factor of T when you went to $sinc$. Without it, the limit of (4) goes to zero. – Cedron Dawg Apr 1 at 20:30
• Can you include the full steps - in particular how you would then take this solution and use it to evaluate $$S_{xx}(f) = \lim_{T\rightarrow\infty}\frac{1}{T}\left|X_{T}(f) \right|^2$$ I would like to see how you take your answer and multiply it by its complex conjugate and then take the T to infinity limit as the final step. I think that's what leads to it being so complicated, and don't know how to avoid it. – teeeeee Apr 1 at 21:01
• Yes, but I want to show explicitly how what happens to the term $$2\operatorname{sinc}((f-f_0)T)\operatorname{sinc}((f+f_0)T)$$ as $T$ goes to $\infty$. That's what I'm not sure how to prove. You say it is straightforward to show...? Thank you! – teeeeee Apr 2 at 8:28
• When you are doing the integration step, you dropped a sign in the $f+f_0$ term. It turns out to be inconsequential to the final result as it will cancel in the next steps. – Cedron Dawg Apr 2 at 14:16

The secret to proving the limit is to not convert the $$sin$$ to $$sinc$$. This leaves the $$T$$ in the argument and not outside. No need to worry about the complex conjugate as the values are real. The $$sin$$ values are bounded by -1 and 1.

At that point it becomes:

\begin{align} 0 \le S_{xx}(f) &= \lim_{T\rightarrow\infty}\frac{1}{T}\left|X_{T}(f) \right|^2 \\ &= \lim_{T\rightarrow\infty}\frac{1}{T}\left( \frac{ \sin(\pi(f_0-f)T)}{\pi(f_0-f)} + \frac{ \sin(\pi(f_0+f)T)}{\pi(f_0+f)} \right)^2 \left( \frac{A}{2} \right)^2 \\ &\le \lim_{T\rightarrow\infty}\frac{1}{T}\left( \frac{1}{\pi|f_0-f|} + \frac{1}{\pi|f_0+f|} \right)^2 \left( \frac{A}{2} \right)^2 \\ &= \lim_{T\rightarrow\infty}\frac{1}{T}\left( \frac{1}{|f_0-f|} + \frac{1}{|f_0+f|} \right)^2 \left( \frac{A}{2\pi} \right)^2 \\ \end{align}

If $$f \ne f_0$$ and $$f \ne -f_0$$ the limit will be zero. Otherwise, a Dirac delta.

I seem to get an extra $$\pi$$ compared to what you say the answer should be.

• Hmm, I the reason I said the answer should be that is because I know the average power of a cosine wave is $P=A^2/2$ (dsp.stackexchange.com/q/64833/38419). Therefore, when we integrate this final power spectral density result over frequency, it should give the correct power. I don't undestand the $\pi$... Does it somehow cancel with the $\pi$ in the sin terms when you take a limit? – teeeeee Apr 2 at 11:48
• Like $\sin(x)\approx x$ for small $x$? – teeeeee Apr 2 at 11:56
• No, I don't think that is it. I don't work with the continuous FT all that much or I would have started you with the (2) evaluation first. Reviewing the math here, I found a small error in the integration which just flips a sign, but that has no impact at the end. I'll look for a little while longer, then Dan B can come in and save the day. – Cedron Dawg Apr 2 at 11:59
• The difference between your line (2) and line (4) is simply that you have dropped the sin numberators. Are you convinced that you can simply do that? – teeeeee Apr 2 at 12:12
• $$\lim_{f\rightarrow f_0} \frac{ \sin(\pi(f_0-f)T)}{\pi(f_0-f)} = \lim_{f\rightarrow f_0} T \frac{ \sin(\pi(f_0-f)T)}{\pi(f_0-f)T} = T$$ – Cedron Dawg Apr 2 at 13:21