Tutorials › Linear Algebra › Choosing Variables and Fixing Their Order

Linear Systems and Solution Sets · Tutorial 2 of 1000

Choosing Variables and Fixing Their Order

Choose clear variable names, record their order, and keep that same order when reading equations, matrices, and solution tuples.

Beginner 8 min read

What You'll Learn

  • Define variables as named unknown quantities and state what each represents.
  • Record a fixed order for the variables before writing a solution tuple.
  • Match each equation’s coefficients to the declared variable order.
  • Read a coefficient matrix and solution tuple using the same ordering.
  • Reorder matrix columns and tuple entries together when changing variable order.

Variables Need Names and an Order

When an unknown-quantity problem has several variables, it is not enough to know which quantities are unknown. We also need to know exactly which symbol represents each quantity and, when writing a tuple or matrix, which variable comes first. A consistent choice prevents a correct set of equations from being paired with the wrong coefficients or the wrong candidate solution.

Throughout this tutorial, scalars and unknowns are real numbers. A variable declaration says what each variable represents; for example, “let \(x\) be the number of adult tickets.” An ordered variable list records the variables in a fixed sequence, such as \((x,y)\) or \((u,v,w)\). That sequence is the reference order for the equations, coefficient matrix, and solution tuple. A solution tuple is not an unordered collection: its first entry belongs to the first variable, its second entry belongs to the second, and so on.

Convention: Before recording a system as a matrix or writing a solution tuple, declare the variables and their order. If the order is \((x_1,\dots,x_n)\), then the tuple \((c_1,\dots,c_n)\) means \(x_1=c_1,\dots,x_n=c_n\), and the coefficient in each matrix column must belong to the corresponding variable in that same order.

The variables themselves have labels, such as \(x\) and \(y\), while their positions in an ordered list determine how to interpret a compact representation. Writing \((x,y)\) first and later using \((y,x)\) is allowed, but it is a change of order. The coefficient columns and tuple entries must change with it. Merely changing the order in one place changes the meaning of the written data.

Reading Equations Against a Declared Order

For a short system, a coefficient matrix records the coefficient of each variable in each equation. If the declared order is \((x,y)\), the first column contains the coefficients of \(x\), and the second contains those of \(y\). A right-hand-side column records the constants in the same equation order. In the expression \(\mathbf{A}\mathbf{x}=\mathbf{b}\), the vector \(\mathbf{x}\) is written in the declared variable order.

The equations below are already supplied as algebraic constraints. The task in each example is to organize their variables and coefficients correctly, then interpret and check a stated assignment. The emphasis is on bookkeeping rather than deriving equations from a verbal description or solving a system by a particular method.

Worked Example: Two Unknown Quantities in a Declared Order

Let \(x\) be the number of adult tickets and \(y\) the number of child tickets. Use the declared order \((x,y)\) for the supplied equations \(2x+3y=12\) and \(x-y=1\). Record the coefficient matrix and right-hand side, then check the candidate tuple \((3,2)\).

The first equation has coefficient \(2\) on \(x\) and \(3\) on \(y\); the second has coefficient \(1\) on \(x\) and \(-1\) on \(y\). In the order \((x,y)\), these give

$$ \mathbf{A}= \begin{bmatrix} 2&3\\ 1&-1 \end{bmatrix}, \qquad \mathbf{b}= \begin{bmatrix} 12\\ 1 \end{bmatrix}, \qquad \mathbf{x}= \begin{bmatrix} 3\\ 2 \end{bmatrix}. $$

Multiplying the matrix by the tuple’s column vector gives

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

Thus the tuple means \(x=3\), \(y=2\), and it satisfies both supplied equations. Reading the same tuple as \(x=2\), \(y=3\) would be a different assignment.

Worked Example: The Equations Need Not List Variables in Order

Let \(u\) be the number of adult tickets and \(c\) the number of child tickets, and declare the order \((u,c)\). The supplied equations are \(2c+4u=20\) and \(c-u=1\). Although the first equation writes the \(c\)-term first, the declared order still puts \(u\) first. Record the coefficients and check \((3,4)\).

Rewrite each equation only as needed to read off coefficients in the order \((u,c)\). The first is \(4u+2c=20\), giving the row \((4,2)\). The second is \(-u+c=1\), giving \((-1,1)\). Therefore

$$ \mathbf{A}= \begin{bmatrix} 4&2\\ -1&1 \end{bmatrix}, \qquad \mathbf{b}= \begin{bmatrix} 20\\ 1 \end{bmatrix}, \qquad \mathbf{x}= \begin{bmatrix} 3\\ 4 \end{bmatrix}. $$

Check by multiplication, showing each row calculation:

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

