以下の記事で、転置行列の定義について記載している。

この転置行列には、以下の4つの性質がある。
- \({}^t \!({}^t \! A) = A\)
- \({}^t\!(A + B) = {}^t \! A + {}^t \! B\)
- \({}^t\!(cA) = c{}^t \! A\)
- \({}^t\!(AB) = {}^t \! B{}^t \! A\)
今回は、上記4つの性質が成り立っていることを確認してみたので、その結果を共有する。
やってみたこと
転置行列の性質① の確認
①\({}^t \!({}^t \! A) = A\) を具体的な値で確認した結果は、以下の通り。
\(A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 3 & 1 \end{pmatrix}\) の場合、\({}^t \! A = \begin{pmatrix} 1 & 4 \\ 2 & 3 \\ 3 & 1 \end{pmatrix} \) で、\({}^t \!({}^t \! A) = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 3 & 1 \end{pmatrix} = A\)
import numpy as np
A = np.array([
    [1,2,3],
    [4,3,1]
])
print("*** 行列A ***")
print(A)
print("*** 行列Aの転置行列 ***")
At = A.T
print(At)
print("*** 行列Aの転置行列の転置行列 ***")
Att = At.T
print(Att)
また、①\({}^t \!({}^t \! A) = A\) を\(m\)行\(n\)列の行列で確認した結果は、以下の通り。
\(A=\left(
 \begin{array}{cccc}
 a_{11} & a_{12} & \ldots & a_{1n} \\
 a_{21} & a_{22} & \ldots & a_{2n} \\
 \vdots & \vdots & \ddots & \vdots \\
 a_{m1} & a_{m2} & \ldots & a_{mn}
 \end{array}
 \right)\) の場合、\({}^t \! A =\left(
 \begin{array}{cccc}
 a_{11} & a_{21} & \ldots & a_{m1} \\
 a_{12} & a_{22} & \ldots & a_{m2} \\
 \vdots & \vdots & \ddots & \vdots \\
 a_{1n} & a_{2n} & \ldots & a_{mn}
 \end{array}
 \right)\) で、
 \({}^t \!({}^t \! A)=\left(
 \begin{array}{cccc}
 a_{11} & a_{12} & \ldots & a_{1n} \\
 a_{21} & a_{22} & \ldots & a_{2n} \\
 \vdots & \vdots & \ddots & \vdots \\
 a_{m1} & a_{m2} & \ldots & a_{mn}
 \end{array}
 \right) = A\)
 
 

転置行列の性質② の確認
②\({}^t\!(A + B) = {}^t \! A + {}^t \! B\) を具体的な値で確認した結果は、以下の通り。
\(A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 3 & 1 \end{pmatrix}\)、\(B = \begin{pmatrix} 1 & 3 & 1 \\ 2 & 4 & 2 \end{pmatrix}\) の場合、
 \[
 \begin{multline}
 \shoveleft{ A + B = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 3 & 1 \end{pmatrix} + \begin{pmatrix} 1 & 3 & 1 \\ 2 & 4 & 2 \end{pmatrix}
 = \begin{pmatrix} 1+1 & 2+3 & 3+1 \\ 4+2 & 3+4 & 1+2 \end{pmatrix} = \begin{pmatrix} 2 & 5 & 4 \\ 6 & 7 & 3 \end{pmatrix} } \\
 \shoveleft{ {}^t\!(A + B) = \begin{pmatrix} 2 & 6 \\ 5 & 7 \\ 4 & 3 \end{pmatrix} } \\
 \shoveleft{ {}^t \! A + {}^t \! B = \begin{pmatrix} 1 & 4 \\ 2 & 3 \\ 3 & 1 \end{pmatrix} + \begin{pmatrix} 1 & 2 \\ 3 & 4 \\ 1 & 2 \end{pmatrix}
 = \begin{pmatrix} 1+1 & 4+2 \\ 2+3 & 3+4 \\ 3+1 & 1+2 \end{pmatrix} = \begin{pmatrix} 2 & 6 \\ 5 & 7 \\ 4 & 3 \end{pmatrix} = {}^t\!(A + B) }
 \end{multline}
 \]
