Rules for transposition
Posted February 27, 2013 at 01:12 PM | categories: linear algebra | tags:
Here are the four rules for matrix multiplication and transposition
- \((\mathbf{A}^T)^T = \mathbf{A}\)
- \((\mathbf{A}+\mathbf{B})^T = \mathbf{A}^T+\mathbf{B}^T\)
- \((\mathit{c}\mathbf{A})^T = \mathit{c}\mathbf{A}^T\)
- \((\mathbf{AB})^T = \mathbf{B}^T\mathbf{A}^T\)
reference: Chapter 7.2 in Advanced Engineering Mathematics, 9th edition. by E. Kreyszig.
1 The transpose in Python
There are two ways to get the transpose of a matrix: with a notation, and with a function.
import numpy as np A = np.array([[5, -8, 1], [4, 0, 0]]) # function print np.transpose(A) # notation print A.T
[[ 5 4] [-8 0] [ 1 0]] [[ 5 4] [-8 0] [ 1 0]]
2 Rule 1
import numpy as np A = np.array([[5, -8, 1], [4, 0, 0]]) print np.all(A == (A.T).T)
True
3 Rule 2
import numpy as np A = np.array([[5, -8, 1], [4, 0, 0]]) B = np.array([[3, 4, 5], [1, 2,3]]) print np.all( A.T + B.T == (A + B).T)
True
4 Rule 3
import numpy as np A = np.array([[5, -8, 1], [4, 0, 0]]) c = 2.1 print np.all( (c*A).T == c*A.T)
True
5 Rule 4
import numpy as np A = np.array([[5, -8, 1], [4, 0, 0]]) B = np.array([[0, 2], [1, 2], [6, 7]]) print np.all(np.dot(A, B).T == np.dot(B.T, A.T))
True
6 Summary
That wraps up showing numerically the transpose rules work for these examples.
Copyright (C) 2013 by John Kitchin. See the License for information about copying.