I want to find a DFT of a pure cosine wave cos(θ) sampled at N equally spaced points on the interval $[0, 2\pi)$

so for our cosine wave, I put my $x$ like this


then I just put it in DFT formula

$X[k]=\sum \cos(\phi)𝑒^{−j2\pi kn/N}$

and use euler furmula

$\cos(\theta) = (e^{j\theta} + e^{-j\theta})/2$

now we have

$X[k]=\sum(e^{j\theta} + e^{-j\theta})/2.(e^{−j2\pi nk/N})$

mathematically we can move 1/2 before $\sum$ and separate the $\sum$ like down(because we have + )

$X[k]=1/2\sum(e^{j\theta})(e^{−j2\pi nk/N})+1/2\sum(e^{-j\theta})(e^{−j\pi nk/N})$

know I do not know if I doing this right or not!?

and what should I do next?

  • 3
    $\begingroup$ You probably need to try again with $cos[\omega n]$, since cos($\theta$) is a constant since it is not a function of any independent variable n. $\endgroup$
    – DSP Rookie
    Apr 5, 2020 at 22:55
  • $\begingroup$ Decide a digital frequency $\omega$ of your cosine wave and then compute it's DFT. $\endgroup$
    – DSP Rookie
    Apr 5, 2020 at 22:57
  • 2
    $\begingroup$ Spoiler alert: dsprelated.com/showarticle/771.php and dsprelated.com/showarticle/1120.php You got to (14) in the first article. The simplification of (16) has great significance. $\endgroup$ Apr 6, 2020 at 1:05
  • 1
    $\begingroup$ Side note to the downvoter I reversed. Why would you want to stifle this kind of inquiry? This is the fundamental question to understanding the behavior of a DFT: How does a single pure tone behave in it? It is what the alphabet is to spelling, what words are to writing, and just below what notes are to chords. $\endgroup$ Apr 6, 2020 at 1:24

2 Answers 2


If you want to take DFT of a cosine wave $cos(\theta)$ sampled at N equally spaced values between $[0, 2\pi]$, then you need to consider taking N-point DFT of the sequence : $$x[n] = cos[2\pi \frac{n}{N}], n = 0,1,2,...,N-1$$

<span class=$cos(\theta)$">

And, for this $x[n]$, you dont even have to apply the DFT formula. It can be done pretty simply by using the Euler's formula $$cos(\theta) = \frac{e^{j\theta} + e^{-j\theta}}{2}$$. $$x[n] = cos[2\pi \frac{n}{N}] = \frac{e^{j2\pi\frac{n}{N}} + e^{-j2\pi\frac{n}{N}}}{2} = \frac{e^{j2\pi\frac{n}{N}} + e^{j2\pi\frac{n.(N-1)}{N}}}{2}$$ Now, see the above expression as Invere DFT and figure out that $X[k]$ will be non-zero only for 2 values of $k$, i.e. $k=1$ and $k= (N-1)$. But the magnitude of $X[1]$ and $X[N-1]$ won't be $\frac{1}{2}$.

I think you can do it now yourself to figure out the magnitude of $X[1]$ and $X[N-1]$.

Hint: The Magnitude will get scaled by the length of DFT.

  • $\begingroup$ "figure out that X[k] will be non-zero only for 2 values of k, i.e. k=1 and k=(N−1)", what is the reason for this? I am not able to see it. $\endgroup$ Jan 24 at 14:35
  • $\begingroup$ @OuttaSpaceTime If you observe the Euler's formula expansion of $cos[2\pi\frac{n}{N}]$, there are only 2 terms. And these terms can be viewed as if Inverse DFT summation has been spread with all the terms equal to 0 except for $k=1$ and $k=N-1$. $\endgroup$
    – DSP Rookie
    Jan 25 at 9:29

Your $\theta$ is not a function of n sample number. After sampling, any continuous function $x(t)$ becomes a function of n $x(nT_s)$ where $T_s$ is the sampling period. If $f$ if the frequency of the cosine signal in Hz, the discrete cosine signal can be expressed as $cos[2 \pi fn/N]$. Now that cosine is a function of n, you can apply the DFT formula.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.