Tutorials › Linear Algebra › Checking a Candidate Solution by Substitution

Vectors and Linear Combinations · Tutorial 134 of 1000

Checking a Candidate Solution by Substitution

You will learn a reliable, exact procedure for deciding whether a proposed vector satisfies a matrix equation.

Beginner 8 min read

What You'll Learn

  • Check the dimensions of a proposed vector before substituting it.
  • Compute each coordinate of a matrix-vector product from the corresponding row.
  • Decide whether a candidate satisfies the full equation by comparing every coordinate.
  • Use the residual vector to summarize the difference between the two sides.
  • Diagnose sign, coordinate-order, and arithmetic errors by checking calculations step by step.

What It Means to Check a Candidate

Solving a matrix equation and checking a proposed solution are different tasks. Solving asks which vectors satisfy the equation; checking asks whether one particular vector does. Substitution answers the second question directly: form the matrix-vector product and compare it with the stated right-hand side. This is useful after solving a system, when checking a result from another source, or when tracing an error in a calculation.

Let \(\mathbf{A}\in\mathbb{R}^{m\times n}\), let \(\mathbf{x}\in\mathbb{R}^n\), and let \(\mathbf{b}\in\mathbb{R}^m\). The equation \(\mathbf{A}\mathbf{x}=\mathbf{b}\) is meaningful because the product has \(m\) coordinates, just like \(\mathbf{b}\). A candidate solution is a proposed vector \(\mathbf{x}\) that we test in this equation. To check it, compute \(\mathbf{A}\mathbf{x}\) using the entries of \(\mathbf{A}\) and \(\mathbf{x}\), then compare the result with \(\mathbf{b}\) coordinate by coordinate.

Definition: A vector \(\mathbf{x}\in\mathbb{R}^n\) is a solution of \(\mathbf{A}\mathbf{x}=\mathbf{b}\) if and only if the computed vector \(\mathbf{A}\mathbf{x}\) equals \(\mathbf{b}\). It is not a solution if even one coordinate of \(\mathbf{A}\mathbf{x}\) differs from the corresponding coordinate of \(\mathbf{b}\).

If the rows of \(\mathbf{A}\) are \((a_{i1},\dots,a_{in})\), then the \(i\)th coordinate of \(\mathbf{A}\mathbf{x}\) is \(a_{i1}x_1+\cdots+a_{in}x_n\). Thus a check consists of evaluating every row expression, not just one of them. Matching a few coordinates is not sufficient: vector equality requires equality in all \(m\) coordinates.

Theorem (Coordinate test for a candidate): For \(\mathbf{A}\in\mathbb{R}^{m\times n}\), \(\mathbf{x}\in\mathbb{R}^n\), and \(\mathbf{b}\in\mathbb{R}^m\), the equation \(\mathbf{A}\mathbf{x}=\mathbf{b}\) holds if and only if \(a_{i1}x_1+\cdots+a_{in}x_n=b_i\) for every \(i=1,\dots,m\).

Proof. By the definition of matrix-vector multiplication, the \(i\)th coordinate of \(\mathbf{A}\mathbf{x}\) is \(a_{i1}x_1+\cdots+a_{in}x_n\). Two vectors in \(\mathbb{R}^m\) are equal exactly when their corresponding coordinates are equal. Therefore, \(\mathbf{A}\mathbf{x}=\mathbf{b}\) holds exactly when the \(i\)th coordinate of \(\mathbf{A}\mathbf{x}\) equals \(b_i\) for every \(i\). Substituting the formula for that coordinate gives the stated row equations. \(\square\)

A Direct Substitution Check

The safest routine is to write the candidate as a column, use the rows of the matrix, and show each scalar product before comparing. Keeping the products separate makes it easier to identify a wrong sign or arithmetic step. Do not rely on a visual impression that a vector “looks right,” and do not stop after checking the first row.

