行列式の定義と性質をわかりやすく解説

行列式(determinant)は線形代数における最も基本的な概念の1つです。行列式は、正方行列に対して1つのスカラー値を対応させる関数であり、その値から行列が正則かどうか、連立方程式が一意解を持つかどうかなど、多くの情報を読み取ることができます。

幾何学的には、行列式は線形変換による「体積の拡大率」を表します。この直感を持っておくと、行列式の性質をより深く理解できます。

本記事の内容

  • 2次・3次行列式の定義と計算
  • 一般のn次行列式の定義(置換を用いた定義)
  • 行列式の重要な性質
  • 幾何学的な解釈
  • Pythonでの計算と可視化

前提知識

この記事を読む前に、以下の概念を理解しておくと理解が深まります。

  • 行列の基本演算(和、積、転置)
  • 正方行列の概念

2次行列式

2次正方行列 $\bm{A} = \begin{pmatrix} a & b \\ c & d \end{pmatrix}$ の行列式は次のように定義されます。

$$ \det(\bm{A}) = \begin{vmatrix} a & b \\ c & d \end{vmatrix} = ad – bc $$

幾何学的意味

2次行列式 $|ad – bc|$ は、列ベクトル $\bm{a}_1 = (a, c)^T$ と $\bm{a}_2 = (b, d)^T$ が作る平行四辺形の面積に等しいです。符号が正なら列ベクトルの向きが反時計回り、負なら時計回りの関係にあります。

3次行列式

3次正方行列の行列式は、サラスの法則で計算できます。

