From Equations to a Matrix Equation
A system of linear equations can be written compactly as one matrix equation. The compression is useful only if the coefficients, unknowns, and constants stay aligned: each equation becomes one row, and each unknown keeps the same position throughout the matrix and vector. In particular, an unknown that does not appear in an equation still has a place in that equation’s row, with coefficient zero.
Work over the real numbers. Suppose a system has \(m\) equations and the ordered unknowns \(x_1,\dots,x_n\). Put each equation in standard form: all terms involving unknowns on the left and the constant on the right. Write the \(i\)th equation as \(a_{i1}x_1+\cdots+a_{in}x_n=b_i\). Here \(a_{ij}\) is the coefficient of the \(j\)th unknown in the \(i\)th equation, and \(b_i\) is the right-hand-side constant.
The dimensions are part of the translation, not an optional check: an \(m\times n\) coefficient matrix multiplies an \(n\)-entry unknown vector and gives an \(m\)-entry vector. The order of the unknowns determines the order of the columns. If the unknown vector is \((x,y,z)^{\top}\), then every row lists the coefficients of \(x\), then \(y\), then \(z\), even when one or more coefficients are zero.
Build Each Row in the Same Order
A reliable procedure is to decide the variable order first, put each equation in standard form, and then record its coefficients in that order. Keep the constants on the right-hand side. An absent variable contributes a zero entry; it does not cause the other coefficients in that row to shift columns.
For example, choose \(x,y,z\). Use this exact order in \(\mathbf{x}\) and across every row of \(\mathbf{A}\).
Collect like variable terms on the left and constants on the right, simplifying coefficients as needed.
Read the coefficients in the chosen unknown order. Insert zero wherever an unknown has no term.
Put the right-hand-side constant of each equation in the corresponding position of \(\mathbf{b}\).
Use the row formula for \(\mathbf{A}\mathbf{x}\) to confirm that its entries reproduce the left sides of the original equations.
The row formula makes the check precise. If \(\mathbf{x}=(x_1,\dots,x_n)^{\top}\), then the \(i\)th entry of \(\mathbf{A}\mathbf{x}\) is \(a_{i1}x_1+\cdots+a_{in}x_n\). Thus the \(i\)th equation is represented by the \(i\)th row of \(\mathbf{A}\) together with the \(i\)th entry of \(\mathbf{b}\).
Worked Example: Three Equations and Three Unknowns
Write the system \(2x-y+3z=4\), \(-x+4y=-2\), and \(5x-z=7\) as \(\mathbf{A}\mathbf{x}=\mathbf{b}\), using the unknown order \(x,y,z\).
The first equation has coefficients \(2,-1,3\), followed by right-hand side \(4\). In the second equation, there is no \(z\)-term, so its coefficient is \(0\): the row is \((-1,4,0)\). In the third equation, there is no \(y\)-term, so its row is \((5,0,-1)\). Therefore
Check: multiplying by rows gives \(2x-y+3z\), \(-x+4y+0z\), and \(5x+0y-z\). Setting these entries equal to \(4,-2,7\), respectively, recovers all three original equations.
Zero Coefficients Keep the Columns Aligned
Zero entries have a structural role. They show which unknown is absent while keeping every equation’s coefficient list the same length and in the same order. An equation involving only some of the chosen unknowns still contributes a complete row with \(n\) entries. Equations that contain no variable terms can also be represented: their coefficient row consists entirely of zeros.
Worked Example: Missing Unknowns and a Zero Row
Use the unknown order \(x,y,z\) to encode \(2x-3z=8\), \(5y=-10\), and \(0=0\).
The first equation has \(x\)-coefficient \(2\), \(y\)-coefficient \(0\), and \(z\)-coefficient \(-3\). The second has coefficients \(0,5,0\). The third has no variable terms, so all three coefficients are zero; its right-hand side is also zero. This gives
Check: the three entries of \(\mathbf{A}\mathbf{x}\) are \(2x+0y-3z\), \(0x+5y+0z\), and \(0x+0y+0z\). Equating them to \(8,-10,0\) reproduces the system exactly. The all-zero row records \(0=0\); this encoding by itself does not require deciding what the full system’s solutions are.
The right-hand side must be read after the equation is put in standard form. Moving a term across the equality changes its sign. If a constant begins on the left, it must be moved too. Simplifying first prevents a frequent source of incorrect entries: recording a coefficient before combining all the terms involving that unknown.
Worked Example: Rearranging Before Recording Coefficients
Encode this system in the order \(x,y,z\): \(3x+2=y-z+5\), \(2(y+1)=4x+z-6\), and \(2x+y=x+y+1\).
For the first equation, subtract \(y\) from both sides and add \(z\) to both sides. Then subtract \(2\) from both sides: \(3x-y+z=3\). Its row is \((3,-1,1)\), and its right-hand side is \(3\).
For the second equation, expand the left side to get \(2y+2=4x+z-6\). Subtract \(4x\) and \(z\) from both sides, then subtract \(2\) from both sides: \(-4x+2y-z=-8\). Its row is \((-4,2,-1)\), and its right-hand side is \(-8\).
For the third equation, subtract \(x\) and \(y\) from both sides. The result is \(x=1\), or \(x+0y+0z=1\). Its row is \((1,0,0)\). Consequently,
Check: the row products are \(3x-y+z\), \(-4x+2y-z\), and \(x\). Equating these to \(3,-8,1\) gives the three rearranged equations above. Reversing the rearrangements recovers the original equations, including the constants \(2\), \(5\), and \(-6\).
Why the Encoding Represents the Same System
Proof. Assume the \(i\)th equation is \(a_{i1}x_1+\cdots+a_{in}x_n=b_i\), for each \(i=1,\dots,m\), and let \(\mathbf{x}\) be the column of values in the fixed order. By the definition of matrix-vector multiplication, the \(i\)th entry of \(\mathbf{A}\mathbf{x}\) is \(a_{i1}x_1+\cdots+a_{in}x_n\). Therefore the \(i\)th equation holds exactly when the \(i\)th entry of \(\mathbf{A}\mathbf{x}\) equals \(b_i\). This statement holds for every \(i\) exactly when all \(m\) equations hold, which is exactly the vector equality \(\mathbf{A}\mathbf{x}=\mathbf{b}\). Hence the system and matrix equation have the same satisfying assignments. \(\square\)
The result explains why preserving order is essential: the coefficient in column \(j\) multiplies the \(j\)th entry of \(\mathbf{x}\). The zero coefficient case is included in the proof, since a missing variable contributes \(0x_j=0\) to the row product.
Proof. Fix an equation number \(i\) and an unknown position \(j\). In standard form, the coefficient of \(x_j\) in equation \(i\), after like terms have been collected, determines the entry in row \(i\), column \(j\). Thus every entry \(a_{ij}\) is fixed by the system. The constant on the right side of equation \(i\) determines \(b_i\), so every entry of \(\mathbf{b}\) is fixed as well. Since this applies to every row and column, no different coefficient matrix or right-hand-side vector can represent that same fixed, standard-form system with the same orders. \(\square\)
Common Mistake: Dropping a Zero Entry
Consider the equation \(x+z=4\) with the unknown order \(x,y,z\). A tempting but incorrect row is \((1,1)\), obtained by listing only the coefficients that visibly occur. That row has too few entries and does not preserve the stated variable order. If one instead treats it as coefficients of \(x,y\), it represents \(x+y=4\), not \(x+z=4\).
The correction is to insert the coefficient of the absent unknown \(y\): the row must be \((1,0,1)\). The corresponding equation is \(1x+0y+1z=4\), which is exactly \(x+z=4\). Check dimensions as well: with three ordered unknowns, each row of the coefficient matrix must have three entries, so \(\mathbf{A}\) has three columns and \(\mathbf{x}\) has three entries.
A second sign-related error is to place a term’s coefficient in the matrix before putting the equation in standard form. For instance, \(x+2=y+5\) becomes \(x-y=3\), not \(x-y=5\): subtracting \(y\) and \(2\) from both sides gives \(x-y=5-2=3\). With unknown order \(x,y\), the row is \((1,-1)\), and the corresponding right-hand-side entry is \(3\).
Check Your Understanding
For each system, state the unknown order you use, then write \(\mathbf{A}\), \(\mathbf{x}\), and \(\mathbf{b}\). Check the rows by expanding the matrix product.
- Encode \(x+2y=3\) and \(4x-z=-1\) using the order \(x,y,z\). Which coefficient is zero in each row?
- Write \(2x+1=y+4\) as a matrix equation with the unknown order \(x,y\). What is the right-hand-side entry after rearranging?
- For the equation \(0=5\) and the unknown order \(x,y\), what coefficient row and right-hand-side entry represent it?
- Explain why a system with \(m\) equations and \(n\) ordered unknowns produces an \(m\times n\) coefficient matrix.
- In one sentence, explain why an absent unknown must still have a zero entry in its column.