ベクトルのpノルム(p-norm)の定義と具体的な計算例の確認

ベクトル(vector)や行列(matrix)のノルム(norm)は類似度の計算など、様々な場面で応用される重要トピックです。当記事ではベクトルのpノルム(p-norm)の定義と成立する等式(equality)や不等式(inequality)、具体的な計算例の確認などを行いました。
作成にあたっては「Matrix Computations」のSection$\, 2.2$「Vector Norms」の内容を主に参考にしました。

・数学まとめ
https://www.hello-statisticians.com/math_basic

p-normの定義

p-normの式定義

$n$次元ベクトル$x \in \mathbb{R}^{n}$のp-normを$||x||_{p}$とおくとき、$||x||_{p}$は下記のように定義されます。
$$
\large
\begin{align}
||x||_{p} &= (|x_1|^{p} + |x_2|^{p} + \cdots + |x_n|^{p})^{\frac{1}{p}} \quad (1) \\
&= \left( \sum_{i=1}^{n} |x_i|^{p} \right)^{\frac{1}{p}}
\end{align}
$$

上記に基づいて$1$-norm、$2$-norm、$\infty$-normはそれぞれ下記のように表すことができます。
$$
\large
\begin{align}
||x||_{1} &= |x_1| + |x_2| + \cdots + |x_n| = \sum_{i=1}^{n} |x_i| \\
||x||_{2} &= (|x_1|^{2} + |x_2|^{2} + \cdots + |x_n|^{2})^{\frac{1}{2}} = (x^{\mathrm{T}} x)^{\frac{1}{2}} \\
||x||_{\infty} &= \max_{1 \leq i \leq n} |x_{i}|
\end{align}
$$

$1$-norm、$2$-normについては$p$に$p=1, p=2$を代入することで式が成立することが確認できるので、以下$\infty$-normについて具体例を元に詳しく確認します。
$$
\large
\begin{align}
x = \left( \begin{array}{c} 1 \\ 2 \\ 0 \end{array} \right)
\end{align}
$$

たとえば上記のように$x \in \mathbb{R}^{3}$が表される場合、$||x||_{10}$は$(1)$式に$p=10$を代入することで下記のように計算できます。
$$
\large
\begin{align}
||x||_{10} &= (|1|^{10} + |2|^{10} + 0^{10})^{\frac{1}{10}} \quad (1)’ \\
&= ( 1 + 2^{10} )^{\frac{1}{10}} \\
& \simeq ( 2^{10} )^{\frac{1}{10}} = 2
\end{align}
$$

上記は$p=20, p=100$の場合も同様です。よって、$p \to \infty$のとき$\displaystyle ||x||_{p} \to \max_{1 \leq i \leq n} |x_{i}|$が成立するであろうことが推察できます。

Absolute and Relative Errors

統計や機械学習の分野では誤差を定義することが多いので、当項ではノルムを用いたAbsolute ErrorやRelative Errorの定義について確認を行います。ベクトル$x \in \mathbb{R}^{n}$をベクトル$\hat{x} \in \mathbb{R}^{n}$で近似するときのAbsolute Errorを$\epsilon_{\mathrm{abs}}$、Relative Errorを$\epsilon_{\mathrm{rel}}$とおくとき、$\epsilon_{\mathrm{abs}}$と$\epsilon_{\mathrm{rel}}$はそれぞれ下記のように定義されます。
$$
\large
\begin{align}
\epsilon_{\mathrm{abs}} &= ||\hat{x} \, – \, x||_{p} \\
\epsilon_{\mathrm{rel}} &= \frac{||\hat{x} \, – \, x||_{p}}{||x||_{p}}
\end{align}
$$

上記の計算にあたっては$p=2$が用いられることが一般的です。

p-normについて成立する式

Holder不等式

ベクトル$x \in \mathbb{R}^{n}, y \in \mathbb{R}^{n}$について下記のHolder不等式が成立します。
$$
\large
\begin{align}
|x^{\mathrm{T}} y| \leq ||x||_{p} ||y||_{p}
\end{align}
$$

上記は下記のように定義されるコーシー・シュワルツの不等式(Cauchy-Schwarz inequality)の一般形です。
$$
\large
\begin{align}
|x^{\mathrm{T}} y| \leq ||x||_{2} ||y||_{2}
\end{align}
$$

以下、具体例に基づいてーシー・シュワルツの不等式が成立することを確認します。
$$
\large
\begin{align}
x = \left( \begin{array}{c} 1 \\ 2 \\ 0 \end{array} \right), \quad x = \left( \begin{array}{c} 2 \\ 1 \\ 0 \end{array} \right)
\end{align}
$$

上記に対し、$x^{\mathrm{T}} y, \, ||x||_{2}, \, ||y||_{2}$はそれぞれ下記のように計算できます。
$$
\large
\begin{align}
x^{\mathrm{T}} y &= 1 \cdot 2 + 2 \cdot 1 + 0 \cdot 0 = 4 \\
||x||_{2} &= \sqrt{1^{2} + 2^{2} + 0^{2}} = \sqrt{5} \\
||y||_{2} &= \sqrt{2^{2} + 1^{2} + 0^{2}} = \sqrt{5}
\end{align}
$$

$4 \leq \sqrt{5} \cdot \sqrt{5}$であるので、$|x^{\mathrm{T}} y| \leq ||x||_{2} ||y||_{2}$が成立していることが確認できます。

直交行列について成立する式

$Q \in \mathbb{R}$を直交行列とするとき、$Q$とベクトル$x \in \mathbb{R}^{n}$について下記が成立します。
$$
\large
\begin{align}
||Qx||_{2}^{2} &= (Qx)^{\mathrm{T}} (Qx) \\
&= x^{\mathrm{T}} Q^{\mathrm{T}} Q x \\
&= x^{\mathrm{T}} x = ||x||_{2}^{2}
\end{align}
$$

上記の導出にあたっては直交行列の定義である$Q^{T} Q = Q^{-1} Q = I_{n}$を用いました。