Classical multidimensional scaling (source code)

= Classical multidimensional scaling
{title2=$G=-\tfrac12HD^{(2)}H,\quad X_k=U_k\Lambda_k^{1/2}$}

= Classical scaling
{synonym}

= Principal coordinates analysis
{synonym}

For a symmetric zero-diagonal <dissimilarity matrix> $D$, square each entry to obtain $D^{(2)}$ and put $H=I-\mathbf1\mathbf1^T/n$. Take the <eigenvectors> of $G=-HD^{(2)}H/2$ corresponding to its largest positive <eigenvalues>. Multiplying them by square roots of these <eigenvalues> gives coordinates. If $D$ contains <Euclidean distances>, $G$ is a centered <Gram matrix>, so retaining all positive <eigenvalues> reconstructs those distances exactly. Retaining fewer approximates the <Gram matrix>, not generally the sum of squared errors in raw distances. Negative <eigenvalues> signal failure of an exact Euclidean representation. Coordinates are unchanged in meaning by <orthogonal transformations>.