Skip to main content
Engineering LibreTexts

16.5: Solving Systems of Equations with Matrices

  • Page ID
    55335
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    A system of equations is any set of equations that share some variables. A linear equation is an equation that consists entirely of constants and simple variables. These variables can only be multiplied by a constant, and cannot be multiplied together, raised to an exponent, used on logs or square roots, or put through other, more complex mathematical functions. An example of a system of linear equations is provided below.

    \[ F_{AX} + F_{BX} = 0 \]

    \[ F_{AY} - 8 = 0 \]

    \[ -16 + 4 F_{AY} + 8 F_{AX} = 0 \]

    In courses such as statics and dynamics, we will often wind up with a system of linear equations and be asked to solve for the unknowns in those equations. When we have just a few equations in our system, we will generally solve the equations by hand using algebraic methods such as substitution or elimination though addition or subtraction. For larger and more complex problems, we can wind up with larger systems of equations and at some point the math may become difficult to handle by hand. For these large systems of linear equations, the easiest way to solve for the unknowns is to convert the system of equations into a single matrix equation, and then use computer tools to solve the matrix equation for unknowns. Some computer tools will let you enter the system of equations manually, but in the background the computer is probably just converting it to a matrix equation in the background. For this reason it can be useful to understand this process.

    In terms of assumptions, it is important to mention that this method will only work with systems of linear equations, and to have a solvable matrix equation we will need to have the same number of equations as unknown variables. For example, above we have a system of equations with three equations and three unknown variables. If these numbers do not match we will not be able to solve the matrix equation using the method described below.

    Converting a System of Equations to a Matrix Equation:

    The first step in converting a system of equations into a matrix equation is to rearrange the equations into a consistent format. Generally we will put all the variables with their coefficients on one side of the equation and the constants on the other side of the equation. Additionally, it is best to list the variables in the same order in each equation. This process of rearranging the equations will make conversion later on easier.

    Equations 1-3 from above are rewritten so that for each equation, all the variables are collected on the left side of the equation while the constants are on the right side. Then the left side of each equation is rewritten, with the coefficients as one row of a 3-by-3 matrix (called the coefficient matrix, or matrix A). The leftmost column of matrix A holds coefficients of variable F_AX, the middle column holds coefficients of variable F_AY, and the rightmost column holds coefficients of variable F_BX. Matrix A is multiplied by Matrix X, the variable matrix, which consists of a 3-by-1 matrix with entries F_AX, F_AY, and F_BX from top to bottom. The product of matrices A and X is equal to Matrix B, the constant matrix, which is a 3-by-1 matrix. The entries in Matrix B are the right sides of the rewritten versions of Equations 1-3, with each row lined up with the row of the corresponding coefficients in Matrix A.
    Figure \(\PageIndex{1}\): To convert a system of equations into a single matrix equation, we will first rearrange the equations for a consistent order. Then we will write out the coefficient (\(A\)), variable (\(X\)), and constant (\(B)\) matrices.

    Next we will begin the process of writing out the three matrices that make up the matrix equation. These three matrices are the coefficient matrix (often referred to as the \(A\) matrix), the variable matrix (often referred to as the \(X\) matrix), and the constant matrix (often referred to as the \(B\) matrix).

    • The coefficient matrix (or \(A\) matrix) is a \(N \times N\) matrix (where \(N\) is the number of equations / number of unknown variables) that contains all the coefficients for the variables. Each row of the matrix represents a single equation while each column represents a single variable (it is sometimes helpful to write the variable at the top of each column). For instances where a variable does not show up in an equation, we assume a coefficient of 0.
    • The variable matrix (or \(X\) matrix) is a \(N \times 1\) matrix that contains all the unknown variables. It is important that the order of the variables in the coefficient matrix match the order of the variables in the variable matrix.
    • Finally, on the other side of the equal sign we have the constant matrix (or \(B\) matrix). This is a \(N \times 1\) matrix containing all the constants from the right side of the equations. It is important that the order of the constants matches the order of equations in the coefficient matrix.

    Once we have the three matrices set up, we are ready to solve for the unknowns in the variable matrix.

    Solving the Matrix Equation:

    Starting with our \(A\), \(X\), and \(B\) matrices in the matrix equation below, we are looking to solve for for values of the unknown variables that are contained in our \(X\) matrix.

    \[ [A][X] = [B] \]

    For a scalar equation, we would simply do this by dividing both sides by \(A\), where the value for \(X\) would be \(B/A\). With a matrix equation, we will instead need to multiple both sides of the equation by the inverse of the \(A\) matrix. This will cancel out the \(A\) matrix on the left side, leaving only the \(X\) matrix that you are looking for. On the left we will have the inverse of the \(A\) matrix times the \(B\) matrix. The result of this operation will be a \(N \times 1\) matrix containing the solution for all the variables. The value in each row of the solution will correspond to the variable listed in the same row of the \(X\) matrix.

    \[ [X] = [A]^{-1} [B] \]

    It is possible to find the inverse of the \(A\) matrix by hand and then multiply this with the \(B\) matrix, but this process would take longer than just solving the equations using algebra. The true strength of the method is that computer tools such as MATLAB or Wolfram Alpha can perform the matrix inversion and multiplication for you.

    Video lecture covering this section, delivered by Dr. Jacob Moore. YouTube source: https://youtu.be/ZLaeFbqR9QU.

    Example \(\PageIndex{1}\)

    The equilibrium equations for the body shown below are listed on the right. Convert the system of equations into a single matrix equation and solve for the unknowns.

    A 10-meter-long vertical pole experiences two forces at its top end: a rightwards force of 600 N, and a tension force T along a cable that runs downwards and to the left of the pole's top end at 30° from the vertical. The bottom end of the pole experiences a rightwards force of F_AX and an upwards force of F_AY. Three equations describe the forces on the body at equilibrium. Equation 1: F_AX - sin(30°) T + 600 = 0. Equation 2: F_AY - cos(30°) T = 0. Equation 3: 10 sin(30) T - (600)(10) = 0.
    Figure \(\PageIndex{2}\): problem diagram for Example \(\PageIndex{1}\). A system of equations to solve for the forces experienced by a vertical pole attached to the ground.
    Solution:
    Video \(\PageIndex{2}\): Worked solution to example problem \(\PageIndex{1}\), provided by Dr. Jacob Moore. YouTube source: https://youtu.be/QX-hJhXTEe0.

    This page titled 16.5: Solving Systems of Equations with Matrices is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Jacob Moore & Contributors (Mechanics Map) via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.

    • Was this article helpful?