3 Addition and subtraction of matrices

Under what circumstances can we add two matrices i.e. define A + B for given matrices A , B ?

Consider

A = 1 2 3 4 and B = 5 6 9 7 8 10

There is no sensible way to define A + B in this case since A and B are different sizes.

However, if we consider matrices of the same size then addition can be defined in a very natural way. Consider A = 1 2 3 4 and B = 5 6 7 8 . The ‘natural’ way to add A and B is to add corresponding elements together:

A + B = 1 + 5 2 + 6 3 + 7 4 + 8 = 6 8 10 12

In general if A and B are both m × n matrices, with elements a i j and b i j respectively, then their sum is a matrix C , also m × n , such that the elements of C are

c i j = a i j + b i j i = 1 , 2 , , m j = 1 , 2 , , n

In the above example

c 11 = a 11 + b 11 = 1 + 5 = 6 c 21 = a 21 + b 21 = 3 + 7 = 10 and so on.

Subtraction of matrices follows along similar lines:

D = A B = 1 5 2 6 3 7 4 8 = 4 4 4 4