8.6 Vector Length

For a vector \(\mathbf{x}\in \mathbb{R}^k\), a general vector norm \(||\mathbf{x}||_p\) for \(p=1,2,...\) is defined as \[||\mathbf{x}||_p = \left(\sum_{i=1}^m |x_i|^p \right)^{1/p} \] As \(p\rightarrow \infty\), we have a special case, \[||\mathbf{x}||_{\infty} = \max_i |x_i|\]

  • L2-Norm: The most commonly used vector norm is when \(p=2\), \[||\mathbf{x}||_2 = \sqrt{\sum_{i=1}^m (x_i)^2} \]

To be a norm, the following must be true, 1) \(||\mathbf{x}|| \geq 0\), 2) \(||a\mathbf{x}|| =|a|||\mathbf{x}||\), and 3) \(||\mathbf{x}+\mathbf{y}|| \leq ||\mathbf{x}|| + ||\mathbf{y}||\) (triangle inequality).

sqrt(t(x)%*%x)
sqrt(sum(x^2))