Defining matrices
A matrix is an array of numbers. It is defined by the number of rows and columns that define its size. For example, this is a matrix with three rows and two columns:
Each value in the matrix is associated with its location. The value of 3 in the preceding matrix is located in row 0, column 0. More formally, we write the following:
The values specified in the square brackets are in the order [row, column], like so:
Here, the value in row 2, column 1 is 1, and the value in row 1, column 0 is 4.
In pure theoretical mathematics, the row and column values start at 1. We are starting our count at 0 because, in programming, when storing arrays and matrices, the index values start at 0.
Now, let’s take a look at the mathematical operations that can be achieved with two matrices.