Transpose of a Matrix
Transpose of a matrix is a matrix flipped over its main diagonal, switching the matrix’s rows and column indices. In this article, we will briefly discuss how to transform a matrix, its properties and examples.
This article will cover everything you need to know about transposing a matrix and how to do it.
Let’s get started!
Table of Content
Best-suited Maths for Data Science courses for you
Learn Maths for Data Science with these high-rated online courses
What Does Transposing a Matrix Mean?
When we talk about transposing a matrix, it means switching the rows and columns of that matrix. Technically, you are not changing the matrix itself but the location of its elements. Transposing a matrix changes its size but not its values.
Definition
Transpose of a matrix is a matrix that is obtained by interchanging the rows and columns.
or
Transpose of a matrix is a matrix flipped over its main diagonal, switching the matrix’s rows and column indices.
Representation
If A is any matrix, then Transpose of A is given by AT or A’.
i.e., if A is any matrix of order m by n, then the order of transpose of A will be n by m.
A = [aij]m x n, then AT = A’ = [aij]n x m .
Example
Here, we have taken two matrices, A and B, of order 3 x 4 and 3 x 3, respectively, and when we transpose them, the order of matrices will be 4 x 3 and 3 x 3, respectively.
Must Check: Top Math Courses for Data Science
Must Check: Top Data Science Online Courses and Certification
Also Read: All about Symmetric Matrix
How to Transpose a Matrix using Python
In the above examples of transposing a matrix, we have seen that transposing a matrix is nothing but inter-changing the rows and columns (or changing the row to the column and vice versa) of a matrix.
Now, we will see how to transform matrices using Python.
- Using NumPy
Code
#Python Programm to Transpose a Matrix using Numpy# import numpy import numpy as np #create a matrix using arraymatrix = np.array ([[1, 2, 3], [2, 4, 6], [7, 8, 9]]) #using transform function of numpymatrix.transpose()
Output
2. Using Nested Loop
#Python Programm to Transpose a Matrix using Nested Loop #create a matrixA = [[0, 2, 3], [-2, 0, 6], [-3, -6, 0], [8, 6, 5]] #create a matrix to store the result T = [[0,0,0,0], [0,0,0,0], [0,0,0,0]] # iterate through rowsfor x in range(len(A)): #iterate through columns for y in range(len(A[0])): T[y][x] = A[x][y] for t in T: print(t)
Output
Properties of Transpose of a Matrix
- Transpose of Transpose of a Matrix
Transpose of Transpose of a matrix is again the same matrix, i.e., for any matrix A.
(AT)T = A
Example
- Addition
If A and B are two matrices, then the transpose of A + B is equal to the transpose of A + transpose of B, i.e.,
(A + B)T = A T + B T
Example
- Scalar Multiplication
If a matrix is multiplied by a constant and then transpose is taken, then the result is equal to the transpose of the original matrix multiplied by a constant, i.e.,
(kA) T = kA T
Example
- Multiplication
If A and B are two matrices, then the transpose of AB is equal to the product of the transpose of A and transpose of B, i.e.,
(AB) T = B T AT
Example:
- Inverse
If A is an invertible matrix, then the transpose of the inverse of A is equal to the inverse of the transpose of A, i.e.,
(A-1)T = (AT)-1
Example:
- Determinant
For any square matrix A, the determinant of A is equal to the determinant of the transpose of A, i.e.,
det (A) = det(AT)
Example
Also Read: All About Skew-Symmetric Matrix
Conclusion
In this article, we have briefly discussed the transpose of a matrix with examples in Python. The process of transposing a matrix is simple; the most important thing to remember is that you must interchange rows and columns.
Hope this article will help you to learn the concepts of transposing a matrix.
Keep Learning!!
Keep Sharing!!
FAQs on Transpose of Matrix
What is the Transpose of a Matrix?
Transpose of a matrix is a matrix that is obtained by interchanging the rows and columns.
or
Transpose of a matrix is a matrix flipped over its main diagonal, switching the matrix’s rows and column indices.
How do you find the transpose of a matrix?
To find the transpose of a matrix, rewrite the first row of the matrix as the first column, the second row as the second column, and so on for all rows.
What is the transpose of a rectangular matrix?
The transpose of a rectangular matrix is another rectangular matrix where the number of rows and columns are interchanged. So, if the original matrix has dimensions
, the transpose will have dimensions .How does transposing affect the determinant of a matrix?
The determinant of a matrix remains unchanged upon transposing. That is,
.Can the transpose of a matrix change its rank?
No, the rank of a matrix is invariant under transposition. This means that the rank of
is equal to the rank of .Vikram has a Postgraduate degree in Applied Mathematics, with a keen interest in Data Science and Machine Learning. He has experience of 2+ years in content creation in Mathematics, Statistics, Data Science, and Mac... Read Full Bio