Matrix Products, Inverses and LU

Interpret matrix multiplication as composition and use factorization to solve systems efficiently.

Builds on Elimination, Pivots and Free Variables

The bigger question: What does a system of equations look like geometrically?

On this page

Shapes determine valid products

For AA of size m×nm\times n and BB of size n×pn\times p, the product ABAB has size m×pm\times p, with entry (AB)ij=∑kAikBkj(AB)_{ij}=\sum_kA_{ik}B_{kj}. Its action is A(Bx)A(B\mathbf x): the rightmost transformation acts first. Generally AB≠BAAB\ne BA, even when both products exist.

A square matrix has an inverse when some A−1A^{-1} satisfies A−1A=AA−1=IA^{-1}A=AA^{-1}=I. Then Ax=bA\mathbf x=\mathbf b has unique solution A−1bA^{-1}\mathbf b for every target. For actual numerical solving, elimination or a factorization usually avoids forming the inverse explicitly.

Visual guide

VISUAL GUIDEMatrix columns are images of the basis
For A = [[2, 1], [0, 1]], the unit square becomes a parallelogram. Its edges are the columns (2, 0) and (1, 1). Multiplying a vector forms the same weighted combination of those columns.-0.5-0.50.50.1251.50.752.51.383.52xy
For A = [[2, 1], [0, 1]], the unit square becomes a parallelogram. Its edges are the columns (2, 0) and (1, 1). Multiplying a vector forms the same weighted combination of those columns.

Worked example: order matters

Let A=(2001)A=\begin{pmatrix}2&0\\0&1\end{pmatrix} and B=(1101)B=\begin{pmatrix}1&1\\0&1\end{pmatrix}. Then AB=(2201)AB=\begin{pmatrix}2&2\\0&1\end{pmatrix} but BA=(2101)BA=\begin{pmatrix}2&1\\0&1\end{pmatrix}. Scaling after shearing differs from shearing after scaling.

For a 2×22\times2 matrix (abcd)\begin{pmatrix}a&b\\c&d\end{pmatrix}, the inverse is (ad−bc)−1(d−b−ca)(ad-bc)^{-1}\begin{pmatrix}d&-b\\-c&a\end{pmatrix} when ad−bc≠0ad-bc\ne0. Multiplying verifies the identity; zero determinant makes this formula and an inverse impossible.

PAUSE & THINKA quick check, not a grade

Try it yourself.

Choose an answer and explain your reasoning to yourself. Use a hint if you get stuck.

In the product ABx, which transformation acts on x first?

Hint 1 · Find a starting point

Matrix products represent nested function composition.

Hint 2 · Take the next step

Read ABx as A(Bx).

Show the reasoning

Answer: B

B acts first; its output becomes the input to A. Order generally matters.

Before moving on: what would make one of the other answers wrong? Saying why is part of understanding.

Worked example: factor once, solve repeatedly

For A=(2143)A=\begin{pmatrix}2&1\\4&3\end{pmatrix}, elimination subtracts twice row one from row two. Hence

A=LU=(1021)(2101).A=LU=\begin{pmatrix}1&0\\2&1\end{pmatrix}\begin{pmatrix}2&1\\0&1\end{pmatrix}.

To solve Ax=(3,7)TA\mathbf x=(3,7)^T, first solve Ly=bL\mathbf y=\mathbf b, obtaining y=(3,1)T\mathbf y=(3,1)^T, then Ux=yU\mathbf x=\mathbf y, giving x=(1,1)T\mathbf x=(1,1)^T. The same factors can solve many new right-hand sides. If elimination needs row swaps, the usual form is PA=LUPA=LU with a permutation matrix PP.

Practice

  1. What is the shape of a 3×23\times2 matrix times a 2×42\times4 matrix?
  2. Invert diag⁡(2,5)\operatorname{diag}(2,5).
  3. Why does (1224)\begin{pmatrix}1&2\\2&4\end{pmatrix} have no inverse?
Show worked solutions
  1. 3×43\times4.
  2. diag⁡(1/2,1/5)\operatorname{diag}(1/2,1/5).
  3. Its columns are dependent and its determinant is zero. Some targets are unreachable and others have multiple preimages.
MAKE IT YOURS

Pause before the next idea.

Can you explain how the visualization connects to this lesson’s goal? If a step still feels uncertain, put this lesson on your review list and try the check again another day.

Optional marks, not a grade. Saved in this browser only. Open notebook →