Courses / Computer Science I
Algebra

Matrices and Matrix Operations

Computer Science I 322 words Free to read

Rectangular Arrays of Numbers

A matrix is a rectangular array of numbers arranged in rows and columns; an m×nm \times n matrix has mm rows and nn columns. Matrices compactly represent linear systems, transformations, graphs (adjacency matrices), and data tables — they are one of computing's workhorse structures.

The operations:

Matrix multiplication has a crucial quirk: it is not commutative — in general ABBAAB \neq BA, and often only one order is even defined. (It is associative, A(BC)=(AB)CA(BC) = (AB)C.) The identity matrix II (ones on the diagonal, zeros elsewhere) acts like the number 1: AI=AAI = A. A square matrix may have an inverse A1A^{-1} with AA1=IAA^{-1} = I, which "undoes" it — but not all matrices are invertible.

Why does this odd multiplication rule matter? Because a matrix represents a linear transformation, and multiplying matrices composes the transformations. Applying two transformations in sequence corresponds to one matrix product — which is why the "row-times-column" rule is exactly the right definition, and why order matters (doing A then B differs from B then A).

Common pitfall: assuming matrix multiplication is commutative, or multiplying entry-by-entry like addition. In general ABBAAB \neq BA (order matters, and often only one order is defined). And the product is not formed by multiplying corresponding entries — each result entry is a dot product of a row and a column, so shapes must match (AA's columns == BB's rows).

Practise this lesson

The explanation above is free to read. The graded practice for this lesson lives in the Tryals app.

9practice questions
2interactive scenes
Start Computer Science I free

Algebra