Matrix math

Many financial problems can be concisely expressed as matrices (this is the proper plural form of matrix). What is a matrix? Basically, it’s just a rectangular set of numbers. We classify matrices based on the number of rows and columns. A matrix with 3 rows and 2 columns, for example, is called a 3 × 2 matrix. Is example is shown below.

It is common to refer to a matrix with a capital letter. For example, let us call the matrix above A. Then the individual elements (numbers in the matrix) are referred to with lowercase letters (usually italicized). The element in row i and column j is referred to as aij. For example, the number "6" is in the 3rd row and the 2nd column, so we say that a32 = 6. You may see this written as a[3][2] or a[3,2] if you read text about matrices in plain text format, because subscripts are not supported.

Matrices with the same dimensions can be added simply by adding elements that are in the same positions. An example is given below.

Similarly, matrix subtraction is a simple process. Simply subtract numbers that are in the same positions.

Scalar multiplication is also rather simple with matrices. A scalar is just a normal number, like "5" or "-2.4." To multiply a matrix by a scalar, simply multiply each element of the matrix by that scalar.

The zero matrix is a matrix composed of all zeroes. There is one zero matrix for each size of a matrix (for example, there is a 3 × 4 zero matrix, a 5 × 5 zero matrix, etc.).

(The more mathematically inclined readers may note that the above definitions show that the set of all m × n matrices is a vector space.)

A square matrix is a matrix that has the same number of rows and columns. The matrix in the first example above is not a square matrix; the matrices in the second equation are square.

At this point you may be saying, "that’s all very nice, but what good is it?" The answer is that matrices can be very useful, but first you need to know more about matrix multiplication, systems of equations, and row operations. Matrix multiplication is not as simple and intuitive as matrix addition. (For example, you can multiply matrices that are not the same size!) We’ll cover it in the next section. Eventually we’ll cover enough that you’ll be able to learn about the simplex method, a powerful optimization method that can solve problems with many variables.

One last note: matrices are always two-dimensional. There is no "three-dimensional matrix," although the closely related tensors can have multiple dimensions; they are used by physicists, not by economists, so we won’t cover them.