Transpose of a Matrix
Author: Bindeshwar Singh Kushwaha
Institute: PostNetwork Academy
What is the Transpose of a Matrix?
- The transpose of a matrix \( A \), denoted \( A^T \), is obtained by interchanging rows and columns.
- If \( A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix} \), then:\( A^T = \begin{bmatrix} 1 & 4 \\ 2 & 5 \\ 3 & 6 \end{bmatrix} \)
- Transpose of a row vector becomes a column vector:\( \begin{bmatrix} 1 & 3 & 5 \end{bmatrix}^T = \begin{bmatrix} 1 \\ 3 \\ 5 \end{bmatrix} \)
- If \( A = [a_{ij}]_{m \times n} \), then \( A^T = [b_{ij}]_{n \times m} \), where \( b_{ij} = a_{ji} \).
Properties of Transpose (Theorem 2.3)
- \( (A + B)^T = A^T + B^T \)
- \( (A^T)^T = A \)
- \( (kA)^T = kA^T \)
- \( (AB)^T = B^T A^T \)
Transpose in PyTorch
import torch
A = torch.tensor([[1, -2, 3], [0, 4, 5]], dtype=torch.float)
B = torch.tensor([[4, 6, 8], [1, -3, -7]], dtype=torch.float)
print("A:")
print(A)
print("A Transposed:")
print(A.T)
print("A + B Transposed =")
print((A + B).T)
print("A^T + B^T =")
print(A.T + B.T)
print("(A^T)^T =")
print(A.T.T)
print("3 * A Transposed =")
print((3 * A).T)
print("(A @ B.T)^T =")
print((A @ B.T).T)
print("B @ A.T =")
print(B @ A.T)
Video
PDF
tytorchtranspose
Connect with PostNetwork Academy
- Website: www.postnetwork.co
- YouTube Channel: www.youtube.com/@postnetworkacademy
- Facebook Page: www.facebook.com/postnetworkacademy
- LinkedIn Page: www.linkedin.com/company/postnetworkacademy