# Arithmetic Operators 2

• Matrix addition, `A + B`, subtraction, `A - B` and multiplication, `A * B` apply as follows:

NB: according to matrix algebra, the order in which the matrices are placed during multiplication does matter i.e. it is expected that `A*B` would usually yield different results from `B*A`.

• Matrix division is carried out using the `/` or `\` where `B/A` is equivalent to carrying out `B * inv(A)`. `A\B` on the other hand is the same as `inv(A) * B`; this arrangement is especially useful when seeking to find the solution X to the equation AX = B (as in solving using Gaussian elimination). This would be further demonstrated in the exercise section.

EXERCISE 4

Using matrices A and B calculate;

(a)  `F =A*B` (b)  `G = B*A`   (c)  `H = F – G`    (d)  `J = B’*A’`   (e)  `K = F - J`

MISCELLANEOUS EXERCISE

Using MATLAB solve the following system of simultaneous equations:

3x + 2y – z = 10

-x + 3y + 2z = 5

x – y – z = -1

Hint: AX = B.

Solve this question using both the `\` operator and inverse methods (see above). Is there any difference between both methods? Why is the inverse method not `B*inv(A)`?