(Khan Academy)
A matrix to represent a linear system, with each row representing one linear equation.
Solved by row operations
Example
The goal is to have coefficient 1s for one variable only on one row
- Minus row 2 from row 3 (
) , row 1 from row 2 ( )
- Minus row 3 from row 1 to obtain
( ), and minus row 3 from row 2 to obtain ( ) =
=\begin{pmatrix} 1 & 0 & 0 &|& 5 \ 0 & 0 & 1 &|& -1 \ 0 & 1 & 0 &|& -1 \tag{3} \end{pmatrix}
\begin{cases} x=5 \ z=-1 \ y=-1 \end{cases}$$
is the solution of the linear system. See another way to solve here
Sage
#create an augmented matrix
M = matrix(QQ, [[1,1,1]], [1,2,3], [1,3,4])
v = vector(QQ, [3, 0, -2])
A = M.augment(v, subdivide = True)