Tutorials › Linear Algebra › Constructing Coefficient Matrices

Linear Systems and Solution Sets · Tutorial 5 of 1000

Constructing Coefficient Matrices

Build coefficient matrices accurately by matching every row and column to the equations and the chosen variable order.

Beginner 9 min read

What You'll Learn

  • Choose and keep a fixed order for the variables.
  • Read each equation’s coefficients in that order to form a matrix row.
  • Record a zero when a variable is missing from an equation.
  • Keep negative and fractional coefficients in their correct positions.
  • Distinguish the coefficient matrix from the constants in the equations.
  • Check a matrix by multiplying it by the ordered variable vector.

What a Coefficient Matrix Records

A system of linear equations can be recorded compactly once the variables have a fixed order. The coefficient matrix keeps the coefficients of those variables and arranges them in rows, one row for each equation. It does not include the constant on the right side of an equation. This makes the matrix a record of the variable terms, not a complete replacement for the whole system.

For example, if the chosen variable order is \(x,y\), then the equation \(3x-2y=7\) contributes the row \(\begin{bmatrix}3&-2\end{bmatrix}\). The first entry belongs to \(x\), and the second belongs to \(y\). The \(7\) is not a coefficient of either variable, so it is not an entry of this row. If an equation has no \(x\)-term, its coefficient of \(x\) is \(0\), and the row must include that zero.

Definition: Fix an ordered list of variables \(x_1,\dots,x_n\). Write a system of \(m\) linear equations in the form \(a_{i1}x_1+\cdots+a_{in}x_n=b_i\), for \(i=1,\dots,m\). Its coefficient matrix is the \(m\times n\) matrix \(\mathbf{A}=[a_{ij}]\): row \(i\) contains the coefficients of equation \(i\), in the chosen variable order. The constants \(b_i\) are not entries of \(\mathbf{A}\).

The variable order is essential information. The first column represents the first variable in the order, the second column represents the second variable, and so on. A matrix without its variable order can be ambiguous: the same row of numbers can describe different variable terms if the columns are interpreted differently.

There are \(m\) rows because there are \(m\) equations, and \(n\) columns because there are \(n\) ordered variables. This shape is a useful first check. A system of three equations in two variables must produce a \(3\times2\) coefficient matrix, even if some coefficients are zero.

A Reliable Construction Method

To build the matrix, first write down the variable order and keep it fixed. Then put each equation into a form where all variable terms are on the left and the constant is on the right. For each equation, read the coefficient of each variable in the chosen order. Use \(0\) for a missing variable, preserve negative signs and fractions, and place the resulting list in one row. Do not add a column for the constants.

1
Fix the variable order.
For instance, state explicitly that the order is \(x,y,z\). This fixes what each column means.
2
Put each equation in standard form.
Collect variable terms on the left and leave the constant on the right, so the coefficients can be read consistently.
3
Read one row at a time.
Write exactly one coefficient for each variable, in the fixed order. Include zero entries for absent variables.
4
Check the record.
Multiply the proposed matrix by the column of variables. Each resulting component should reproduce the left-hand side of the corresponding equation.

The final check uses the definition of matrix-vector multiplication. If \(\mathbf{x}=\begin{bmatrix}x_1&\cdots&x_n\end{bmatrix}^{\top}\), then the \(i\)th entry of \(\mathbf{A}\mathbf{x}\) is \(a_{i1}x_1+\cdots+a_{in}x_n\), exactly the variable expression from equation \(i\). This check tests the row contents and their order; it does not solve the system.

Proposition: For a system written with a fixed variable order \(x_1,\dots,x_n\), the coefficient matrix has one row for each equation and one column for each variable. Its product with \(\mathbf{x}=\begin{bmatrix}x_1&\cdots&x_n\end{bmatrix}^{\top}\) lists the variable expressions on the left sides, in equation order.

Proof. Let the system have \(m\) equations, with equation \(i\) written as \(a_{i1}x_1+\cdots+a_{in}x_n=b_i\). By the definition of the coefficient matrix, row \(i\) is \(\begin{bmatrix}a_{i1}&\cdots&a_{in}\end{bmatrix}\), so it contains \(n\) entries, one for each variable. There are \(m\) such rows, so the matrix has \(m\) rows and \(n\) columns. By the definition of matrix-vector multiplication, the \(i\)th entry of \(\mathbf{A}\mathbf{x}\) is the dot product of row \(i\) with \(\mathbf{x}\), namely \(a_{i1}x_1+\cdots+a_{in}x_n\). This is the variable expression on the left side of equation \(i\). Since this holds for each \(i=1,\dots,m\), the product lists all those expressions in equation order. \(\square\)

