Showing error energy goes to zero Let
$$\hat{x}[k] = \frac{1}{2\pi}\int_{-W}^{W}X(e^{j\omega})e^{j\omega k}d\omega,\label{ift}\tag1$$
where
$$X(e^{j\omega}) = \sum_{n=-\infty}^{+\infty} x[n]e^{-j\omega n}\label{dft}\tag2$$
Also,
$$d[k] = x[k] - \hat{x}[k]\text.\label{error}\tag3$$

Show that energy of $d[k]$ goes to zero as $W\to \pi$. That is,
$$\lim_{W \to \pi} \sum_{k = -\infty}^{+\infty}|d[k]|^2 = 0\text.$$

My Attempt
Main problem for me is removing magnitude in some way. Writing $|d[k]|^2 = d[k]d^{*}[k]$ complicates equations. Also if we use Parseval's identity, the magnitude is still present. I don't know if we are allowed to move limit inside the summation or not. Even assuming it's possible, I couldn't found a way for calculating $\lim_{W \to \pi} |d[k]|^2$.
HINT: The error energy can be written as
$$\begin{align}\sum_k\big|d[k]\big|^2&amp;=\sum_k\left|x[k]-\frac{1}{2\pi}\int_{-W}^W\sum_nx[n]e^{-jn\omega}e^{jk\omega}d\omega\right|^2\\&amp;=\sum_k\left|x[k]-\sum_nx[n]\frac{1}{2\pi}\int_{-W}^We^{j(k-n)\omega}d\omega\right|^2\tag{1}\end{align}$$
Now compute the integral
$$I(k-n,W)=\frac{1}{2\pi}\int_{-W}^We^{j(k-n)\omega}d\omega\tag{2}$$
and show that $\lim_{W\to\pi}I(k-n,W)=\delta[k-n]$. This reduces the second sum in $(1)$ to a single element and the result follows.