Transpose Two matrices in Python


Write a program to transpose two matrices



The transpose of a matrix is an operator which flips a matrix over its diagonal, that is it switches the row and column indices of the matrix by producing another matrix denoted as AT (also written A′, AtrtA or At). It is achieved by any one of the following equivalent actions:


The transpose AT of a matrix Acan be obtained by reflecting the elements along its main diagonal. Repeating the process on the transposed matrix returns the elements to their original position.

  • reflect A over its main diagonal (which runs from top-left to bottom-right) to obtain AT
  • write the rows of A as the columns of AT
  • write the columns of A as the rows of AT

Formally, the i th row, j th column element of AT is the j th row, i th column element of A:

{\displaystyle \left[\mathbf {A} ^{\mathrm {T} }\right]_{ij}=\left[\mathbf {A} \right]_{ji}}

If A is an m × n matrix then AT is an n × m matrix.



Leave a Reply

bodrum escort - eskişehir esc - mersin escort - mersin escort bayan - mersin esc