Matrices and Basic Matrix Operations
What You’ll Learn
Section titled “What You’ll Learn”In this lesson you’ll learn what matrices are and how to perform basic operations on them (addition, subtraction, and scalar multiplication). Matrices are one of the most important tools in linear algebra and are used everywhere in graphics and games.
The Concept
Section titled “The Concept”A matrix is a rectangular array of numbers arranged in rows and columns.
Example of a matrix:
- The size is written as rows columns (this one is ).
- Individual entries are called elements and are denoted (row , column ).
Basic Matrix Operations
Section titled “Basic Matrix Operations”- Addition and Subtraction: Matrices can be added or subtracted only if they have the same dimensions. Add/subtract corresponding elements.
In the diagram: two matrices are added element-by-element. Matching colors show how each position in and maps to the same position in the result.
- Scalar Multiplication: Multiply every element of the matrix by a number (scalar).
Every entry gets multiplied by the scalar (3 in this case). The annotations on the right show each individual multiplication.
- Transpose: The transpose flips rows and columns.
Row 1 of the original becomes Column 1 of the transpose, and Row 2 becomes Column 2. The color-coded highlights make it easy to track where each entry ends up.
Worked Examples
Section titled “Worked Examples”Example 1: Matrix Addition
Let ,
Each entry is the sum of the entries in the same position.
Example 2: Scalar Multiplication
Every element gets multiplied by 3.
Example 3: Transpose
Let
Rows become columns and columns become rows.
Real-World Application
Section titled “Real-World Application”Matrices are the backbone of 3D graphics and game engines:
- Transformation matrices are used to move, rotate, and scale objects
- Model matrix = position/rotation/scale of an object
- View matrix = camera position and orientation
- Projection matrix = converts 3D world to 2D screen
Every frame, the graphics card multiplies many matrices together to figure out where every vertex should appear on your screen.
Example: When you rotate your character in a game, the engine applies a rotation matrix to every vertex of the model.
Retrying will remove your ✅ checkmark until you pass again.