Worked Two-Variable System

Worked Example: Missing Variable and Negative Coefficient

Construct the coefficient matrix for the system below using the variable order \(x,y\).

$$ \begin{aligned} 3x-2y&=7,\\ y&=4. \end{aligned} $$

The first equation has coefficient \(3\) for \(x\) and coefficient \(-2\) for \(y\), so its row is \(\begin{bmatrix}3&-2\end{bmatrix}\). The second equation has no \(x\)-term, so its \(x\)-coefficient is \(0\); its \(y\)-coefficient is \(1\), so its row is \(\begin{bmatrix}0&1\end{bmatrix}\). Therefore the coefficient matrix is

$$ \mathbf{A}= \begin{bmatrix} 3&-2\\ 0&1 \end{bmatrix}. $$

Check the rows by multiplying by the ordered variable vector:

$$ \begin{bmatrix} 3&-2\\ 0&1 \end{bmatrix} \begin{bmatrix} x\\ y \end{bmatrix} = \begin{bmatrix} 3x-2y\\ 0x+y \end{bmatrix} = \begin{bmatrix} 3x-2y\\ y \end{bmatrix}. $$

These are precisely the variable expressions on the left sides of the original equations. The constants \(7\) and \(4\) do not appear in this coefficient matrix.

Worked Three-Variable System

Worked Example: Zero Entries in a Three-Variable Matrix

Construct the coefficient matrix using the variable order \(x,y,z\).

$$ \begin{aligned} 2x+y-3z&=5,\\ -x+4z&=-2,\\ \tfrac12 x-y+2z&=0. \end{aligned} $$

Read the coefficients in the order \(x,y,z\). The first equation gives \((2,1,-3)\). The second equation has no \(y\)-term, giving \((-1,0,4)\). The third gives \((\tfrac12,-1,2)\). With one row per equation, the matrix is

$$ \mathbf{A}= \begin{bmatrix} 2&1&-3\\ -1&0&4\\ \tfrac12&-1&2 \end{bmatrix}. $$

To check, multiply by the column of variables in the same order:

$$ \begin{bmatrix} 2&1&-3\\ -1&0&4\\ \tfrac12&-1&2 \end{bmatrix} \begin{bmatrix} x\\ y\\ z \end{bmatrix} = \begin{bmatrix} 2x+y-3z\\ -x+0y+4z\\ \tfrac12x-y+2z \end{bmatrix} = \begin{bmatrix} 2x+y-3z\\ -x+4z\\ \tfrac12x-y+2z \end{bmatrix}. $$

Each component matches the variable expression in the corresponding equation. The zero in row 2, column 2 is needed to preserve the meaning of the \(y\)-column.

Changing the Variable Order

A different variable order is allowed, but all rows and the variable vector must use that same order. Changing the order changes the positions of the coefficients in every row. It does not change the equations themselves.

Proposition: If the variable order is changed, the coefficient in each row must move to the column assigned to its variable in the new order. Multiplying the resulting matrix by the variable column in that new order still produces the original variable expressions, in the original equation order.

Proof. Suppose the new ordered variables are \(u_1,\dots,u_n\), where each \(u_j\) is one of the original variables, with each original variable appearing exactly once. In equation \(i\), let \(c_{ij}\) be the coefficient of \(u_j\). The row formed in the new order is \(\begin{bmatrix}c_{i1}&\cdots&c_{in}\end{bmatrix}\), and the new variable column is \(\begin{bmatrix}u_1&\cdots&u_n\end{bmatrix}^{\top}\). Their product is \(c_{i1}u_1+\cdots+c_{in}u_n\). Since the \(u_j\) are exactly the same variables as before, only reordered, this sum contains exactly the same variable terms as equation \(i\). Repeating this for each row preserves the order of the equations and reproduces all their variable expressions. \(\square\)

Worked Example: A Deliberately Different Variable Order

Construct the coefficient matrix using the variable order \(z,x,y\) for the following equations:

