= Distance = '''Distance''' is one of the two fundamental components of [[Calculus/VectorOperations|vectors]]. <> ---- == Pythagorean distance == In ''R^2^'' space, the distance between two Cartesian points is calculated by the '''Pythagorean theorem''': ''x^2^ + y^2^ = z^2^''. The Pythagorean distance of a vector a⃗ is notated ''|a⃗|''. ---- == Euclidean distance == Euclidean distance is the expansion of Pythagorean distance into ''R^n^'' space. Although [[Calculus|vector calculus]] largely stays in ''R^3^'', this property is generalized for higher dimensions. The squared Euclidean distance is the [[Calculus/VectorOperations#Dot_Product|dot product]] of a vector by itself. For vector a⃗ with ''i'' components, this could be written out as ''Σ(a,,i,,^2^)''. In [[LinearAlgebra|linear algebra]] however, the more conventional expression is ''x^T^x'' for a given vector ''x''. Taking the square root then gives the actual Euclidean distance, which for a vector a⃗ is notated ''||a⃗||''. This can be proven in ''R^3^'' trivially. For a vector a⃗ with X, Y, and Z components, use the Pythagorean theorem on the X and Y components to calculate a hypotenuse vector. Then use it again with that hypotenuse vector and the Z component. More generally, the Pythagorean theorem can be shown to hold in ''R^n^'' space. Suppose that ''x'' is ''[1 2 3]'' and ''y'' is ''[2 -1 0]''. [[Calculus/VectorOperations#Addition|Vector addition]] demonstrates that ''z = x + y = [1 2 3] + [2 -1 0] = [3 1 3]''. The Pythagorean theorem would then suggest that ''x^T^x + y^T^y = z^T^z''; and it is straightforward to demonstrate that both the left and right hand sides of the equation are ''19''. The Pythagorean theorem can be restated as ''x^T^x + y^T^y = (x+y)^T^(x+y)''. This formulation leads to the test for [[Calculus/Orthogonality|orthogonality]]. === Distance between two points === Given by the distance of the vector between those points. === Distance between a point and a vector === Extract any point from the given vector a⃗, and create a new vector b⃗ between that extracted point and the given point. The distance between the given point and vector is given by ''||a⃗ × b⃗||/||a⃗||''. There are [[Calculus/VectorGeometry#Parallelogram|several ways to formulate the area of a parallelogram formed by two vectors]], but fundamentally the equation is ''base * height''. If the given vector a⃗ forms the base, then the height is exactly the same as the distance between the given point and vector. So solve for the area (i.e., ''||a⃗ × b⃗||'') and divide by the base (i.e., ''||a⃗||''). === Distance between a point and a plane === First, if given a plane as ''3x + 5y - z = 4'', then extract the trivial normal vector n⃗: ''[3 5 -1]''. Extract any point from the given plane, and create a new vector c⃗ between that extracted point and the given point. The distance between the given point and plane is given by ''|c⃗ ⋅ n⃗|/||n⃗||''. The normal vector n⃗ definitionally is the direction of the shortest path from a given plane to a given point. The distance between given point and plane is thus given by a [[Calculus/Projection#Scalar_Projection|scalar projection]] onto n⃗, as it captures how much movement there is in the direction of n⃗. The absolute value must be taken though, because the trivial normal vector may happen to move in the opposite direction compared to the given point. === Distance between two parallel vectors (planes) === Extract a point from one vector (plane) and solve for the distance between it and the other vector (plane). ---- CategoryRicottone