1
Check dimensions.
For an \(m\times n\) matrix, the candidate must have \(n\) entries and the right-hand side must have \(m\) entries.
2
Compute every row.
Multiply each row of \(\mathbf{A}\) by the candidate’s coordinates and add the products exactly.
3
Compare coordinate by coordinate.
If all computed entries equal the corresponding entries of \(\mathbf{b}\), the candidate is a solution. If any entry differs, it is not.

Worked Example: Checking a Candidate That Works

Check whether \(\mathbf{x}=\begin{bmatrix}2\\1\end{bmatrix}\) solves \(\mathbf{A}\mathbf{x}=\mathbf{b}\), where \(\mathbf{A}=\begin{bmatrix}2&1\\1&3\end{bmatrix}\) and \(\mathbf{b}=\begin{bmatrix}5\\5\end{bmatrix}\).

The matrix has two columns, so the candidate must have two entries; it does. Compute the product by rows:

$$ \mathbf{A}\mathbf{x} = \begin{bmatrix}2&1\\1&3\end{bmatrix} \begin{bmatrix}2\\1\end{bmatrix} = \begin{bmatrix} 2(2)+1(1)\\ 1(2)+3(1) \end{bmatrix} = \begin{bmatrix} 4+1\\ 2+3 \end{bmatrix} = \begin{bmatrix}5\\5\end{bmatrix}. $$

This equals \(\mathbf{b}\) in both coordinates: the first entry is \(5\), and the second entry is \(5\). Therefore, the proposed vector is a solution.

Check: The two row equations are \(2(2)+1(1)=5\) and \(1(2)+3(1)=5\). Both agree with the corresponding right-hand-side entries, confirming the matrix product.

A valid check verifies only the candidate that was supplied. It does not show that the equation has no other solutions, or that the candidate is the only solution. Those are questions about the full solution set, not about substituting one vector. Conversely, if substitution produces a mismatch, there is no need to continue solving in order to conclude that this particular candidate fails.

Signs and Coordinate Order

When a candidate contains negative entries, preserve each sign all the way through the row products. A negative coordinate is multiplied by every entry in its column; it does not change the signs of the other coordinates in the candidate. Also keep the coordinate order fixed. The first entry of \(\mathbf{x}\) multiplies the first column of \(\mathbf{A}\), the second entry multiplies the second column, and so on. Reversing the entries changes the vector being tested.

Worked Example: A Sign Error in the Candidate

Test \(\mathbf{x}=\begin{bmatrix}1\\2\end{bmatrix}\) in the equation \(\mathbf{A}\mathbf{x}=\mathbf{b}\), where \(\mathbf{A}=\begin{bmatrix}1&-2\\3&1\end{bmatrix}\) and \(\mathbf{b}=\begin{bmatrix}-3\\5\end{bmatrix}\).

Compute each row using the candidate exactly as written:

$$ \mathbf{A}\mathbf{x} = \begin{bmatrix}1&-2\\3&1\end{bmatrix} \begin{bmatrix}1\\2\end{bmatrix} = \begin{bmatrix} 1(1)+(-2)(2)\\ 3(1)+1(2) \end{bmatrix} = \begin{bmatrix} 1-4\\ 3+2 \end{bmatrix} = \begin{bmatrix}-3\\5\end{bmatrix}. $$

The product equals the stated right-hand side in both coordinates, so this candidate is a solution. The negative entry \(-2\) in the matrix contributes \((-2)(2)=-4\) to the first row; it is not \(+4\).

Check: The first row gives \(-3\), and the second gives \(5\). Thus \(\mathbf{A}\mathbf{x}=\mathbf{b}\) as required.

Worked Example: Reversing the Coordinates Changes the Test

Let \(\mathbf{A}=\begin{bmatrix}1&2\\0&-1\\3&1\end{bmatrix}\) and \(\mathbf{b}=\begin{bmatrix}0\\1\\5\end{bmatrix}\). Check the proposed vector \(\mathbf{x}=\begin{bmatrix}-1\\2\end{bmatrix}\), and compare it with the vector whose coordinates are in the opposite order.

