In this course (Coursera: Audio Signal Processing for Music Applications) the professor derives a general equation for finding the DFT for real sinusoids:
DFT of real sinusoids \begin{align} x_3[n]&= A_0\cos\left(2\pi k_0 n/N\right)=\boxed{\frac{A_0}{2}e^{j2\pi k_0 n/N} +\frac{A_0}{2}e^{-j2\pi k_0 n/N}}\\ X_3[k]&=\sum_{n=-N/2}^{N/2-1} x_3[n]e^{-j2\pi k n/N}\\ &=\sum_{n=-N/2}^{N/2-1}\left(\frac{A_0}{2}e^{j2\pi k_0 n/N} +\frac{A_0}{2}e^{-j2\pi k_0 n/N}\right)e^{-j2\pi k n/N}\\ &=\sum_{n=-N/2}^{N/2-1}\frac{A_0}{2}e^{j2\pi k_0 n/N}e^{-j2\pi k n/N} +\sum_{n=-N/2}^{N/2-1}\frac{A_0}{2}e^{-j2\pi k_0 n/N}e^{-j2\pi k n/N}\\ &=\sum_{n=-N/2}^{N/2-1}\frac{A_0}{2}e^{-j2\pi\left(k-k_0\right) n/N}+\sum_{n=-N/2}^{N/2-1}\frac{A_0}{2}e^{-j2\pi\left(k+k_0\right) n/N}\\ &=N\frac{A_0}{2}\text{ for }k=k_0,-k_0; 0\text{ for the rest of }k \end{align}
Keeping this in mind, given a discrete signal $x[n]$ that has 4 samples given as: $[1, -1, 1, -1]$
the equation from the slide can be used to represent our signal as: \begin{align} x[n] &= {A_0\over2}e^{j2 \pi k_0 n/N} + {A_0\over2}e^{-j2 \pi k_0 n/N}\\ &= {e^{j 4 \pi n/4}\over2} + {e^{-j 4 \pi n/4}\over2}\\ &= {e^{j \pi n}\over2} + {e^{-j \pi n}\over2} \end{align}
And now again, calculating $X[2]$ with the equations from the same slide:
\begin{align} X[2]&=\sum_{n=-N/2}^{N/2-1} \left({e^{j \pi n}\over2} + {e^{-j \pi n}\over2} \right) e^{-j2\pi kn/N}\\ &=\sum_{n=-N/2}^{N/2-1} \left({e^{j \pi n}\over2} + {e^{-j \pi n}\over2} \right) e^{-j4\pi n/4}\\ &=\sum_{n=-N/2}^{N/2-1} \left({e^{j \pi n}\over2} + {e^{-j \pi n}\over2} \right) e^{-j\pi n}\\ &=\sum_{n=-N/2}^{N/2-1} {e^{j (\pi n - \pi n)}\over2} + {e^{-j 2 \pi n}\over2}\\ &= \frac N2 + \frac N2\\ &= N \end{align}
But this contradicts the last line on the slide that says $X[2]$ should be $N{A_0\over2}$.
Are the slides wrong?
I'm also having trouble figuring proving/understanding the following equality from the lecture slide:
$$\sum_{n=-N/2}^{N/2-1} {A_0\over2} e^{-j2\pi(k-k_0)n/N} + \sum_{n=-N/2}^{N/2-1} {A_0\over2} e^{-j2\pi(k+k_0)n/N} = N\frac{A_0}{2}\text{ for } k=k_0, -k_0$$
PS: From the same course, some slide from a another lecture show these equations that are consistent with my derivation (see equation for $<x,s_2>$)
DFT: scalar product: $$ \boxed{<x, s_k>=\sum_{n=0}^{N-1}x[n]s_k^{*}[n]=\sum_{n=0}^{N-1}x[n]e^{-j2 \pi k n/N}} $$ Example:
$$x[n]=[1, -1, 1, -1]; N=4$$
\begin{align} <x, s_0>&=1*1 +(-1)*1 + 1*1 + (-1)*1 =0\\ <x, s_1>&=1*1 +(-1)*(-j) + 1*(-1) + (-1)*j =0\\ <x, s_2>&=1*1 +(-1)*(-1) + 1*1 + (-1)*(-1) =4\\ <x, s_3>&=1*1 +(-1)*j + 1*(-1) + (-1)*(-j) =0\\ \end{align}
>
if you want to preserve authenticity, and then add a link to the source. In this way all questions are standardized. $\endgroup$