Matrices
Definition of a matrix
A matrix is a two-dimensional array. The dimensions of a matrix are given by its number of rows n and columns m. We designate a matrix by a bold letter. The matrix A is A. The dimensions of a are n x m (n by m). The elements of a are aij. The index i is the row index and the index j is the column index. We represent A as:

Special cases
A square matrix has n = m.
A diagonal matrix D has values only along the diagonal d11, d22, d33, etc. and zero elsewhere.

The unit matrix or identity matrix I has ones along the diagonal.

A column vector is a matrix of dimension n x 1.

A row vector is a matrix of dimension 1 x n.
Matrix addition and subtraction
Two matrices can be added or subtracted only if they have the same dimesions. The result of adding matrices A and B is obtained by adding their corresponding elements. A + B = C is obtained by adding aij + bij = cij for all i and j.

Matrix multiplication
In order to multiply two matrices AB = C the number of columns in the A matrix must be the same as the number of rows in the B matrix. If A is a k x l matrix and B is a l x m matrix, then C has dimensions k x m. The prescription for matrix multiplication is:
![]()
The first row elements of the A matrix are multiplied by the first column elements of the B matrix to give the first element of the C matrix.

Note that the above equation indicates the sum of the products of the elements
c11 = a11b11 + a12b21 + a13b31 + … until the row and column are finished.The c21 element is obtained in a similar fashion:

This process is continued until all of the elements of the C matrix have been obtained.
The order of operation is important. This can be simply illustrated with the following important example.
The product of a row matrix and a column matrix is a scalar.

The product of a n x 1 column matrix and a 1 x n row matrix is a n x n matrix.

Matrix Transpose
The transpose of a matrix is obtained by interchanging the rows and columns of a matrix.

Matrix Inverse
The inverse of a matrix is defined such that AA-1 = A-1 A = I where I is the identity matrix.
The determinant of a matrix
The determinant of a matrix is a number obtained by summing n! products of a n x n matrix. This is best illustrated by starting with a 2 x 2 matrix. The determinant of a 2 x 2 matrix is:
![]()
For larger dimension matrices, the determinant can be obtained by reduction to lower-order determinants (minors). This is illustrated for a 3 x 3 matrix.

The 2 x 2 determinant is obtained as above for each of the minors.
The determinant of A is obtained by summing across any row as follows:
![]()
Matrix solution of linear equations
Matrices are important tools for the solution of linear equations. The general form of a set of simultaneous linear equations is
Ax = b. This illustrated below:

Here the xi are the unknowns and aij are the linear coefficients. To find the ith coefficient xi we replace that column of the A matrix by the b vector.

The unknown is given by the ratio of the determinants,
