Skip to content
Glacius
Linear algebraConcept reference

Systems as matrices

A linear system is encoded by a coefficient matrix, an ordered unknown vector and a vector of right-hand constants.

On this page 7 sections
  1. Overview
  2. A linear system asks the same unknowns to satisfy several linear equations
  3. Keep one column per unknown, even when a term is missing
  4. Each row dot product recreates its original left side
  5. Key takeaway
  6. Sources & further reading
  7. Concept connections

01A linear system asks the same unknowns to satisfy several linear equations#

A linear system asks the same unknowns to satisfy several linear equations. In Ax=bA\mathbf{x}=b, A holds coefficients, x\mathbf{x} holds the unknowns, and b holds constants.

For 2x+y=72x+y=7 and x+y=1-x+y=1, use unknown order (x,y)(x,y). Row 1 of A is (2,1)(2,1); row 2 is (1,1)(-1,1). The constants stay in b=(7,1)b=(7,1).

A has rows (2,1) and (−1,1), the unknown vector contains x then y, and b contains 7 then 1. Multiplication represents equations 2x+y=7 and −x+y=1 in that order.A has rows (2,1) and (−1,1), the unknown vector contains x then y, and b contains 7 then 1. Multiplication represents equations 2x+y=7 and −x+y=1 in that order.
Figure 1A has rows (2,1) and (−1,1), the unknown vector contains x then y, and b contains 7 then 1. Multiplication represents equations 2x+y=7 and −x+y=1 in that order.
Link to this figure ↗Download SVGDownload PNG
Check your reasoning

Order (x,y)(x,y). Encode: x+2y=6x+2y=6

  1. AA=[12]A=\begin{bmatrix}1&2\end{bmatrix}; b=(6)b=(6)
  2. BA=[21]A=\begin{bmatrix}2&1\end{bmatrix}; b=(6)b=(6)
  3. CA=[126]A=\begin{bmatrix}1&2&6\end{bmatrix}; b=(6)b=(6)
Show answer and explanation
A=[12]A=\begin{bmatrix}1&2\end{bmatrix}; b=(6)b=(6)

Coefficients go in A; constants go in b.

02Keep one column per unknown, even when a term is missing#

Keep one column per unknown, even when a term is missing. With order (x,y)(x,y), 2x=82x=8 contributes coefficient row (2,0)(2,0) and constant 8.

Check your reasoning

Order (x,y)(x,y). Encode 2x=82x=8. What is the y coefficient in A?

Show answer and explanation
0

A missing y term has coefficient 0.

03Each row dot product recreates its original left side#

Each row dot product recreates its original left side. Keep equation order fixed in both A and b. The constants are separate from A; a system can have different numbers of equations and unknowns.

Check your reasoning

Order (u,v)(u,v) for prices. Orders: (2,3) costs 11. Pair = quantities. Encode A and b.

  1. AA=[32]A=\begin{bmatrix}3&2\end{bmatrix}; b=(11)b=(11)
  2. BA=[2311]A=\begin{bmatrix}2&3&11\end{bmatrix}; b=(11)b=(11)
  3. CA=[23]A=\begin{bmatrix}2&3\end{bmatrix}; b=(11)b=(11)
Show answer and explanation
A=[23]A=\begin{bmatrix}2&3\end{bmatrix}; b=(11)b=(11)

A uses [2 3][2\ 3].

Key takeaway

One row per equation; one column per unknown. Keep constants in b.

  • Encode a finite linear system as Ax=b.

Sources & further reading

  1. [1]
  2. [2]

Reference this concept

Link to this page, a section, or an individual figure.

Glacius. “Systems as matrices.” Math behind ML. /learn/la-system