Solve System Of Equations Using Matrices

6 min read

Solving a system of linear equations is a fundamental skill in algebra, but as the number of variables increases, traditional methods like substitution and elimination become cumbersome and prone to arithmetic errors. Here's the thing — using matrices transforms this process into a structured, algorithmic procedure that is not only efficient for hand calculations but also forms the backbone of computational mathematics and computer graphics. By representing a system as a matrix equation, you open up powerful tools like Gaussian elimination, inverse matrices, and Cramer’s Rule, turning a tangled web of variables into a clean, solvable format.

Understanding the Matrix Representation

Before diving into solution methods, Make sure you understand how to translate a system of equations into matrix form. It matters. Consider a general system of three equations with three unknowns:

$ \begin{cases} a_1x + b_1y + c_1z = d_1 \ a_2x + b_2y + c_2z = d_2 \ a_3x + b_3y + c_3z = d_3 \end{cases} $

This system can be expressed as a single matrix equation $AX = B$, where:

  • $A$ (Coefficient Matrix): Contains the coefficients of the variables. $ A = \begin{bmatrix} a_1 & b_1 & c_1 \ a_2 & b_2 & c_2 \ a_3 & b_3 & c_3 \end{bmatrix} $
  • $X$ (Variable Matrix): A column matrix of the unknowns. $ X = \begin{bmatrix} x \ y \ z \end{bmatrix} $
  • $B$ (Constant Matrix): A column matrix of the constants on the right-hand side. $ B = \begin{bmatrix} d_1 \ d_2 \ d_3 \end{bmatrix} $

The goal is to solve for $X$. The dimensions of these matrices must align: if there are $n$ equations and $n$ unknowns, $A$ is an $n \times n$ square matrix, $X$ is $n \times 1$, and $B$ is $n \times 1$. An augmented matrix $[A|B]$ combines the coefficient and constant matrices into a single block, separated by a vertical bar, which serves as the primary workspace for elimination methods.

Method 1: Gaussian Elimination (Row Reduction)

Gaussian elimination is the most universal method for solving linear systems using matrices. It relies on elementary row operations to transform the augmented matrix into Row-Echelon Form (REF) or Reduced Row-Echelon Form (RREF). The three legal operations are:

  1. Swap two rows ($R_i \leftrightarrow R_j$).
  2. Multiply a row by a non-zero scalar ($kR_i \rightarrow R_i$).
  3. Add a multiple of one row to another ($R_i + kR_j \rightarrow R_i$).

Step-by-Step Procedure

  1. Write the Augmented Matrix: Construct $[A|B]$.
  2. Forward Elimination (Get REF): Work column by column from left to right.
    • Get a pivot (a leading 1) in the first row, first column. If the entry is 0, swap with a row below that has a non-zero entry.
    • Use the pivot row to create zeros below the pivot in the first column.
    • Move to the second row, second column. Repeat: create a pivot (1) and zeros below it.
    • Continue until the matrix is in upper triangular form (Row-Echelon Form).
  3. Back Substitution (or Continue to RREF):
    • Option A (Back Substitution): Once in REF, write the equations back out and solve from the bottom up.
    • Option B (Gauss-Jordan Elimination): Continue row operations to get zeros above the pivots as well, resulting in Reduced Row-Echelon Form (Identity matrix on the left). The solution appears directly in the constant column.

Example of Gaussian Elimination

Solve the system: $ \begin{cases} x + 2y - z = 3 \ 2x - y + 3z = 9 \ 3x + y - 2z = 0 \end{cases} $

1. Augmented Matrix: $ \left[\begin{array}{ccc|c} 1 & 2 & -1 & 3 \ 2 & -1 & 3 & 9 \ 3 & 1 & -2 & 0 \end{array}\right] $

2. Eliminate Column 1 (Target: Zeros below Row 1):

  • $R_2 \leftarrow R_2 - 2R_1$
  • $R_3 \leftarrow R_3 - 3R_1$

$ \left[\begin{array}{ccc|c} 1 & 2 & -1 & 3 \ 0 & -5 & 5 & 3 \ 0 & -5 & 1 & -9 \end{array}\right] $

3. Eliminate Column 2 (Target: Pivot in Row 2, Zero below):

  • Simplify $R_2$: $R_2 \leftarrow -\frac{1}{5}R_2$ $ \left[\begin{array}{ccc|c} 1 & 2 & -1 & 3 \ 0 & 1 & -1 & -0.6 \ 0 & -5 & 1 & -9 \end{array}\right] $
  • $R_3 \leftarrow R_3 + 5R_2$ $ \left[\begin{array}{ccc|c} 1 & 2 & -1 & 3 \ 0 & 1 & -1 & -0.6 \ 0 & 0 & -4 & -12 \end{array}\right] $

4. Normalize Row 3 (Get Pivot 1):

  • $R_3 \leftarrow -\frac{1}{4}R_3$ $ \left[\begin{array}{ccc|c} 1 & 2 & -1 & 3 \ 0 & 1 & -1 & -0.6 \ 0 & 0 & 1 & 3 \end{array}\right] $

