Course Content

Mathematics for Data Analysis and Modeling

## Mathematics for Data Analysis and Modeling

# Inversed and Transposed Matrices

## Matrix Transposition

In linear algebra, **the transpose of a matrix** is an operation that flips the matrix over its diagonal, resulting in a new matrix where the rows become columns, and the columns become rows. The transpose of a matrix `A`

is denoted as `A^T`

.

We can provide transponation of matrix in Python in two different ways:

- Using
`.T`

attribute of`np.array`

class; - Using
`np.transpose()`

method.

## Matrix Inversion

In linear algebra, **the inverse of a square matrix A** is a matrix denoted as `A^-1`

, which, when multiplied by the original matrix A, results in the identity matrix I. The inverse of a matrix exists only if the determinant of the matrix is **non-zero**.

Note

An identity matrix, denoted as

`I`

, is a square matrix with ones on the main diagonal (from the top left to the bottom right) and zeros elsewhere. In other words, all elements in the main diagonal are equal to 1, while all other elements are equal to 0.

It's important to admit that `A * A^-1 = A^-1 * A = I`

- the multiplication operation by the inversed matrix is commutative.

In Python, you can use the `.inv()`

method of the `np.linalg`

module to calculate the inverse of a matrix. Here's an example:

Everything was clear?