—————————————————————————

Student Name : Sachid Deshmukh

—————————————————————————

C33 Find all solutions to the linear system:

  • x + y - z = -1
  • x - y - z = -1
  • z = 2

Substitute z = 2 in equation 1 and 2. We can re-write those equations as

  • x + y = 1
  • x - y = 1

We can re-write equation 2 as

  • y = x - 1

Let’s substitute this value in equation 1

x + (x-1) = 1

2x = 2

x = 1

We know that y = x-1

so we can conclude that y = 0

With this we get following values of x, y and z

x = 1 y = 0 z = 2

Using R to solve the porblem

equation = matrix(c(1, 1, 0, 1, -1, 0, -1, -1, 1), nrow=3, ncol=3)
result = matrix(c(-1, -1, 2), nrow=3, ncol=1)
coef = solve(equation, result)
print(paste("x =", coef[1], "y =", coef[2], "z =", coef[3]))
## [1] "x = 1 y = 0 z = 2"