= Distance = '''Euclidean distance''' in higher dimensional space is useful for normalization. <> ---- == 2 Dimensions == In 2 dimensions, the distance between two Cartesian points is calculated by the '''Pythagorean theorem''': ''x^2^ + y^2^ = z^2^''. This is sometimes referred to as the '''Pythagorean distance'''. When this concept is expanded to complex numbers (but still in 2 dimensions), a common notation is ''|x - y|'' to emphasize that the distance must be normalized to an absolute value. ---- == n Dimensions == For a singular vector ''x'', the distance is the sum of each components' absolute value. If ''x'' is ''[1 2 3]'' or ''[-1 -2 -3]'', the distance of ''x'' is 6. Note that distance of a vector ''x'' is notated as ''||x||''. The Pythagorean theorem continues to hold in higher dimensions. Note that the theorem calls for squared distances: ''x^2^''. In other words, the squared distance of ''x'' is the sum of each component squared. For either of those ''x'' vectors, the squared distance is 14. Recall though that in matrix notation, multiplying two vectors creates a matrix; true vector multiplication is notated as ''x^T^x''. Plugging this into the Pythagorean theorem then, if ''y'' were ''[2 -1 0]'' (with squared distance of 5), then the squared distance of ''z'' is 19. The actual distance is √19. This can be double checked using the given values of ''x'' and ''y'', because vectors can be added directly. ''x + y = z'', so ''[1 2 3] + [2 -1 0] = [3 1 3]''. And with that calculated ''z'', it's clear again that the squared distance of ''z'' is 19. For two vectors ''x'' and ''y'', the Pythagorean theorem can be written as ''x^T^x + y^T^y = (x+y)^T^(x+y)''. This formulation leads to the test for [[LinearAlgebra/Orthogonality#Vectors|orthogonality]]. ---- CategoryRicottone