# System of three equations in three unknowns
#
# 3x_1 + x_2 + x_3 = 6
# x_1 - x_2 + 2x_3 = 4
# -x_1 + x_2 + x_3 = 2
# Augmented matrix M=(A|b)
M <- matrix(c(3,1,-1,1,-1,1,1,2,1,6,4,2),ncol=4)
# Solution via Gauss elimination
x <- gauss_elim(M)
print(x)
Run the code above in your browser using DataLab