Exercises

These exercises check whether you can read matrix entries, predict shapes, compute small products, and explain what the operations mean.

Try each prompt before opening the hint or solution.

Fluency

MATH-C03-C-001Exercise: Read an entry

If

A=[142536]A = \begin{bmatrix} 1 & 4 \\ 2 & 5 \\ 3 & 6 \end{bmatrix}

what is a32a_{32}?

Compute it first, then check your number.

HintRow first

Go to row 3, then column 2.

SolutionEntry lookup

Row 3 is [3, 6]. The second entry is 6. Matrix entry notation reads row first, then column.

MATH-C03-C-002Exercise: Read a column

In the same matrix, what is the first entry of column 2?

Compute it first, then check your number.

HintColumn direction

Column 2 is vertical.

SolutionColumn 2

Column 2 is:

[4, 5, 6]

Its first entry is 4. Reading a column means moving vertically, from top to bottom.

Shape Reasoning

MATH-C03-C-003Exercise: Predict a product shape

If AA has shape 5 x 4 and BB has shape 4 x 2, what shape does ABAB have?

Compute it first, then check your number.

HintKeep the outside dimensions

The middle 4 values match. The outside dimensions remain.

SolutionShape rule
(5×4)(4×2)5×2(5 \times 4)(4 \times 2) \rightarrow 5 \times 2

The middle dimensions match, so the product is defined. The output keeps the outside dimensions: rows from the first matrix and columns from the second.

MATH-C03-C-004Exercise: Spot a shape mismatch

Enter 1 if (5 x 4)(3 x 2) is a valid matrix product, or 0 if it is not.

Compute it first, then check your number.

HintCheck the middle

Compare the second number of the first shape with the first number of the second shape.

SolutionInvalid product

Enter 0. In:

(5 x 4)(3 x 2)
     ^  ^

the middle dimensions are 4 and 3, so the product is not defined.

Computation

MATH-C03-C-005Exercise: Compute a matrix-vector output

If

A=[1230]A = \begin{bmatrix} 1 & 2 \\ 3 & 0 \end{bmatrix}

and x=[4,5]x = [4, 5], what is the first entry of AxAx?

Compute it first, then check your number.

HintUse the first row

Compute [1,2][4,5][1, 2] \cdot [4, 5].

SolutionFirst row
[1,2][4,5]=14+25=14[1, 2] \cdot [4, 5] = 1 \cdot 4 + 2 \cdot 5 = 14

The first output entry uses the first row of the matrix against the whole input vector.

MATH-C03-C-006Exercise: Compute a matrix product entry

Let

A=[1234]A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}

and

B=[5678]B = \begin{bmatrix} 5 & 6 \\ 7 & 8 \end{bmatrix}

What is the top-left entry of ABAB?

Compute it first, then check your number.

HintRow-column dot product

Compute [1,2][5,7][1,2]\cdot[5,7].

SolutionTop-left entry
[1,2][5,7]=15+27=19[1,2]\cdot[5,7] = 1\cdot5 + 2\cdot7 = 19

Top-left means row 1 of AA with column 1 of BB. One entry of the product is one row-column dot product.

Patterns

MATH-C03-C-007Exercise: Transpose a shape

If AA has shape 2 x 7, what shape does ATA^T have?

Compute it first, then check your number.

HintSwap the numbers

The transpose swaps rows and columns.

SolutionTranspose shape

A 2 x 7 matrix has 2 rows and 7 columns. Its transpose has 7 rows and 2 columns.

MATH-C03-C-008Exercise: Apply a diagonal matrix

If a diagonal matrix has diagonal entries 2 and 5, what is the second entry of D[3,4]TD[3,4]^T?

Compute it first, then check your number.

HintSecond coordinate

Multiply the second coordinate 4 by the second diagonal entry 5.

SolutionDiagonal scaling

A diagonal matrix with entries 2 and 5 scales:

[3,4]T[23,54]T=[6,20]T[3,4]^T \mapsto [2\cdot3, 5\cdot4]^T = [6,20]^T

The second entry is 20. The diagonal entries act as separate scale factors, so the second diagonal entry only scales the second coordinate.

Interpretation

MATH-C03-C-009Exercise: Read a layer shape

If xx has length 10 and WW has shape 4 x 10, what is the length of WxWx?

Compute it first, then check your number.

HintUse the rows

The output length is the number of rows of WW.

SolutionLayer output

The input length 10 matches the columns of WW. The output length is the number of rows: 4.

MATH-C03-C-010Exercise: Explain the row rule

Enter 1 if this sentence is correct:

Each output entry of Ax
is the dot product of one row
of A with x.

Compute it first, then check your number.

HintUse dot product language

Each row of the matrix interacts with the input vector.

SolutionRow rule

Enter 1. Each output entry is the dot product of one row of the matrix with the input vector.

MATH-C03-C-011Exercise: Check multiplication order

Let AA have shape 2 x 3 and BB have shape 3 x 5.

Enter 1 if ABAB is defined and has shape 2 x 5.

Compute it first, then check your number.

HintMiddle, then outside

Write (2 x 3)(3 x 5).

SolutionDefined product
(2×3)(3×5)2×5(2 \times 3)(3 \times 5) \rightarrow 2 \times 5

The middle dimensions match, so the product is defined. The result has 2 rows from AA and 5 columns from BB.

MATH-C03-C-012Exercise: Track a batch through a layer

A batch XX has shape 12 x 8: 12 examples and 8 features per example. A weight matrix WW has shape 8 x 4.

How many output features does each example have in XWXW?

Compute it first, then check your number.

HintKeep examples, change features

The batch size remains 12; the last dimension becomes the output-feature count.

SolutionOutput feature count
(12×8)(8×4)12×4(12 \times 8)(8 \times 4) \rightarrow 12 \times 4

There are still 12 examples. Each output row has 4 features, because the weight matrix maps 8 input features into 4 output features.

Use the solutions page if you want the same reasoning in one linear review.