One of the most important concepts in mathematics is the concept of matrices. A matrix is a two-dimensional array of numbers. The dimensions of a matrix is an ordered pair (m, n) of positive integers, where m is the number of rows and n the number of columns of the matrix. We say a matrix of dimensions (m, n) is an m×n (read as "m by n") matrix. Matrices are usually indicated with capital letters, usually starting with the beginning of the alphabet. The most general m×n matrix A has the following form:
where the matrix entries Aij = aij are arbitrary real numbers. If m=n, A is called a square matrix.
Like ordinary numbers, matrices may be added, subtracted, or multiplied. (Matrix division is not well-defined in general, however.) Adding and subtracting matrices is easy. One merely adds or subtracts the corresponding matrix entries. Thus, for instance, if A and B are both m×n matrices of the form above, then we have
- (8.1.1) (A + B)ij = Aij + Bij.
Matrix subtraction is defined similarly, i.e. we have
- (8.1.2) (A - B)ij = Aij - Bij.
Note that by these definitions, only matrices of the same dimensions may be added or subtracted.
Like vectors, matrices may also be multiplied by scalars. For a matrix A and scalar k, the matrix kA is defined by
- (8.1.3) (kA)ij = kAij.
In other words, when we multiply a matrix by k, we multiply all its entries by k.
Matrix multiplication is the most complicated arithmetic operation on matrices. Unlike matrix addition and subtraction, matrix multiplication is not performed entry by entry. Instead, matrix multiplication is defined in the following way. If A is an m×n matrix and B is an n×p matrix, then the matrix product AB is an m×p matrix whose ik-th entry is given by
- (8.1.4) (AB)ik = Ai1B1k + Ai2B2k + ... + AinBnk.
It should be noted that matrix multiplication is not in general commutative, i.e. in general, AB ≠ BA. Also, AB is undefined unless the number of columns of A is equal to the number of rows of B.
The transpose AT of a matrix A is the matrix obtained from A by switching around the rows and columns. In other words, we have
- (8.1.5) (AT)ij = Aji .
A matrix which is equal to its transpose is said to be symmetric. Symmetric matrices are necessarily square.
Example 1: Wherever they are defined, for the following pair of matrices A and B, compute AT, 2A, A + B, A - B, AB, and BA.
- (a) ,
- (b) ,
- (c) ,
- (a) We have ,,, . The matrix products AB and BA are undefined since the dimensions of A and B are incompatible for matrix multiplication.
- (b) We have , , , . We compute each entry of the matrix product C = AB as explained above. Thus, we have
C11 = A11B11 + A12B21 = (1)(5) + (2)(7) = 5 + 14 = 19
C12 = A11B12 + A12B22 = (1)(6) + (2)(8) = 6 + 16 = 22
C21 = A21B11 + A22B21 = (3)(5) + (4)(7) = 15 + 28 = 43
C22 = A21B12 + A22B22 = (3)(6) + (4)(8) = 18 + 32 = 50
- Thus we find that . In the same way we find .
- (c) We have , . The matrix sum A + B and matrix difference A - B are undefined since A and B have different dimensions. Using (8.1.4), we find , .