Discord

INAIO Guide Stage 1 11Matrices and Linear Transformations

11.1 Matrix dimensions and indexing

Read a matrix as a rectangular grid with a defined shape, row-column indexing, and a clear meaning for each entry.

Matrices keep related numbers in a rectangular layout. A matrix can store image pixels, tabular measurements, graph connections, or coefficients of equations. The shape and indexing tell you what each number means before you calculate with it. In Module 2.2, we wrote several equations separately; a matrix can gather all their coefficients into one object. In Module 10.3, a vector gathered several coordinates in the same way.

This is foundational linear algebra. Start with the first part of OpenStax's matrix lesson. You only need to be comfortable reading tables.

A basic idea: rows, columns, entries

A matrix with mm rows and nn columns has shape m×nm\times n. The entry aija_{ij} is in row ii, column jj in the mathematical convention used here, starting at 11. For example,

A=[258147]A=\begin{bmatrix}2&5&8\\1&4&7\end{bmatrix}

has shape 2×32\times3, with a12=5a_{12}=5 and a23=7a_{23}=7.

A two-row, three-column matrix shows row and column labels; the entry in row two, column three is highlighted.A two-row, three-column matrix shows row and column labels; the entry in row two, column three is highlighted.
Read the row number before the column number.

A quick tour of properties

A single row is a 1×n1\times n row matrix; a single column is an m×1m\times1 column matrix. A square matrix has the same number of rows and columns. The main diagonal of a square matrix runs from the top left to the bottom right. A matrix's shape is more than a label: later, it tells us whether an operation can pair the entries we need. A computer language may start indexing at 00, so check its convention before translating a problem into code. In Python with NumPy, a23a_{23} above is A[1, 2].

Application 1: image pixels

A greyscale image patch has pixel intensities

P=[102030405060].P=\begin{bmatrix}10&20&30\\40&50&60\end{bmatrix}.

It has two pixel rows and three columns. Pixel p21=40p_{21}=40 is at the second row, first column. A pixel value is not a coordinate: it is the measurement stored at that position.

Application 2: scores by learner and test

Rows of S=[865977]S=\begin{bmatrix}8&6\\5&9\\7&7\end{bmatrix} represent three learners; columns represent two tests. Thus SS has shape 3×23\times2, and s32=7s_{32}=7 is learner three's score on test two. Column two is (6,9,7)(6,9,7), which lets you compare all learners on the same test.

Resources

SourceTitleWhy read it
OpenStaxMatrices and matrix operationsBegin with matrix dimensions and entry notation.

Finished this module? Mark it done.

Comments

Stuck on something, spotted a mistake, or found a resource that helped you? Tell us below.

Loading comments