For the proposed vector, the first coordinate is \(-1\) and the second is \(2\). The row calculations are

$$ \mathbf{A}\mathbf{x} = \begin{bmatrix} 1(-1)+2(2)\\ 0(-1)+(-1)(2)\\ 3(-1)+1(2) \end{bmatrix} = \begin{bmatrix} -1+4\\ 0-2\\ -3+2 \end{bmatrix} = \begin{bmatrix}3\\-2\\-1\end{bmatrix}. $$

This is not \(\mathbf{b}=\begin{bmatrix}0\\1\\5\end{bmatrix}\), so the proposed vector is not a solution. For comparison, reversing the coordinates gives \(\widetilde{\mathbf{x}}=\begin{bmatrix}2\\-1\end{bmatrix}\). Testing that different vector gives

$$ \mathbf{A}\widetilde{\mathbf{x}} = \begin{bmatrix} 1(2)+2(-1)\\ 0(2)+(-1)(-1)\\ 3(2)+1(-1) \end{bmatrix} = \begin{bmatrix} 2-2\\ 0+1\\ 6-1 \end{bmatrix} = \begin{bmatrix}0\\1\\5\end{bmatrix} =\mathbf{b}. $$

So the reversed vector does solve the equation, but that does not make the originally proposed vector a solution. They are different columns and must be checked separately.

Check: For \(\mathbf{x}\), the three computed entries are \(3,-2,-1\), none of which matches the corresponding entry of \(\mathbf{b}\). For \(\widetilde{\mathbf{x}}\), all three entries match. This verifies both conclusions.

The Residual Records the Difference

It is sometimes useful to collect every discrepancy in one vector. Define the residual of a candidate \(\mathbf{x}\) for the equation \(\mathbf{A}\mathbf{x}=\mathbf{b}\) to be \(\mathbf{r}=\mathbf{b}-\mathbf{A}\mathbf{x}\). This sign convention means that a positive residual coordinate records how much larger the corresponding entry of \(\mathbf{b}\) is than the computed product. A zero residual means there is no discrepancy.

Theorem (Residual test): A candidate \(\mathbf{x}\in\mathbb{R}^n\) solves \(\mathbf{A}\mathbf{x}=\mathbf{b}\) if and only if its residual \(\mathbf{r}=\mathbf{b}-\mathbf{A}\mathbf{x}\) is \(\mathbf{0}\).

Proof. Suppose first that \(\mathbf{x}\) solves the equation. Then \(\mathbf{A}\mathbf{x}=\mathbf{b}\), so \(\mathbf{r}=\mathbf{b}-\mathbf{A}\mathbf{x}=\mathbf{b}-\mathbf{b}=\mathbf{0}\). Conversely, suppose \(\mathbf{r}=\mathbf{0}\). By the definition of the residual, \(\mathbf{b}-\mathbf{A}\mathbf{x}=\mathbf{0}\). Adding \(\mathbf{A}\mathbf{x}\) to both sides gives \(\mathbf{b}=\mathbf{A}\mathbf{x}\), which is the required equation. Both implications use the same fixed matrix, candidate, and right-hand side. \(\square\)

The residual does not replace the substitution calculation; it summarizes its outcome. If one coordinate of \(\mathbf{r}\) is nonzero, the candidate fails at the corresponding row. In exact arithmetic, the test is simply whether every residual entry equals zero. When the entries are small fractions or integers, retaining exact values avoids confusing a rounding discrepancy with an exact equality.

Worked Example: Catching an Arithmetic Error with the Residual

Check \(\mathbf{x}=\begin{bmatrix}1\\2\\-1\end{bmatrix}\) against \(\mathbf{A}=\begin{bmatrix}4&-2&1\\1&3&-2\end{bmatrix}\) and \(\mathbf{b}=\begin{bmatrix}-1\\9\end{bmatrix}\).

