Exercise C33

Find all solutions to the linear system: x + y − z = −1 x − y − z = −1 z = 2

Since the third equation directly gives z=2, we can substitute this value into the first two equations, simplifying the system.

# Coefficients matrix
A <- matrix(c(1, 1, -1,
              1, -1, -1,
              0, 0, 1), nrow = 3, byrow = TRUE)

# Constants vector
b <- c(-1, -1, 2)

# Solve the system
solution <- solve(A, b)

# Print the solution
print(solution)
## [1] 1 0 2