This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)


gives a matrix of distances or dissimilarities between the elements of list.
  • The elements of list can be numeric lists, matrices, or tensors, lists of Boolean elements, or strings. All data elements must have the same dimensions.
  • The method used to compute dissimilarities can be selected with the DistanceFunction option.
  • The setting for DistanceFunction can be any distance or dissimilarity function or a pure function f defining a distance between two values.
Distance matrix for a list of numbers:
Click for copyable input