Matrix Transpose

A tranpose operation happens when the row values of a matrix as flipped as columns values and vice versa. Mathematically, we represent the transpose of a matrix A as:

$$A^{T}$$

$$ A = \begin{pmatrix} 3 & 2 \\ 3 & 4 \\ 9 & 7 \end{pmatrix}$$

then:

$$ A^{T} = \begin{pmatrix} 3 & 3 & 9 \\ 2 & 4 & 7 \end{pmatrix}$$

Implementation in Numpy

import numpy as np

A = np.array([3,2,3,4,9,7]).reshape(3,2)
A
array([[3, 2], [3, 4], [9, 7]])

Implementing Transpose

A.T
array([[3, 3, 9], [2, 4, 7]])