1.4 - Matrices
(Two-Dimensional Arrays)

Have you heard of The Matrix ?  If you haven't watched it, you should.


Two-dimensional arrays of data are also known as a matrix. They can be written in several ways but most people think of them like a typical x-y plane of rows and columns.

Games, grids, and data science use matrices to control, manipulate, and calculate large amounts of data. Whenever you see a shape drawn on a computer, there is a good chance the data for that visualization is being held in a matrix.

A matrix is always listed as height first, then width. So a m x n matrix has height m and width n

Some important resources:


See your task in Replit for the assignment.


Aside:  A 3-dimensional matrix can be used to store even more data, like depth. Your expensive graphics cards use tons of very large matrices and complex data manipulation to move and display things realistically. If you have an interest in game programming, you will take many classes on matrix manipulation in University. Thankfully, many toolkits already do this for us (like Unity and Unreal Engine).