Matrices are ordered tables of numbers. To work with these mathematical structures effectively, a standard method is needed to describe their size and refer to their individual components. This involves understanding matrix dimensions and element notation.
The size, or dimensions, of a matrix are defined by the number of rows and the number of columns it contains. We typically say a matrix with rows and columns is an matrix (read as "m by n"). The number of rows always comes first.
For example, consider this matrix :
Matrix has 2 rows and 3 columns, so it is a matrix.
It's important to remember this order: rows first, then columns. A matrix would look different, having 3 rows and 2 columns:
Here, is a matrix.
Matrices and have different dimensions. is , while is .
We often need to refer to a specific number, or element, within a matrix. We do this using indices, typically represented by subscripts. If we have a matrix , the element in the -th row and -th column is denoted as or . Again, the row index () comes first, followed by the column index ().
Let's use matrix from before:
Here's how we refer to its elements:
Notation specifies the element at row and column .
In mathematics and textbooks, indices usually start from 1 (1-based indexing). So, the top-left element is . However, in many programming languages, including Python and its library NumPy, indexing starts from 0 (0-based indexing).
A[i, j], where i starts at 0 and j starts at 0.So, the mathematical element corresponds to A[0, 0] in NumPy. Similarly, corresponds to A[1, 2]. We will primarily use the mathematical notation () when discussing concepts, but it's essential to remember the 0-based indexing when we start implementing these ideas in Python with NumPy in the hands-on sections.
Understanding these conventions allows us to precisely communicate about matrices and their components, which is fundamental as we move towards performing operations with them. When we work with NumPy, we'll see how its array structures directly map to these mathematical concepts, using 0-based indexing for practical access.
Was this section helpful?
© 2026 ApX Machine LearningAI Ethics & Transparency•