The function dct2, which computes the two-dimensional discrete cosine transform (DCT), appeared in the original 1993 version of the toolbox. The authors of the toolbox relied on several authoritative references, including Two-Dimensional Signal and Image Processing by Lim. This book contains the following one-dimensional DCT equation:
The original implementation of dct2 used this formula.
At roughly the same time as the first toolbox release, the newly-standardized JPEG image compression method and format was becoming popular. The DCT is the mathematical heart of the JPEG algorithm. Here's the 8-point one-dimensional DCT equation that appears in JPEG: Still Image Data Compression Standard by Pennebaker and Mitchell.
where
The variable name differences are trivial, but the scale factor differences are very important! The JPEG DCT is an orthonormal transform, whereas the DCT defined in Lim's book is not.