import numpy as np
A = np.array([
    [1,2,3],
    [4,3,1]
])
B = np.array([
    [1,3,1],
    [2,4,2]
])
print("*** 行列A ***")
print(A)
print("*** 行列B ***")
print(B)
print()
print("*** A + B ***")
C = A + B
print(C)
print("*** A + Bの転置行列 ***")
Ct = C.T
print(Ct)
print()
print("*** Aの転置行列 ***")
At = A.T
print(At)
print("*** Bの転置行列 ***")
Bt = B.T
print(Bt)
print("*** Aの転置行列 + Bの転置行列 ***")
D = At + Bt
print(D)
また、②\({}^t\!(A + B) = {}^t \! A + {}^t \! B\) を\(m\)行\(n\)列の行列で確認した結果は、以下の通り。
\(A=\left(
 \begin{array}{cccc}
 a_{11} & a_{12} & \ldots & a_{1n} \\
 a_{21} & a_{22} & \ldots & a_{2n} \\
 \vdots & \vdots & \ddots & \vdots \\
 a_{m1} & a_{m2} & \ldots & a_{mn}
 \end{array}
 \right)\) 、\(B=\left(
 \begin{array}{cccc}
 b_{11} & b_{12} & \ldots & b_{1n} \\
 b_{21} & b_{22} & \ldots & b_{2n} \\
 \vdots & \vdots & \ddots & \vdots \\
 b_{m1} & b_{m2} & \ldots & b_{mn}
 \end{array}
 \right)\) の場合、
 \[
 \begin{multline}
 \shoveleft{ A + B = \left(
 \begin{array}{cccc}
 a_{11} & a_{12} & \ldots & a_{1n} \\
 a_{21} & a_{22} & \ldots & a_{2n} \\
 \vdots & \vdots & \ddots & \vdots \\
 a_{m1} & a_{m2} & \ldots & a_{mn}
 \end{array}
 \right) + \left(
 \begin{array}{cccc}
 b_{11} & b_{12} & \ldots & b_{1n} \\
 b_{21} & b_{22} & \ldots & b_{2n} \\
 \vdots & \vdots & \ddots & \vdots \\
 b_{m1} & b_{m2} & \ldots & b_{mn}
 \end{array}
 \right) = \left(
 \begin{array}{cccc}
 a_{11} + b_{11} & a_{12} + b_{12} & \ldots & a_{1n} + b_{1n} \\
 a_{21} + b_{21} & a_{22} + b_{22} & \ldots & a_{2n} + b_{2n} \\
 \vdots & \vdots & \ddots & \vdots \\
 a_{m1} + b_{m1} & a_{m2} + b_{m2} & \ldots & a_{mn} + b_{mn}
 \end{array}
 \right) } \\
 \shoveleft{ {}^t\!(A + B) = \left(
 \begin{array}{cccc}
 a_{11} + b_{11} & a_{21} + b_{21} & \ldots & a_{m1} + b_{m1} \\
 a_{12} + b_{12} & a_{22} + b_{22} & \ldots & a_{m2} + b_{m2} \\
 \vdots & \vdots & \ddots & \vdots \\
 a_{1n} + b_{1n} & a_{2n} + b_{2n} & \ldots & a_{mn} + b_{mn}
 \end{array}
 \right) } \\
 \shoveleft{ {}^t \! A + {}^t \! B = \left(
 \begin{array}{cccc}
 a_{11} & a_{21} & \ldots & a_{m1} \\
 a_{12} & a_{22} & \ldots & a_{m2} \\
 \vdots & \vdots & \ddots & \vdots \\
 a_{1n} & a_{2n} & \ldots & a_{mn}
 \end{array}
 \right) + \left(
 \begin{array}{cccc}
 b_{11} & b_{21} & \ldots & b_{m1} \\
 b_{12} & b_{22} & \ldots & b_{m2} \\
 \vdots & \vdots & \ddots & \vdots \\
 b_{1n} & b_{2n} & \ldots & b_{mn}
 \end{array}
 \right) = \left(
 \begin{array}{cccc}
 a_{11} + b_{11} & a_{21} + b_{21} & \ldots & a_{m1} + b_{m1} \\
 a_{12} + b_{12} & a_{22} + b_{22} & \ldots & a_{m2} + b_{m2} \\
 \vdots & \vdots & \ddots & \vdots \\
 a_{1n} + b_{1n} & a_{2n} + b_{2n} & \ldots & a_{mn} + b_{mn}
 \end{array}
 \right) = {}^t\!(A + B) }
 \end{multline}
 \]
 
 

