Numerical Methods for Engineers

Solving linear systems

Use this for “Solve 2x + y − z = 1, x + 3y + 2z = 13 and 3x − y + z = 4 by Gaussian elimination.”

Diagram

21−11132133−1143 row operations21−1105/25/225/200515
3 equations in 3 unknowns, the right-hand sides after the bar.
The solution: x = 1, y = 2, z = 3.
This is an example. Type your own values to start a new problem.
x
=
x
,
y
=
y
,
z
=
z

Formulas

z
=
c₃
u₃₃
,
row
3
of
the
triangle
from
[[
a₁₁
,
a₁₂
,
a₁₃
|
a₁₄
],
[
a₂₁
,
a₂₂
,
a₂₃
|
a₂₄
],
[
a₃₁
,
a₃₂
,
a₃₃
|
a₃₄
]]
3
=
c₃
u₃₃
,
row
3
of
the
triangle
from
[[2,
1,
−1
|
1],
[1,
3,
2
|
13],
[3,
−1,
1
|
4]]
y
=
c₂ − u₂₃ ×
z
u₂₂
,
row
2
of
the
triangle
from
[[
a₁₁
,
a₁₂
,
a₁₃
|
a₁₄
],
[
a₂₁
,
a₂₂
,
a₂₃
|
a₂₄
],
[
a₃₁
,
a₃₂
,
a₃₃
|
a₃₄
]]
2
=
c₂ − u₂₃ × 3
u₂₂
,
row
2
of
the
triangle
from
[[2,
1,
−1
|
1],
[1,
3,
2
|
13],
[3,
−1,
1
|
4]]
x
=
c₁ − u₁₂ ×
y
− u₁₃ ×
z
u₁₁
,
row
1
of
the
triangle
from
[[
a₁₁
,
a₁₂
,
a₁₃
|
a₁₄
],
[
a₂₁
,
a₂₂
,
a₂₃
|
a₂₄
],
[
a₃₁
,
a₃₂
,
a₃₃
|
a₃₄
]]
1
=
c₁ − u₁₂ × 2 − u₁₃ × 3
u₁₁
,
row
1
of
the
triangle
from
[[2,
1,
−1
|
1],
[1,
3,
2
|
13],
[3,
−1,
1
|
4]]

Assumptions

•
Forward elimination clears under each pivot; back substitution then solves from the last row up.
•
No row is scaled, and rows swap only when a pivot is 0 (partial pivoting would swap for the largest).
•
A row of A that ends all zeros means no single solution: none, or infinitely many.

Step-by-step

WE KNOW
a₁₁ = 2, a₁₂ = 1, a₁₃ = −1, a₁₄ = 1, a₂₁ = 1, a₂₂ = 3, a₂₃ = 2, a₂₄ = 13, a₃₁ = 3, a₃₂ = −1, a₃₃ = 1, a₃₄ = 4
FIND
unknown z (z), unknown y (y), unknown x (x)
Step 1 · Find unknown z (z)
Use z = c₃ ÷ u₃₃, row 3 of the triangle from [[a₁₁, a₁₂, a₁₃ | a₁₄], [a₂₁, a₂₂, a₂₃ | a₂₄], [a₃₁, a₃₂, a₃₃ | a₃₄]]
Clear
the
entries
under
each
pivot,
one
row
operation
a
line,
no
row
scaled.
The
last
row
then
holds
z
alone:
u₃₃
z
=
c₃.
z
=
c₃
u₃₃
Start: [[2, 1, −1 | 1], [1, 3, 2 | 13], [3, −1, 1 | 4]]
R₂
→
R₂
−
(
1
2
)R₁:
[[2,
1,
−1
|
1],
[0,
5
2
,
5
2
|
25
2
],
[3,
−1,
1
|
4]]
R₃
→
R₃
−
(
3
2
)R₁:
[[2,
1,
−1
|
1],
[0,
5
2
,
5
2
|
25
2
],
[0,
−
5
2
,
5
2
|
5
2
]]
R₃
→
R₃
+
R₂:
[[2,
1,
−1
|
1],
[0,
5
2
,
5
2
|
25
2
],
[0,
0,
5
|
15]]
z
=
15
5
z
=
3
Step 2 · Find unknown y (y)
Use y = (c₂ − u₂₃ × z) ÷ u₂₂, row 2 of the triangle from [[a₁₁, a₁₂, a₁₃ | a₁₄], [a₂₁, a₂₂, a₂₃ | a₂₄], [a₃₁, a₃₂, a₃₃ | a₃₄]]
Back
substitution:
row
2
of
the
triangle
reads
u₂₂
y
+
u₂₃
z
=
c₂.
Put
z
in,
move
its
term
across
and
divide
by
u₂₂.
y
=
(
25
2
) − (
5
2
) × 3
5
2
y
=
2
Step 3 · Find unknown x (x)
Use x = (c₁ − u₁₂ × y − u₁₃ × z) ÷ u₁₁, row 1 of the triangle from [[a₁₁, a₁₂, a₁₃ | a₁₄], [a₂₁, a₂₂, a₂₃ | a₂₄], [a₃₁, a₃₂, a₃₃ | a₃₄]]
Row
1
of
the
triangle
reads
u₁₁
x
+
u₁₂
y
+
u₁₃
z
=
c₁.
Put
y
and
z
in
and
divide
by
u₁₁.
x
=
1 − 1 × 2 − (−1) × 3
2
x
=
1
Check
Put the numbers back in. Both sides should match.
Row 3 of the triangle: 5 × 3 = 15 ✓
Row
2
of
the
triangle:
(
5
2
)
×
2
+
(
5
2
)
×
3
=
(
25
2
)
✓
Row 1 of the triangle: 2 × 1 + 1 × 2 + (−1) × 3 = 1 ✓
Topic check
See what you know: 5 questions on this topic
New questions each time. Pass to mark it complete.

More problem types

© 2026 SME. All rights reserved.