Home page for accesible maths LAB100

Style control - access keys in brackets

Font (2 3) - + Letter spacing (4 5) - + Word spacing (6 7) - + Line spacing (8 9) - +

1 Simultaneous Equations

Consider the following system of linear equations:

x-5y+2z=0-3x+y+3z=-82x+2y-4z=4

Recall from MATH105 that this system can be represented by the augmented matrix:

[1-520-113-822-44].

The square matrix on the left-hand-side is equal to matrix A from the introduction to this workshop and the right-hand-side vector is created in RStudio by:

b <- c(0, -8, 4)

One method that calculates the solution to this system of linear equations is to pre-multiply this vector by the inverse of matrix A. We can find the inverse by using the function solve introduced in last week’s workshop.

Ainv <- solve(A)

Ainv %*% b

Alternatively, we can use the solve command by supplying two arguments; the first being the square matrix and the second being the vector:

solve( A, b )