### 5.54.2 Gauss reduction of a matrix : ref

ref is used to solve a linear system of equations written in matrix form:

A*X=B

The argument of ref is the augmented matrix of the system (the matrix obtained by augmenting the matrix A to the right with the column vector B).
The result is a matrix [A1,B1] where A1 has zeros under its principal diagonal, and the solutions of:

A1*X=B1

are the same as the solutions of:

A*X=B

For example, solve the system :

⎧ ⎨ ⎩ |
3x + y | = | −2
3x +2y | = | 2

Input :

ref([[3,1,-2],[3,2,2]])

Output :

[[1,1/3,-2/3],[0,1,4]]

Hence the solution is y=4 (last row) and x=−2 (substitute y in the first row).