5. Back Substitution (or Gauss-Jordan): From Row 3: $z = 3$. From Row 2: $y - z = -0.6 \Rightarrow y - 3 = -0.6 \Rightarrow y = 2.4$. From Row 1: $x + 2y - z = 3 \Rightarrow x + 4.8 - 3 = 3 \Rightarrow x = 1.2$.

Solution: $(x, y, z) = (1.2, 2.4, 3)$.

Method 2: The Inverse Matrix Method ($X = A^{-1}B$)

If the coefficient matrix $A$ is square and invertible (non-singular), meaning its determinant is not zero ($\det(A) \neq 0$), you can solve the system by finding the inverse of $A$. Since $AX = B$, multiplying both sides by $A^{-1}$ yields:

$ A^{-1}AX = A^{-1}B \implies IX = A^{-1}B \implies X = A^{-1}B $

When to Use This Method

  • Pros: Extremely fast if you need to solve $AX = B$ for multiple different $B$ vectors (same coefficients, different constants). You calculate $A^{-1}$ once and multiply it by each new $B$.
  • Cons: Computationally expensive for

Cons: Computationally expensive for large matrices (typically $O(n^3)$ operations) compared to Gaussian elimination, and numerically unstable if the matrix is ill-conditioned (determinant close to zero). Calculating the inverse explicitly is rarely the best approach for a single system on a computer.

Finding the Inverse (Gauss-Jordan Method)

To find $A^{-1}$, augment $A$ with the Identity matrix $I$ and row-reduce until the left side becomes $I$; the right side will be $A^{-1}$. $ [A | I] \xrightarrow{\text{RREF}} [I | A^{-1}] $

Example (using the same system): $ A = \begin{bmatrix} 1 & 2 & -1 \ 2 & -1 & 3 \ 3 & 1 & -2 \end{bmatrix}, \quad B = \begin{bmatrix} 3 \ 9 \ 0 \end{bmatrix} $

Augment with $I_3$: $ \left[\begin{array}{ccc|ccc} 1 & 2 & -1 & 1 & 0 & 0 \ 2 & -1 & 3 & 0 & 1 & 0 \ 3 & 1 & -2 & 0 & 0 & 1 \end{array}\right] $

Performing Gauss-Jordan elimination (steps omitted for brevity, but identical logic to Method 1) yields: $ \left[\begin{array}{ccc|ccc} 1 & 0 & 0 & -0.2 & 0.6 & 0.In practice, 4 \ 0 & 1 & 0 & -0. 8 & -0.2 & 0.Because of that, 4 \ 0 & 0 & 1 & -1. But 0 & -1. 0 & -0.

So, $ A^{-1} = \begin{bmatrix} -0.2 & 0.6 & 0.Also, 4 \ -0. 8 & -0.But 2 & 0. That's why 4 \ -1. Still, 0 & -1. 0 & -0 Easy to understand, harder to ignore..

Now multiply $X = A^{-1}B$: $ \begin{bmatrix} x \ y \ z \end{bmatrix} = \begin{bmatrix} -0.2 & 0.Here's the thing — 4 \ -0. 4 \ -2.4 \ -1.Also, 6 + 5. So naturally, 0 & -0. 0 & -1.8 \ -3 - 9 \end{bmatrix} = \begin{bmatrix} 4.2 & 0.6 & 0.4 - 1.8 & -0.2 \end{bmatrix} \begin{bmatrix} 3 \ 9 \ 0 \end{bmatrix} = \begin{bmatrix} -0.8 \ -4 Not complicated — just consistent..

Correction on arithmetic: Row 1: $(-0.2)(3) + (0.6)(9) + (0.4)(0) = -0.6 + 5.4 = 4.8$? No, previous solution was $x=1.2$. Let's re-check the inverse calculation. Determinant of A: $1(2-3) -2(-4-9) -1(2+3) = -1 + 26 - 5 = 20$. Cofactors: $C_{11} = -1, C_{12} = 13, C_{13} = 5$ $C_{21} = -3, C_{22} = 1, C_{23} = 5$ $C_{31} = 5, C_{32} = -5, C_{33} = -5$ Adjugate (Transpose of Cofactors): $ \text{adj}(A) = \begin{bmatrix} -1 & -3 & 5 \ 13 & 1 & -5 \ 5 & 5 & -5 \end{bmatrix} $ $ A^{-1} = \frac{1}{20} \begin{bmatrix} -1 & -3 & 5 \ 13 & 1 & -5 \ 5 & 5 & -5 \end{bmatrix} = \begin{bmatrix} -0.05 & -0.15 & 0.25 \ 0.65 & 0.05 & -0.25 \ 0.25 & 0.25 & -0.25 \end{bmatrix} $ Multiply by $B = [3, 9, 0]^T$: $x = -0.15 - 1.35 = -1.5$? No. $x = (-0.05)(3) + (-0.15)(9) + (0.25)(0) = -0.15 - 1.35 = -1.5$. $y = (0.65)(3) + (0.05)(9) = 1.95 + 0.45 = 2.4$. $z = (0.

Just Went Up

Just Published

Keep the Thread Going

Up Next

Thank you for reading about Solve System Of Equations Using Matrices. We hope the information has been useful. Feel free to contact us if you have any questions. See you next time — don't forget to bookmark!
⌂ Back to Home