転置行列の性質③ の確認
③\({}^t\!(cA) = c{}^t \! A\) を具体的な値で確認した結果は、以下の通り。
\(A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 3 & 1 \end{pmatrix}\)、\(c = 2\) の場合、
 \[
 \begin{multline}
 \shoveleft{ cA = 2\begin{pmatrix} 1 & 2 & 3 \\ 4 & 3 & 1 \end{pmatrix} = \begin{pmatrix} 2 \times 1 & 2 \times 2 & 2 \times 3 \\ 2 \times 4 & 2 \times 3 & 2 \times 1 \end{pmatrix}
 = \begin{pmatrix} 2 & 4 & 6 \\ 8 & 6 & 2 \end{pmatrix} } \\
 \shoveleft{ {}^t \! (cA) = \begin{pmatrix} 2 & 8 \\ 4 & 6 \\ 6 & 2 \end{pmatrix} } \\
 \shoveleft{ {}^t \! A = \begin{pmatrix} 1 & 4 \\ 2 & 3 \\ 3 & 1 \end{pmatrix} } \\
 \shoveleft{ c{}^t \! A = 2\begin{pmatrix} 1 & 4 \\ 2 & 3 \\ 3 & 1 \end{pmatrix}
 = \begin{pmatrix} 2 \times 1 & 2 \times 4 \\ 2 \times 2 & 2 \times 3 \\ 2 \times 3 & 2 \times 1 \end{pmatrix} = \begin{pmatrix} 2 & 8 \\ 4 & 6 \\ 6 & 2 \end{pmatrix} = {}^t \! (cA) }
 \end{multline}
 \]
import numpy as np
A = np.array([
    [1,2,3],
    [4,3,1]
])
c = 2
print("*** 行列A ***")
print(A)
print("*** c ***")
print(c)
print()
print("*** cA ***")
cA = c * A
print(cA)
print("*** cAの転置行列 ***")
cAt = cA.T
print(cAt)
print()
print("*** Aの転置行列 ***")
At = A.T
print(At)
print("*** c*(Aの転置行列) ***")
cAt2 = c * At
print(cAt2)
また、③\({}^t\!(cA) = c{}^t \! A\) を\(m\)行\(n\)列の行列で確認した結果は、以下の通り。
\(A = \left(
 \begin{array}{cccc}
 a_{11} & a_{12} & \ldots & a_{1n} \\
 a_{21} & a_{22} & \ldots & a_{2n} \\
 \vdots & \vdots & \ddots & \vdots \\
 a_{m1} & a_{m2} & \ldots & a_{mn}
 \end{array}
 \right)\)、\(c = c\) の場合、
 \[
 \begin{multline}
 \shoveleft{ cA = c\left(
 \begin{array}{cccc}
 a_{11} & a_{12} & \ldots & a_{1n} \\
 a_{21} & a_{22} & \ldots & a_{2n} \\
 \vdots & \vdots & \ddots & \vdots \\
 a_{m1} & a_{m2} & \ldots & a_{mn}
 \end{array}
 \right) = \left(
 \begin{array}{cccc}
 ca_{11} & ca_{12} & \ldots & ca_{1n} \\
 ca_{21} & ca_{22} & \ldots & ca_{2n} \\
 \vdots & \vdots & \ddots & \vdots \\
 ca_{m1} & ca_{m2} & \ldots & ca_{mn}
 \end{array}
 \right) } \\
 \shoveleft{ {}^t \! (cA) = \left(
 \begin{array}{cccc}
 ca_{11} & ca_{21} & \ldots & ca_{m1} \\
 ca_{12} & ca_{22} & \ldots & ca_{m2} \\
 \vdots & \vdots & \ddots & \vdots \\
 ca_{1n} & ca_{2n} & \ldots & ca_{mn}
 \end{array}
 \right) } \\
 \shoveleft{ c{}^t \! A = c\left(
 \begin{array}{cccc}
 a_{11} & a_{21} & \ldots & a_{m1} \\
 a_{12} & a_{22} & \ldots & a_{m2} \\
 \vdots & \vdots & \ddots & \vdots \\
 a_{1n} & a_{2n} & \ldots & a_{mn}
 \end{array}
 \right) = \left(
 \begin{array}{cccc}
 ca_{11} & ca_{21} & \ldots & ca_{m1} \\
 ca_{12} & ca_{22} & \ldots & ca_{m2} \\
 \vdots & \vdots & \ddots & \vdots \\
 ca_{1n} & ca_{2n} & \ldots & ca_{mn}
 \end{array}
 \right) = {}^t \! (cA) }
 \end{multline}
 \]
 
 

