Systems of Equations in LaTeX

Two ways to group equations under one brace, when each is the right one, and how to line up the working underneath the system.

Two families of braces answer different questions: cases gives a brace and left-aligned rows, while a brace around aligned gives a brace and a shared alignment point. Choose by what has to line up, not by which one you learned first. The row syntax belongs to Align, and the matrix forms reuse the delimiters from Brackets.

Which one to use

Situation Write this Because
A brace, no alignment
cases
Fastest; each row starts at the left.
Aligned at the equals
\left\{\begin{aligned}
& goes before each equals sign.
Numbered as one equation
aligned
One number for the whole system.
Working shown underneath
aligned
Keep the same alignment point throughout.
An augmented matrix
\left[\begin{array}{cc|c}
Vertical rule between coefficient columns.
No solution at all
\text{no solution}
Words need \text.

The commands

What Type this Renders as
Brace with cases Fastest form. No ampersand needed if you only want a stack.
\begin{cases} 2x + y = 5 \\ x - 3y = 1 \end{cases}
\begin{cases} 2x + y = 5 \\ x - 3y = 1 \end{cases}
Explicit brace The trailing dot closes the brace without a mirror on the right.
\left\{ \begin{array}{l} 3x + 2y = 8 \\ x - y = 1 \end{array} \right.
\left\{ \begin{array}{l} 3x + 2y = 8 \\ x - y = 1 \end{array} \right.
Aligned at the equals The rcl column spec right-aligns the left-hand sides, so the signs form a rule.
\left\{ \begin{array}{rcl} 2x + y &=& 5 \\ x - 3y &=& 1 \end{array} \right.
\left\{ \begin{array}{rcl} 2x + y &=& 5 \\ x - 3y &=& 1 \end{array} \right.
Three unknowns Rows simply continue; nothing changes with size.
\begin{cases} x + y + z = 6 \\ 2x - y + z = 3 \\ x + 2y - z = 2 \end{cases}
\begin{cases} x + y + z = 6 \\ 2x - y + z = 3 \\ x + 2y - z = 2 \end{cases}
Solution written out Convention for presenting the answer of a two-variable system as an ordered pair.
(x, y) = (2, 1)
(x, y) = (2, 1)
Working under the system Elimination steps go in an aligned block, not inside the brace.
\begin{aligned} 2x + y &= 5 \\ -\,(2x - 2y) &= -2 \\ 3y &= 3 \end{aligned}
\begin{aligned} 2x + y &= 5 \\ -\,(2x - 2y) &= -2 \\ 3y &= 3 \end{aligned}
No-solution case Parallel lines: the system is stated, then labelled.
\begin{cases} x + y = 1 \\ x + y = 2 \end{cases} \quad \text{inconsistent}
\begin{cases} x + y = 1 \\ x + y = 2 \end{cases} \quad \text{inconsistent}
Dependent system Parametric solution set when the two equations describe one line.
\{(2t+1,\; t) : t \in \mathbb{R}\}
\{(2t+1,\; t) : t \in \mathbb{R}\}
Augmented matrix form The vertical rule from the column spec, which is how the coefficient side is split from the constants.
\left( \begin{array}{cc|c} 1 & 2 & 5 \\ 3 & 4 & 11 \end{array} \right)
\left( \begin{array}{cc|c} 1 & 2 & 5 \\ 3 & 4 & 11 \end{array} \right)

Worked examples

Substitution

\begin{aligned} y &= 2x - 1 \\ x + (2x-1) &= 8 \\ 3x &= 9 \\ x &= 3 \end{aligned}
\begin{aligned} y &= 2x - 1 \\ x + (2x-1) &= 8 \\ 3x &= 9 \\ x &= 3 \end{aligned}

Once one equation is rearranged, the system becomes a chain and moves into an aligned block.

Elimination with a brace

\left\{ \begin{array}{rcr} 2x + 3y &=& 12 \\ 2x - y &=& 4 \end{array} \right.
\left\{ \begin{array}{rcr} 2x + 3y &=& 12 \\ 2x - y &=& 4 \end{array} \right.

Matching coefficients in the first column is the whole point of aligning them.

Non-linear system

\begin{cases} x^2 + y^2 = 25 \\ y = x + 1 \end{cases}
\begin{cases} x^2 + y^2 = 25 \\ y = x + 1 \end{cases}

Circle and line; the cases form carries mixed degrees without any change in syntax.

System with inequalities

\begin{cases} x + y \le 4 \\ x \ge 0 \\ y \ge 0 \end{cases}
\begin{cases} x + y \le 4 \\ x \ge 0 \\ y \ge 0 \end{cases}

Linear programming constraints use the identical structure, which is why strict inequality symbols matter more than the grouping.

Common mistakes

  • Reaching for matrix to draw a system. A matrix has no relation signs and brackets, not a brace — the object you mean is a list of equations.
  • Using cases then wondering why the equals signs drift. Its rows are left-aligned; column alignment requires the array form.
  • Forgetting \right. after an array and getting an unmatched-delimiter error, or adding a mirrored brace on the right that reverses the reading.
  • Cramming the elimination working inside the same brace as the statement, which merges the problem and its solution into one undifferentiated stack.

Questions about this notation

How do I get a curly brace before a set of equations?
Either wrap them in \begin{cases} ... \end{cases}, which prints the brace automatically, or build \left\{ \begin{array}{l} ... \end{array} \right. yourself. The first is quicker; the second lets you align columns.
Should the system be numbered as one equation or several?
One. In a LaTeX document, put the system inside gather with a single number, or use aligned within an equation, so the reference points at the whole set rather than at one row of it.
How do I write three equations with two unknowns?
Exactly as any other system — the syntax does not care about counts. What changes is the wording of the answer: an overdetermined system is usually reported by its least-squares solution or marked inconsistent.
How do I align a system at the equals signs and still keep the brace?
Nest an aligned block inside cases: the brace comes from cases and the alignment from aligned, and the whole system gets one equation number. If you want the brace sized by hand instead, build it with \left\{ ... \right. — the closing \right. is a delimiter of zero height, which is what makes a one-sided brace possible.

Keep reading

Three ways into the same idea: the notation itself, the lesson that teaches it, and an article that applies it.