The candidate is valid in the order \((u,c)\): it assigns \(u=3\) and \(c=4\). The order comes from the declaration, not from which variable happens to appear first in a written equation.

Why the Order Rule Works

We can state the bookkeeping rule precisely. Suppose the declared order is \((x_1,\dots,x_n)\). In equation \(i\), let \(a_{ij}\) be the coefficient of \(x_j\), and let \(b_i\) be its right-hand side. The coefficient matrix has entry \(a_{ij}\) in row \(i\), column \(j\), and the right-hand side vector has entry \(b_i\) in position \(i\). The \(j\)th entry of the tuple vector is the proposed value of \(x_j\).

Theorem (Consistent coordinate recording): For a finite list of real variables \(x_1,\dots,x_n\) and equations \(\sum_{j=1}^{n} a_{ij}x_j=b_i\), \(i=1,\dots,m\), define \(\mathbf{A}=(a_{ij})\), \(\mathbf{b}=(b_1,\dots,b_m)^{\top}\), and \(\mathbf{c}=(c_1,\dots,c_n)^{\top}\) using the variable order \((x_1,\dots,x_n)\). The assignment \(x_j=c_j\) for every \(j\) satisfies every equation if and only if \(\mathbf{A}\mathbf{c}=\mathbf{b}\).

Proof. Assume first that the assignment \(x_j=c_j\) satisfies every equation. For each \(i\), satisfaction means \(\sum_{j=1}^{n} a_{ij}c_j=b_i\). By the definition of matrix multiplication, the \(i\)th entry of \(\mathbf{A}\mathbf{c}\) is exactly \(\sum_{j=1}^{n}a_{ij}c_j\), so it equals \(b_i\). This holds for every row \(i\), hence \(\mathbf{A}\mathbf{c}=\mathbf{b}\). Conversely, assume \(\mathbf{A}\mathbf{c}=\mathbf{b}\). Equality of these column vectors means their \(i\)th entries agree for each \(i\). The \(i\)th entry of \(\mathbf{A}\mathbf{c}\) is \(\sum_{j=1}^{n}a_{ij}c_j\), so \(\sum_{j=1}^{n}a_{ij}c_j=b_i\) for every \(i\). These are precisely the equations evaluated at \(x_j=c_j\); therefore the assignment satisfies every equation. \(\square\)

This result explains why the same order is required in all three places. The \(j\)th matrix column and the \(j\)th tuple entry are paired in every row product. If the entry in position \(j\) is instead interpreted as the value of a different variable, the row products no longer evaluate the intended equations.

Changing the Order Correctly

There is no uniquely correct order for a set of variables. A convenient order may follow the problem’s labels, the order in which variables were declared, or another consistent choice. What matters is that a change of order is made everywhere. The following result describes exactly what must move.

Proposition: Suppose the variables are \(x_1,\dots,x_n\) in one order, with coefficient matrix entries \(a_{ij}\), right-hand side entries \(b_i\), and solution tuple entries \(c_j\). Let \(\pi\) be a rearrangement of the indices \(1,\dots,n\). In the new variable order \((x_{\pi(1)},\dots,x_{\pi(n)})\), put coefficient \(a_{i,\pi(k)}\) in column \(k\) and tuple entry \(c_{\pi(k)}\) in position \(k\). The equation represented by each row, and whether the assignment satisfies it, remain unchanged.

Proof. Fix any equation row \(i\). In the original order, substituting the assignment gives the left-hand side \(\sum_{j=1}^{n}a_{ij}c_j\). In the new order, column \(k\) has coefficient \(a_{i,\pi(k)}\), and the tuple entry in position \(k\) is \(c_{\pi(k)}\). Its left-hand side is therefore \(\sum_{k=1}^{n}a_{i,\pi(k)}c_{\pi(k)}\). Because \(\pi\) lists every index from \(1\) to \(n\) exactly once, this sum contains exactly the same coefficient-value products as the original sum, only in a different order. Thus the two left-hand sides are equal. The right-hand side \(b_i\) is unchanged, so the row equation is satisfied in the new representation exactly when it is satisfied in the original. Since this holds for every row \(i\), the full system and assignment are represented consistently after the rearrangement. \(\square\)

Worked Example: Reordering Both Columns and Tuple Entries

Use the ticket equations and original order \((u,c)\) from the previous example. Now choose the order \((c,u)\). The coefficient of \(c\) becomes the first entry of each row, and the coefficient of \(u\) becomes the second. The candidate tuple must likewise be read as \((c,u)=(4,3)\).

The new coefficient matrix and tuple are

$$ \mathbf{A}_{\mathrm{new}}= \begin{bmatrix} 2&4\\ 1&-1 \end{bmatrix}, \qquad \mathbf{x}_{\mathrm{new}}= \begin{bmatrix} 4\\ 3 \end{bmatrix}. $$