The first row gives \(4(1)+(-2)(2)+1(-1)=4-4-1=-1\). The second row gives \(1(1)+3(2)+(-2)(-1)=1+6+2=9\). Therefore,

$$ \mathbf{A}\mathbf{x} = \begin{bmatrix}-1\\9\end{bmatrix} =\mathbf{b}, \qquad \mathbf{r} = \mathbf{b}-\mathbf{A}\mathbf{x} = \begin{bmatrix}-1\\9\end{bmatrix} - \begin{bmatrix}-1\\9\end{bmatrix} = \begin{bmatrix}0\\0\end{bmatrix}. $$

The candidate is a solution. A common arithmetic slip is to evaluate \(4-4-1\) as \(1\), perhaps by dropping the last negative term. That would produce the incorrect product \(\begin{bmatrix}1\\9\end{bmatrix}\), and the apparent residual \(\begin{bmatrix}-2\\0\end{bmatrix}\). Recomputing the first row term by term shows that the correct value is \(-1\), so the apparent mismatch came from the calculation, not from the candidate.

Check: Substitution gives \((-1,9)^{\top}\), and subtracting this from \(\mathbf{b}\) gives \((0,0)^{\top}\). The product and residual therefore agree with the conclusion.

Common Pitfalls and a Reliable Conclusion

Comparing only one row is not enough. A candidate must satisfy every row equation. A match in the first coordinate with a mismatch in the second still means the vectors are unequal. Changing the candidate while calculating is also an error: if a sign or coordinate is rewritten, the resulting product tests the rewritten vector, not the one originally proposed. Finally, a failed test identifies only that the candidate is wrong; it does not by itself tell us what the correct solution is.

For a concrete false conclusion, consider the previous example and the incorrect first-row calculation \(4-4-1=1\). It leads to \(\mathbf{A}\mathbf{x}=\begin{bmatrix}1\\9\end{bmatrix}\) and the claim that the candidate fails. The correction is to preserve the signed terms: \(4(1)=4\), \((-2)(2)=-4\), and \(1(-1)=-1\), so \(4+(-4)+(-1)=-1\). The correct product is \(\begin{bmatrix}-1\\9\end{bmatrix}\), which equals \(\mathbf{b}\). Writing each product before adding prevents the mistaken sign or omitted term from determining the result.

A complete conclusion should name the tested candidate and state the comparison. For instance: “The product is \(\begin{bmatrix}-1\\9\end{bmatrix}\), which equals \(\mathbf{b}\), so the proposed vector is a solution.” If there is a mismatch, show the computed product and identify at least one coordinate that differs. This makes the decision checkable without repeating the process used to find the candidate.

Check Your Understanding

For each question, show the row calculations and compare every coordinate before deciding.

  1. Does \(\mathbf{x}=\begin{bmatrix}3\\-1\end{bmatrix}\) solve \(\begin{bmatrix}2&1\\1&-2\end{bmatrix}\mathbf{x}=\begin{bmatrix}5\\5\end{bmatrix}\)?
  2. For \(\mathbf{A}=\begin{bmatrix}1&-1\\2&3\end{bmatrix}\) and \(\mathbf{b}=\begin{bmatrix}4\\1\end{bmatrix}\), check the candidate \(\mathbf{x}=\begin{bmatrix}1\\-3\end{bmatrix}\).
  3. Compute the residual when \(\mathbf{A}=\begin{bmatrix}1&2\\-1&1\\2&0\end{bmatrix}\), \(\mathbf{x}=\begin{bmatrix}2\\1\end{bmatrix}\), and \(\mathbf{b}=\begin{bmatrix}4\\-1\\5\end{bmatrix}\). Is the candidate a solution?
  4. Explain why checking only the first row of a system with three rows cannot establish that a candidate is a solution.
  5. A student computes \(3(2)+(-1)(4)\) as \(10\). Identify the arithmetic error and give the correct value.

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