Resource · Guide or article
Matrices
Quick refresher on matrix notation and the basic operations, useful before grid, image, or linear algebra style coding questions.
Reviewed
Open the original: Matrices (opens the original site in a new tab)Add to a roadmap
Keep this resource with a roadmap you follow. It appears as your own extra resource; the roadmap's steps don't change and it doesn't count toward your tracked steps.
Source content: English
In mathematics, a matrix (plural matrices) is a rectangular array or table of numbers, symbols, or expressions, arranged in rows and columns. For example, the dimension of the matrix below is 2 × 3 (read "two by three"), because there are two rows and three columns: An m × n matrix: the m rows are horizontal, and the n columns are vertical. Each element of a matrix is often denoted by a variable with two subscripts. For example, a 2,1 represents the element at the second row and first column of the matrix To add two matrices: add the numbers in the matching positions:
PrepKit overview
PrepKit editors wrote and reviewed this overview from the source repository. It is not text from the resource itself.
- Suited to
- The source does not state a level
- Format
- Reference
What it covers
- Dimensions and indexing, with a 2 x 3 example and the row, column subscript convention.
- Element-wise addition and subtraction, plus multiplying by a constant.
- Matrix multiplication via row and column dot products, and transposing.
How to use it
PrepKit study advice, not a claim made by the source.
Multiply a 2 x 3 matrix by a 3 x 2 matrix by hand, then code it with nested loops and check the result shape.
Scope and limitations
Brief, and the worked examples are images hosted on MathIsFun. It does not cover complexity, determinants, or practice problems.
Access and format
Free English README on GitHub (trekhleb/javascript-algorithms, MIT license).
Reviewed by PrepKit on Oct 2, 2026. Listing source commit: 85293e3e2b88
Evidence behind this overview
- src/algorithms/math/matrix/README.md
Pages that include this
Get the PrepKit newsletter
Optional. You don't need it to use PrepKit.