Linear algebra
Euclidean (L2) norm
linalg.l2-normAlso called l2 norm, euclidean norm, norm, vector norm
Length of a vector: the square root of the sum of its squared entries.
Notation
vector
x ∈ ℝn
vector length
Size, at least 1
Result: the norm
scalar
Worked examples
Each result is solved exactly and confirmed by two independent computations.
Given
Result
Given
Result
Given
Result
Common mistakes
Returns the squared norm
The final square root is missing.
Fix: Take the square root of the sum of squares.
Returns the L1 norm
The result is the sum of absolute values.
Fix: Sum the squares and take the square root.
Source
Golub and Van Loan 2013
Golub, Gene H.; Van Loan, Charles F. Matrix Computations. 4th ed. Johns Hopkins University Press, 2013.