$$ \begin{aligned} 2x-3y&=8-z,\\ 4y&=6+2z,\\ 3z&=1+x. \end{aligned} $$

First collect the variable terms on the left. The equations become \(z+2x-3y=8\), \(-2z+4y=6\), and \(3z-x=1\). Now read each equation in the order \(z,x,y\). The rows are \((1,2,-3)\), \((-2,0,4)\), and \((3,-1,0)\), respectively. Thus

$$ \mathbf{A}= \begin{bmatrix} 1&2&-3\\ -2&0&4\\ 3&-1&0 \end{bmatrix}, \qquad \mathbf{x}_{\mathrm{ord}}= \begin{bmatrix} z\\ x\\ y \end{bmatrix}. $$

The subscript on \(\mathbf{x}_{\mathrm{ord}}\) here simply reminds us that this variable column is ordered as \(z,x,y\), not \(x,y,z\). Multiplying checks the construction:

$$ \mathbf{A}\mathbf{x}_{\mathrm{ord}} = \begin{bmatrix} z+2x-3y\\ -2z+0x+4y\\ 3z-x+0y \end{bmatrix} = \begin{bmatrix} z+2x-3y\\ -2z+4y\\ 3z-x \end{bmatrix}. $$

The result matches the rearranged left sides, in the same equation order. The constants \(8,6,1\) are not included.

Common Mistake: Reading Columns in a Different Order

Suppose the system is \(x+2y=5\), \(3x-y=4\), and the stated variable order is \(y,x\). A common mistake is to write the rows in the familiar order \(x,y\), producing the incorrect matrix \(\begin{bmatrix}1&2\\3&-1\end{bmatrix}\) while still treating the columns as \(y,x\). Multiplying that matrix by \(\begin{bmatrix}y\\x\end{bmatrix}\) gives \(\begin{bmatrix}y+2x\\3y-x\end{bmatrix}\), which does not reproduce the system’s left sides.

With the required order \(y,x\), the first equation has coefficients \(2,1\), and the second has coefficients \(-1,3\). The correct matrix is

$$ \begin{bmatrix} 2&1\\ -1&3 \end{bmatrix}. $$

Indeed, multiplying by the variable column in the stated order gives

$$ \begin{bmatrix} 2&1\\ -1&3 \end{bmatrix} \begin{bmatrix} y\\ x \end{bmatrix} = \begin{bmatrix} 2y+x\\ -y+3x \end{bmatrix} = \begin{bmatrix} x+2y\\ 3x-y \end{bmatrix}. $$

The correction is not to change the equations or the chosen variable order, but to move each coefficient to the column assigned to its variable. Another related error is to place constants in the coefficient matrix. Constants are not coefficients of the variables, so they do not belong there.

Why the Construction Is Useful

A coefficient matrix gives a consistent way to organize a system, especially when equations contain different variables, negative signs, or missing terms. Its rows preserve equation order, and its columns preserve variable order. With those conventions fixed, the product of the matrix and the variable column reconstructs every left-hand side. That connection is the main check on a translation: if the product gives even one wrong variable expression, some coefficient has been omitted, misplaced, or given the wrong sign.

Keep the distinction between coefficients and constants clear. The matrix records the coefficients of the variables only; the equations also contain right-hand-side constants, which are part of the system but not part of its coefficient matrix. When constructing a matrix, label the variable order before reading coefficients, include zeros for missing variables, and check the product row by row.

Check Your Understanding

For each question, write the variable order explicitly and check your proposed rows by multiplying by the corresponding variable column.

  1. Construct the coefficient matrix for \(2x-y=3\), \(x+4y=-1\), using the order \(x,y\).
  2. Construct the coefficient matrix for \(y-2z=5\), \(3x+z=0\), using the order \(x,y,z\). Which entries are zero?
  3. For \(4x+y=2\), \(-x+3y=7\), write the coefficient matrix using the order \(y,x\).
  4. Explain why the equation \(5z=9\) contributes a zero coefficient for \(x\) and for \(y\) when the order is \(x,y,z\).
  5. A proposed row is \(\begin{bmatrix}2&-1&0\end{bmatrix}\) for an equation in \(x,y,z\). What variable expression does this row produce when multiplied by \(\begin{bmatrix}x&y&z\end{bmatrix}^{\top}\)?

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon