Matrix Transpose ๐
Contents
Matrix Transpose ๐ #
Write functions that return the transpose of a matrix A.
Rules#
Function returns an numpy array.
You must not use any external function to calculate the transpose.
Function should work for square and non-square matrix.
Useful Links#
Transpose overview#
Consider a matrix \(A\) of order \(j\times i\). The transpose of a matrix \(A\), denoted by \(A^T\), may be constructed by writing the columns of \(A\) as the rows of \(A^T\).
Formally, in the i-th row, j-th column element of \(A^T\) is the j-th row, i-th column element of \(A\):
\[ [A^T]_{i, j} = A_{j,i}\]
Example#
Consider the following matrix \(A\):
\[\begin{split}
A = \begin{bmatrix}
1 & 2 & 3\\
4 & 5 & 6
\end{bmatrix}
\end{split}\]
The transpose is:
\[\begin{split}
A^T = \begin{bmatrix}
1 & 4\\
2 & 5 \\
3 & 6
\end{bmatrix}
\end{split}\]