矩阵转置的定义
定义: 把矩阵A的行换成同序列数的列得到一个新矩阵,叫做A的转置矩阵 ,记作AT
矩阵转置的性质
1.(AT)T=A
1 2 3 4 5 6 7
| import numpy as np A = np.random.randint(0, 100, [3, 3]) print((A.T).T == A) [OUT]: [[ True True True] [ True True True] [ True True True]]
|
2.(A+B)T=AT+BT
1 2 3 4 5 6 7 8
| import numpy as np A = np.random.randint(0, 100, [3, 3]) B = np.random.randint(0, 100, [3, 3]) print((A+B).T==A.T+B.T) [OUT]: [[ True True True] [ True True True] [ True True True]]
|
3.(λA)T=λAT
1 2 3 4 5 6 7 8
| import numpy as np A = np.random.randint(0, 100, [3, 3]) lambda_ = 3.14 print((lambda_*A).T == lambda_*A.T) [OUT]: [[ True True True] [ True True True] [ True True True]]
|
4.(AB)T=BTAT
1 2 3 4 5 6 7
| import numpy as np A = np.random.randint(0, 100, [2, 4]) B = np.random.randint(0, 100, [4, 2]) print((A@B).T == B.T@A.T) [OUT]: [[ True True] [ True True]]
|
5. 若方阵A满足AT=A,则称A为对称矩阵。A=(aij)n为对称矩阵的充要条件是aij=aji(i,j=1,2,⋯,n)
1 2 3 4 5 6 7 8 9 10 11 12 13
| import numpy as np
def symmetric(shape): matrix = np.triu(np.random.randint(0, 100, shape)) matrix += matrix.T-np.diag(matrix.diagonal()) return matrix A = symmetric([3, 3]) print(A.T == A) [OUT]: [[ True True True] [ True True True] [ True True True]]
|