Why matrix notation makes sense

Published: 12/26/2023
Updated: 3/29/2025

I learned to work and calculate with matrices long ago, but curiously I only recently understood why the common notation for their entries makes sense. This might be embarrassing, but I will share it nevertheless. The insight came from programming.

Let me briefly recall what a matrix is. An mm by nn matrix is a rectangular grid of numbers with mm rows and nn columns. Here is an example for m=2m = 2 and n=3n = 3.

(2300−19)\begin{pmatrix} 2 & 3 & 0 \\ 0 & -1 & 9 \end{pmatrix}

In mathematics, you denote the matrix entry in row ii and column jj by aija_{ij} (when the matrix is called AA, when it is called UU you write uiju_{ij} etc.). So in the example above, we therefore have a12=3a_{12}=3 and a22=−1a_{22} = -1, for example. A general matrix is then written as (aij)1≤i≤m, 1≤j≤n(a_{ij})_{1 \leq i \leq m,~ 1 \leq j \leq n}

When I first learned this, it seemed a bit strange to me. I was so used to the cartesian coordinate system that, for me, the xx-coordinate should come first, then the yy-coordinate. And obviously, the column should be the xx-coordinate and hence go first, and after that comes the row which is the yy-coordinate. (Let's ignore for the moment that in a usual cartesian coordinate system the yy-values grow when you go up, in a matrix it's versa.) Wouldn't it then make more sense to write a21=3a_{21} = 3?

As with any notation, after some time you just get used to it. I never really had any problems with distinguishing a point on a coordinate system and the location of a matrix entry.

However, the notation makes a lot of sense when you use matrices in programming. To be precise, when you model matrices as 2-dimensional arrays, that is, arrays whose entries are arrays.

How would you model the matrix written above, as a 2-dimensional array? The only reasonable answer is

[
	[2, 3, 0],
	[0, -1, 9]
]

The matrix is an array of rows, and each row is an array. Accordingly, when you want to access the 3 here, you write a[0][1]. First comes the row index 0 and only then the column index 1. Since mathematicians tend to start their indices with 1, they write a12a_{12} instead of a01a_{01}, but in principle, it's the same. First row, then column.

Of course, you could also do it the other way, but then when you print out the 2-dimensional array, it won't look like the usual visual representation of the matrix. You will see the transposed matrix.

There is just one scenario where it still confuses me a bit. Namely when we parse an image to a matrix of pixel values (or vice versa, when a matrix is rendered to an image). Here it would be sort of nice to have the points on the coordinate system match up with the coordinates in the matrix, but they are transposed. When I have a pixel value with matrix coordinate (100,100) and I go 100 pixels to the right on the image, the result is (100,200), not (200,100).