---
title: "Matrices"
description: "Follow each row of a matrix to one output, check the (m × n)(n × p) shape rule, multiply several input columns at once, and see what a transpose does."
canonical_url: "https://fanout.sh/ai/lessons/math-fundamentals-matrices"
md_url: "https://fanout.sh/ai/lessons/math-fundamentals-matrices.md"
access: "public"
---

# Matrices

Follow each row of a matrix to one output, check the (m × n)(n × p) shape rule, multiply several input columns at once, and see what a transpose does.

## Public overview

A matrix is a rectangular arrangement of numbers. Here is one with two rows and two columns:

A row runs across: the first row contains 4 and 1. A column runs down: the first column contains 4 and 0. We describe the matrix's shape as 2 × 2, always rows first, columns second. W is just its name.

We can use those numbers as a rule that turns two inputs into two outputs. Choose the inputs 2 and 3, written in a column:

This input column has shape 2 × 1: two rows and one column. Let's see how W acts on it.

Follow one row to one output

Take the first row of W. Multiply its 4 by the first input, 2, and its 1 by the second input, 3. Add the results: 8 + 3 = 11.

Repeat with the second row: 0 × 2 + 2 × 3 = 6. Written together, these two calculations give the matrix product Wx:

Each row produces one output. The second output ignores the first input because its multiplier is zero. Multiplying corresponding entries and adding them is called a dot product ; matrix multiplication repeats that operation for each row.

Predict: Change only the first input from 2 to 5. Which output changes, and what are the two new outputs?

answer The first becomes 4 × 5 + 1 × 3 = 23. The second stays at 6 because its multiplier on the first input is zero.

You can also inspect the first column of W: [4, 0]. Adding 3 to the first input adds 3 × [4, 0] = [12, 0] to the original outputs.

Shapes tell you which calculation is possible

---
This representation contains public Fanout content only. Protected Pro lessons, account data, billing, checkout, and pricing are not included.

Browse the public content map: https://fanout.sh/sitemap.md
