Member-only story
Linear algebra with scipy.linalg
In this article, we will see how to use SciPy to perform linear algebra. This article is part of a series on SciPy.
The scipy.linalg module, which implements linear algebra, is a foundational part of the SciPy library. Linear algebra shows up in more places than you might expect. Almost every other SciPy module (such as optimisation, statistics, signal processing, and sparse matrices) uses linear algebra, so a basic understanding of some of the concepts here will help you to get to grips with the other modules too.
You might already know some linear algebra
Linear algebra is the branch of mathematics that covers vectors, matrices, simple curve fitting, and simultaneous equations, amongst other topics. So if you have studied high school maths or beyond, you will already be familiar with some of the concepts.
As a Python programmer, if you’ve worked with NumPy arrays, you’ve already been doing linear algebra, even if you didn’t call it that. Multiplying two arrays with @, computing a dot product, reshaping data for a model, that's all linear algebra in disguise.
The places where linear algebra crops up in real programming work might surprise you:
- Fitting a line (or curve) to data — least squares is a linear algebra problem