転置行列の性質④ の確認
④\({}^t\!(AB) = {}^t \! B{}^t \! A\) を具体的な値で確認した結果は、以下の通り。
\(A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 3 & 1 \end{pmatrix}\)、\(B = \begin{pmatrix} 1 & 2 \\ 3 & 4 \\ 1 & 2 \end{pmatrix}\) の場合、
 \[
 \begin{multline}
 \shoveleft{ AB = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 3 & 1 \end{pmatrix}\begin{pmatrix} 1 & 2 \\ 3 & 4 \\ 1 & 2 \end{pmatrix}
 = \begin{pmatrix} 1+6+3 & 2+8+6 \\ 4+9+1 & 8+12+2 \end{pmatrix} = \begin{pmatrix} 10 & 16 \\ 14 & 22 \end{pmatrix} } \\
 \shoveleft{ {}^t \! (AB) = \begin{pmatrix} 10 & 14 \\ 16 & 22 \end{pmatrix} } \\
 \shoveleft{ {}^t\!B{}^t\!A = \begin{pmatrix} 1 & 3 & 1 \\ 2 & 4 & 2 \end{pmatrix}\begin{pmatrix} 1 & 4 \\ 2 & 3 \\ 3 & 1 \end{pmatrix}
 = \begin{pmatrix} 1+6+3 & 4+9+1 \\ 2+8+6 & 8+12+2 \end{pmatrix} = \begin{pmatrix} 10 & 14 \\ 16 & 22 \end{pmatrix} = {}^t \! (AB) }
 \end{multline}
 \]
