## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

# Linear algebra with NumPy

Linear algebra is an important subdivision of mathematics. We can use linear algebra, for instance, to perform linear regression. The numpy.linalg subpackage holds linear algebra routines. With this subpackage, you can invert matrices, compute eigenvalues, solve linear equations, and find determinants among other matters. Matrices in NumPy are represented by a subclass of ndarray.

## Inverting matrices with NumPy

The inverse of a square and invertible matrix A in linear algebra is the matrix A-1, which when multiplied with the original matrix is equal to the identity matrix I. This can be written down as the following mathematical equation:

A A-1 = I

The inv() function in the numpy.linalg subpackage can do this for us. Let's ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required