短い答え
行列は、数値の長方形グリッドです。行列の加算または減算はエントリごとに機能しますが、2 つの行列の乗算は最初の行列の行と 2 番目の行列の列を結合します。これは通常の乗算とは異なります。 2 つの行列は、最初の行列の列数が 2 番目の行列の行数と一致する場合にのみ乗算できます。
重要なポイント
- 行列の乗算は可換ではありません。通常、A × B は B × A と等しくなく、次数が 1 つも定義されていない可能性があります。
- A matrix only has an inverse if it's square and its determinant is nonzero; a zero determinant means the matrix is "singular" and can't be inverted.
- 行列に単位行列を乗算しても、行列は変更されません。これは、数値に 1 を乗算するのと同等の行列です。
- 2×2 行列 [[a,b],[c,d]] の行列式は ad − bc です。これは、行列が反転できるかどうかを示す単一の数値です。
2×2 determinant and inverse formulas
det([[a,b],[c,d]]) = ad − bc
inverse = (1/det) × [[d,−b],[−c,a]]
ad − bc が 0 に等しい場合、行列には逆行列はありません。数値を 0 で割るのと同じように、行列式 0 で割ることは未定義です。
実践例: 2 つの 2×2 行列の乗算
A = [[1,2],[3,4]] および B = [[5,6],[7,8]]:
A × B = [[1×5+2×7, 1×6+2×8], [3×5+4×7, 3×6+4×8]] = [[19,22],[43,50]]
B × A = [[5×1+6×3, 5×2+6×4], [7×1+8×3, 7×2+8×4]] = [[23,34],[31,46]]
A × B and B × A land on completely different matrices — concrete proof that matrix multiplication doesn't commute the way ordinary number multiplication does.
行列演算が未定義の場合
| 手術 | 要件 |
|---|---|
| 足し算・引き算 | 両方の行列は同じ次元でなければなりません |
| Multiplication (A × B) | A's column count must equal B's row count |
| 逆数 | 行列は非ゼロの行列式を持つ正方でなければなりません |
避けるべきよくある間違い
- Assuming A × B equals B × A the way it would for ordinary numbers — order changes the result, and sometimes only one order is even defined.
- Trying to add or subtract matrices with different dimensions — both matrices need identical row and column counts.
- Attempting to invert a non-square matrix, or one whose determinant is 0 — both cases have no valid inverse.
- 転置 (行と列を反転する) と逆置 (乗算を元に戻すまったく別の演算) を混同すると、異なる問題が解決されます。