import numpy as np
A = np.array([
    [1,2,3],
    [4,3,1]
])
B = np.array([
    [1,2],
    [3,4],
    [1,2]
])
print("*** 行列A ***")
print(A)
print("*** 行列B ***")
print(B)
print()
print("*** AB ***")
C = np.dot(A, B)
print(C)
print("*** ABの転置行列 ***")
Ct = C.T
print(Ct)
print()
print("*** Bの転置行列 ***")
Bt = B.T
print(Bt)
print("*** Aの転置行列 ***")
At = A.T
print(At)
print("*** (Bの転置行列)(Aの転置行列) ***")
D = np.dot(Bt, At)
print(D)
また、④\({}^t\!(AB) = {}^t \! B{}^t \! A\) を\(m\)行\(n\)列、\(n\)行\(m\)列の行列で確認した結果は、以下の通り。
\(A = \left(
 \begin{array}{cccc}
 a_{11} & a_{12} & \ldots & a_{1n} \\
 a_{21} & a_{22} & \ldots & a_{2n} \\
 \vdots & \vdots & \ddots & \vdots \\
 a_{m1} & a_{m2} & \ldots & a_{mn}
 \end{array}
 \right)\)、\(B = \left(
 \begin{array}{cccc}
 b_{11} & b_{12} & \ldots & b_{1m} \\
 b_{21} & b_{22} & \ldots & b_{2m} \\
 \vdots & \vdots & \ddots & \vdots \\
 b_{n1} & b_{n2} & \ldots & b_{nm}
 \end{array}
 \right)\) の場合、
 \[
 \begin{multline}
 \shoveleft{ AB = \left(
 \begin{array}{cccc}
 a_{11} & a_{12} & \ldots & a_{1n} \\
 a_{21} & a_{22} & \ldots & a_{2n} \\
 \vdots & \vdots & \ddots & \vdots \\
 a_{m1} & a_{m2} & \ldots & a_{mn}
 \end{array}
 \right)\left(
 \begin{array}{cccc}
 b_{11} & b_{12} & \ldots & b_{1m} \\
 b_{21} & b_{22} & \ldots & b_{2m} \\
 \vdots & \vdots & \ddots & \vdots \\
 b_{n1} & b_{n2} & \ldots & b_{nm}
 \end{array}
 \right) } \\
 \shoveleft{  = \left(
 \begin{array}{cccc}
 a_{11}b_{11} + a_{12}b_{21} + \ldots + a_{1n}b_{n1} & a_{11}b_{12} + a_{12}b_{22} + \ldots + a_{1n}b_{n2} & \ldots & a_{11}b_{1m} + a_{12}b_{2m} + \ldots + a_{1n}b_{nm} \\
 a_{21}b_{11} + a_{22}b_{21} + \ldots + a_{2n}b_{n1} & a_{21}b_{12} + a_{22}b_{22} + \ldots + a_{2n}b_{n2} & \ldots & a_{21}b_{1m} + a_{22}b_{2m} + \ldots + a_{2n}b_{nm} \\
 \vdots & \vdots & \ddots & \vdots \\
 a_{m1}b_{11} + a_{m2}b_{21} + \ldots + a_{mn}b_{n1} & a_{m1}b_{12} + a_{m2}b_{22} + \ldots + a_{mn}b_{n2} & \ldots & a_{m1}b_{1m} + a_{m2}b_{2m} + \ldots + a_{mn}b_{nm}
 \end{array}
 \right) } \\
 \shoveleft{  = \left(
 \begin{array}{cccc}
 \displaystyle \sum_{i=1}^{n}a_{1i}b_{i1} & \displaystyle \sum_{i=1}^{n}a_{1i}b_{i2} & \ldots & \displaystyle \sum_{i=1}^{n}a_{1i}b_{im} \\
 \displaystyle \sum_{i=1}^{n}a_{2i}b_{i1} & \displaystyle \sum_{i=1}^{n}a_{2i}b_{i2} & \ldots & \displaystyle \sum_{i=1}^{n}a_{2i}b_{im} \\
 \vdots & \vdots & \ddots & \vdots \\
 \displaystyle \sum_{i=1}^{n}a_{mi}b_{i1} & \displaystyle \sum_{i=1}^{n}a_{mi}b_{i2} & \ldots & \displaystyle \sum_{i=1}^{n}a_{mi}b_{im}
 \end{array}
 \right) } \\
 \shoveleft{ {}^t \! (AB) = \left(
 \begin{array}{cccc}
 \displaystyle \sum_{i=1}^{n}a_{1i}b_{i1} & \displaystyle \sum_{i=1}^{n}a_{2i}b_{i1} & \ldots & \displaystyle \sum_{i=1}^{n}a_{mi}b_{i1} \\
 \displaystyle \sum_{i=1}^{n}a_{1i}b_{i2} & \displaystyle \sum_{i=1}^{n}a_{2i}b_{i2} & \ldots & \displaystyle \sum_{i=1}^{n}a_{mi}b_{i2} \\
 \vdots & \vdots & \ddots & \vdots \\
 \displaystyle \sum_{i=1}^{n}a_{1i}b_{im} & \displaystyle \sum_{i=1}^{n}a_{2i}b_{im} & \ldots & \displaystyle \sum_{i=1}^{n}a_{mi}b_{im}
 \end{array}
 \right) } \\
 \shoveleft{ {}^t\!B{}^t\!A = \left(
 \begin{array}{cccc}
 b_{11} & b_{21} & \ldots & b_{n1} \\
 b_{12} & b_{22} & \ldots & b_{n2} \\
 \vdots & \vdots & \ddots & \vdots \\
 b_{1m} & b_{2m} & \ldots & b_{nm}
 \end{array}
 \right)\left(
 \begin{array}{cccc}
 a_{11} & a_{21} & \ldots & a_{m1} \\
 a_{12} & a_{22} & \ldots & a_{m2} \\
 \vdots & \vdots & \ddots & \vdots \\
 a_{1n} & a_{2n} & \ldots & a_{mn}
 \end{array}
 \right) } \\
 \shoveleft{  = \left(
 \begin{array}{cccc}
 b_{11}a_{11} + b_{21}a_{12} + \ldots + b_{n1}a_{1n} & b_{11}a_{21} + b_{21}a_{22} + \ldots + b_{n1}a_{2n} & \ldots & b_{11}a_{m1} + b_{21}a_{m2} + \ldots + b_{n1}a_{mn} \\
 b_{12}a_{11} + b_{22}a_{12} + \ldots + b_{n2}a_{1n} & b_{12}a_{21} + b_{22}a_{22} + \ldots + b_{n2}a_{2n} & \ldots & b_{12}a_{m1} + b_{22}a_{m2} + \ldots + b_{n2}a_{mn} \\
 \vdots & \vdots & \ddots & \vdots \\
 b_{1m}a_{11} + b_{2m}a_{12} + \ldots + b_{nm}a_{1n} & b_{1m}a_{21} + b_{2m}a_{22} + \ldots + b_{nm}a_{2n} & \ldots & b_{1m}a_{m1} + b_{2m}a_{m2} + \ldots + b_{nm}a_{mn}
 \end{array}
 \right) } \\
 \shoveleft{  = \left(
 \begin{array}{cccc}
 \displaystyle \sum_{i=1}^{n}b_{i1}a_{1i} & \displaystyle \sum_{i=1}^{n}b_{i1}a_{2i} & \ldots & \displaystyle \sum_{i=1}^{n}b_{i1}a_{mi} \\
 \displaystyle \sum_{i=1}^{n}b_{i2}a_{1i} & \displaystyle \sum_{i=1}^{n}b_{i2}a_{2i} & \ldots & \displaystyle \sum_{i=1}^{n}b_{i2}a_{mi} \\
 \vdots & \vdots & \ddots & \vdots \\
 \displaystyle \sum_{i=1}^{n}b_{im}a_{1i} & \displaystyle \sum_{i=1}^{n}b_{im}a_{2i} & \ldots & \displaystyle \sum_{i=1}^{n}b_{im}a_{mi}
 \end{array}
 \right) = \left(
 \begin{array}{cccc}
 \displaystyle \sum_{i=1}^{n}a_{1i}b_{i1} & \displaystyle \sum_{i=1}^{n}a_{2i}b_{i1} & \ldots & \displaystyle \sum_{i=1}^{n}a_{mi}b_{i1} \\
 \displaystyle \sum_{i=1}^{n}a_{1i}b_{i2} & \displaystyle \sum_{i=1}^{n}a_{2i}b_{i2} & \ldots & \displaystyle \sum_{i=1}^{n}a_{mi}b_{i2} \\
 \vdots & \vdots & \ddots & \vdots \\
 \displaystyle \sum_{i=1}^{n}a_{1i}b_{im} & \displaystyle \sum_{i=1}^{n}a_{2i}b_{im} & \ldots & \displaystyle \sum_{i=1}^{n}a_{mi}b_{im}
 \end{array}
 \right) = {}^t \! (AB) } \\
 \end{multline}
 \]
要点まとめ
転置行列には、以下の4つの性質がある。
- \({}^t \!({}^t \! A) = A\)
- \({}^t\!(A + B) = {}^t \! A + {}^t \! B\)
- \({}^t\!(cA) = c{}^t \! A\)
- \({}^t\!(AB) = {}^t \! B{}^t \! A\)