$$ \begin{vmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{vmatrix} $$

$$ = a_{11}a_{22}a_{33} + a_{12}a_{23}a_{31} + a_{13}a_{21}a_{32} – a_{13}a_{22}a_{31} – a_{12}a_{21}a_{33} – a_{11}a_{23}a_{32} $$

3次行列式の絶対値は、3つの列ベクトルが作る平行六面体の体積に等しいです。

一般のn次行列式

置換を用いた定義

$n$ 次正方行列 $\bm{A} = (a_{ij})$ の行列式は、$n$ 次の置換の集合 $S_n$ を用いて次のように定義されます。

$$ \det(\bm{A}) = \sum_{\sigma \in S_n} \mathrm{sgn}(\sigma) \prod_{i=1}^{n} a_{i, \sigma(i)} $$

ここで、$\sigma$ は $\{1, 2, \dots, n\}$ の置換(並べ替え)、$\mathrm{sgn}(\sigma)$ は置換の符号(偶置換なら $+1$、奇置換なら $-1$)です。

置換と符号

置換 $\sigma$ は、$\{1, 2, \dots, n\}$ から $\{1, 2, \dots, n\}$ への全単射です。例えば $n = 3$ のとき、$\sigma = (2, 3, 1)$ は $\sigma(1) = 2, \sigma(2) = 3, \sigma(3) = 1$ を表します。

置換の符号は、転倒数($i < j$ かつ $\sigma(i) > \sigma(j)$ となる $(i, j)$ の対の数)の偶奇で決まります。転倒数が偶数なら $\mathrm{sgn}(\sigma) = +1$、奇数なら $\mathrm{sgn}(\sigma) = -1$ です。

行列式の性質

行列式には以下の重要な性質があります。

性質1: 多重線形性

行列式は各行(または各列)に関して線形です。第 $i$ 行を $\bm{r}_i$ と書くと、

$$ \det(\dots, \alpha \bm{r}_i + \beta \bm{r}_i’, \dots) = \alpha \det(\dots, \bm{r}_i, \dots) + \beta \det(\dots, \bm{r}_i’, \dots) $$

性質2: 交代性

2つの行(または列)を入れ替えると、行列式の符号が反転します。

$$ \det(\dots, \bm{r}_i, \dots, \bm{r}_j, \dots) = -\det(\dots, \bm{r}_j, \dots, \bm{r}_i, \dots) $$

この性質から、2つの行が等しければ行列式は0になります。

性質3: 転置不変性

$$ \det(\bm{A}^T) = \det(\bm{A}) $$

性質4: 積の行列式

$$ \det(\bm{A}\bm{B}) = \det(\bm{A}) \det(\bm{B}) $$

性質5: 正則性の判定

$$ \bm{A} \text{ が正則} \iff \det(\bm{A}) \neq 0 $$

性質6: 行の基本変形と行列式

操作 行列式への影響
2つの行を入れ替え 符号が反転
1つの行を $c$ 倍 行列式が $c$ 倍
ある行に他の行の定数倍を加える 変化なし

具体例

2次行列式の計算

$$ \det \begin{pmatrix} 3 & 1 \\ 2 & 4 \end{pmatrix} = 3 \cdot 4 – 1 \cdot 2 = 10 $$

3次行列式の計算

$$ \det \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 0 \end{pmatrix} $$

サラスの法則を適用します。

$$ \begin{align} &= 1 \cdot 5 \cdot 0 + 2 \cdot 6 \cdot 7 + 3 \cdot 4 \cdot 8 \\ &\quad – 3 \cdot 5 \cdot 7 – 2 \cdot 4 \cdot 0 – 1 \cdot 6 \cdot 8 \\ &= 0 + 84 + 96 – 105 – 0 – 48 \\ &= 27 \end{align} $$

Pythonでの計算と可視化

行列式の計算

import numpy as np

# 2次行列式
A2 = np.array([[3, 1],
               [2, 4]])
print(f"2x2 det: {np.linalg.det(A2):.1f}")  # 10.0

# 3次行列式
A3 = np.array([[1, 2, 3],
               [4, 5, 6],
               [7, 8, 0]])
print(f"3x3 det: {np.linalg.det(A3):.1f}")  # 27.0

# 積の行列式 = 行列式の積の検証
B = np.random.randn(3, 3)
C = np.random.randn(3, 3)
det_BC = np.linalg.det(B @ C)
det_B_det_C = np.linalg.det(B) * np.linalg.det(C)
print(f"det(BC) = {det_BC:.6f}")
print(f"det(B)*det(C) = {det_B_det_C:.6f}")
print(f"Difference: {abs(det_BC - det_B_det_C):.2e}")

2次行列式の幾何学的意味の可視化

import numpy as np
import matplotlib.pyplot as plt

fig, axes = plt.subplots(1, 3, figsize=(15, 5))

matrices = [
    np.array([[2, 0], [0, 1]]),
    np.array([[1, 1], [0, 2]]),
    np.array([[1, 2], [2, 4]])  # det = 0(特異行列)
]
titles = ['det = 2', 'det = 2', 'det = 0 (singular)']

for idx, (A, title) in enumerate(zip(matrices, titles)):
    ax = axes[idx]
    det_val = np.linalg.det(A)

    # 元の単位正方形
    square = np.array([[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]).T
    ax.plot(square[0], square[1], 'b--', linewidth=1, alpha=0.5, label='Unit square')

    # 変換後の平行四辺形
    transformed = A @ square
    ax.fill(transformed[0], transformed[1], alpha=0.3, color='orange')
    ax.plot(transformed[0], transformed[1], 'r-', linewidth=2, label=f'Transformed (det={det_val:.0f})')

    # 列ベクトルを矢印で表示
    ax.annotate('', xy=A[:, 0], xytext=[0, 0],
                arrowprops=dict(arrowstyle='->', color='green', lw=2))
    ax.annotate('', xy=A[:, 1], xytext=[0, 0],
                arrowprops=dict(arrowstyle='->', color='purple', lw=2))

    ax.set_xlim(-1, 5)
    ax.set_ylim(-1, 5)
    ax.set_aspect('equal')
    ax.set_title(title)
    ax.legend(fontsize=8)
    ax.grid(True, alpha=0.3)
    ax.axhline(y=0, color='k', linewidth=0.5)
    ax.axvline(x=0, color='k', linewidth=0.5)

plt.tight_layout()
plt.savefig('determinant_geometry.png', dpi=150, bbox_inches='tight')
plt.show()

行列式が0のとき(特異行列)、変換後の図形が潰れて面積が0になることが確認できます。

まとめ

本記事では、行列式の定義と性質を解説しました。

  • 2次行列式: $ad – bc$、平行四辺形の符号付き面積
  • n次行列式: 置換と符号を用いて定義される
  • 主要な性質: 多重線形性、交代性、転置不変性、積の行列式 $= $ 行列式の積
  • 正則性の判定: $\det(\bm{A}) \neq 0 \iff \bm{A}$ は正則
  • 幾何学的意味: 線形変換による体積の拡大率

行列式をさらに活用するために、次は余因子展開について学びましょう。