Multiplication verifies the unchanged right-hand side:

$$ \mathbf{A}_{\mathrm{new}}\mathbf{x}_{\mathrm{new}} = \begin{bmatrix} 2(4)+4(3)\\ 1(4)-1(3) \end{bmatrix} = \begin{bmatrix} 8+12\\ 4-3 \end{bmatrix} = \begin{bmatrix} 20\\ 1 \end{bmatrix}. $$

The equations and assignment are unchanged; only their coordinate order has changed. The coefficient columns and tuple entries were both rearranged, as required.

Three Variables: Keep the Same Order in Every Row

With more variables, it is especially useful to write the order above the equations or immediately before the matrix. This makes it easier to compare a row with its coefficients and to interpret a tuple without guessing which entry belongs to which quantity.

Worked Example: A Three-Variable Assignment

Let \(x\), \(y\), and \(z\) denote three unknown quantities, and declare the order \((x,y,z)\). The supplied equations are \(2x+y+z=7\), \(x+3y+2z=13\), and \(3x+y+2z=11\). Record the matrix and check the candidate tuple \((1,2,3)\).

Reading each row in the order \((x,y,z)\) gives coefficient rows \((2,1,1)\), \((1,3,2)\), and \((3,1,2)\). The tuple column and right-hand side are therefore

$$ \mathbf{A}= \begin{bmatrix} 2&1&1\\ 1&3&2\\ 3&1&2 \end{bmatrix}, \qquad \mathbf{x}= \begin{bmatrix} 1\\ 2\\ 3 \end{bmatrix}, \qquad \mathbf{b}= \begin{bmatrix} 7\\ 13\\ 11 \end{bmatrix}. $$

Compute all three row products:

$$ \mathbf{A}\mathbf{x} = \begin{bmatrix} 2(1)+1(2)+1(3)\\ 1(1)+3(2)+2(3)\\ 3(1)+1(2)+2(3) \end{bmatrix} = \begin{bmatrix} 2+2+3\\ 1+6+6\\ 3+2+6 \end{bmatrix} = \begin{bmatrix} 7\\ 13\\ 11 \end{bmatrix} =\mathbf{b}. $$

Thus the candidate assignment \(x=1\), \(y=2\), \(z=3\) satisfies the three equations. The check also shows why writing down the declared order is useful: every coefficient and value is matched by its position.

Common Mistake: Changing Only the Tuple

A common error is to reverse the tuple when changing variable order but leave the coefficient matrix unchanged. For the ticket example, in order \((u,c)\) the matrix is \(\begin{bmatrix}4&2\\-1&1\end{bmatrix}\), and the tuple is \((3,4)\). If we write the reversed tuple \((4,3)\) but incorrectly retain that old matrix, the product is

$$ \begin{bmatrix} 4&2\\ -1&1 \end{bmatrix} \begin{bmatrix} 4\\ 3 \end{bmatrix} = \begin{bmatrix} 4(4)+2(3)\\ -1(4)+1(3) \end{bmatrix} = \begin{bmatrix} 22\\ -1 \end{bmatrix}, $$

which is not the right-hand side \(\begin{bmatrix}20\\1\end{bmatrix}\). This does not show that the original assignment failed; it shows that the tuple and matrix now use incompatible orders. To represent \((c,u)=(4,3)\), the columns must be reversed too, giving \(\begin{bmatrix}2&4\\1&-1\end{bmatrix}\), whose product with \(\begin{bmatrix}4\\3\end{bmatrix}\) is \(\begin{bmatrix}20\\1\end{bmatrix}\).

Before accepting a matrix-and-tuple representation, check these practical points:

  • Each variable has a stated meaning.
  • A single variable order is explicitly recorded.
  • Each coefficient row follows that order, even when an equation writes its terms in another order.
  • Each tuple entry is interpreted using the same order.
  • If the order changes, the coefficient columns and tuple entries change together.

These checks are about representation, not about whether a system has one solution, many solutions, or none. They ensure that the equations, matrix, and tuple are referring to the same unknown quantities before any later analysis begins.

Check Your Understanding

In each question, make the variable order explicit and explain how it controls the representation.

  1. For variables \(p\) and \(q\) in the order \((p,q)\), what coefficient row represents \(5q-2p=8\)?
  2. If the order is \((r,s,t)\), which variable does the second entry of the tuple \((4,1,-2)\) assign a value to?
  3. For the equations \(a+2b=6\) and \(3a-b=5\), write the coefficient matrix and right-hand side in the order \((a,b)\).
  4. The order \((x,y)\) changes to \((y,x)\). What must happen to the matrix columns and tuple entries?
  5. Explain why reversing only a tuple, while keeping its original coefficient matrix, may give a different matrix product.

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