# Phase shift of discrete cosine transform (DCT)

The most common type of discrete cosine transform (DCT-II) is defined as \begin{align} X_k&=\sum_{n=0}^{N-1}x_n\cdot \cos\left(\frac{\pi}{N}\left(n+\frac{1}{2}\right)\cdot k\right)&\text{where }& k=0,1,...,N-1 \end{align} (c. f. https://en.wikipedia.org/wiki/Discrete_cosine_transform)

My problem is that I just don't get what that phase shift of $$\frac{1}{2}$$ is for. In the paper introducing the DCT-II it was just defined that way, seemingly because the authors wanted to link it to Chebyshev polynomials. That analogy may be neat, but what are the actual benefits of the phase shift?

For all I can say, we might as well leave it out. But obviously, there must be something to it since it is still used today. Sadly all the books I've consulted just give the definition of the DCT without justifying the phase shift. Could someone explain or point me to a good source?

I think that phase shift is what causes the DCT-II to have different boundary properties compared to the DCT-I, as shown on the DCT Wikipedia page. It means that it is even around $$n=-1/2$$ and $$N-1/2$$. I suspect that this helps it to be sparser, and might also be important for other applications.