math-to-play-with  ...Because when we play, we learn!

Solve (simple linear) equations with matrices

    Let us have two simple, linear equations and two unknowns; something like:

      Equation 1: 7x + 3y = 44

      Equation 2: -1x + 10y = 25

    There are a few ways to solve for both x and y.

    We can, of course multiply one or both equations such that when we subtract one result for the other, one of the unknowns goes away. For example:

      Eq. 1: 7x + 3y = 44

      Eq. 2: -1x + 10y = 25 —> multiply Eq. 2 by -7 —>

      Eq. 2': 7x - 70y = -175

      —> Subtract Eq. 1 from Eq. 2':

      (7x - 7x) + (-70y - 3y) = (-175 - 44) —>

      -73y = -219 —>

      y = 219 / 73 = 3 —>

      And since 7x + 3y = 44 —>

      7x = 44 - 9 = 35 —>

      x = 35 / 7 = 5

    Another way to solve (most instances) equations such as these is by using matrices like so:

    We set up two matrices: one matrix — let us call that one left— containing the values on the left side of the "=" sign of the equations.

      73
      -110

    and one matrix — let us call that one right— holding the values to the right of the "=" sign:

      44
      25

    Next, we create a third matrix which is the so-called inverse of the left matrix1:

      0.137-0.041
      0.0140.096

    Finally, to solve for x and y we multiply the inverse matrix with the right matrix2. This gives a matrix with the solutions for x (top) and y (bottom):

      0.137-0.041
      0.0140.096
      ×
      44
      25
      =
      5
      3

    Note: not all cases of two simple linear equations can be solved this way. For instance, when the left sides of the equations are identical or when they are a multiple of each other, the inverse matrix cannot be computed.

      To play with this matrix solution follow these steps:

      1. Create two equations of the form Px + Qy = Result
      2. Fill in the values for P, Q and Result in the text boxes below.
      3. Hit the Solve for x and y! button to have the browser do the matrix math.
      Equation 1: x + y =

      Equation 2: x + y =

      left matrix:

        7 3
        -110

      right matrix:

        44
        25

      inverse of the left matrix:

        0.137 -0.041
        0.0140.096

      inverse × right matrix = solutions matrix with x (top) and y (bottom):

        0.137-0.041
        0.0140.096
        ×
        44
        25
        =
        5
        3

    1Here we do not go into how to create this inverse matrix.
    2Note that matrix multiplication is (generally) not commutative; i.e., A × B ≠ B × A.

About math-to-play-withContactDisclaimersLicense