Free degree-level computing lessons for careful independent study.

Degree Level Programmes · Formal Computing Foundations · Lesson 11

Matrices and Transformations

Use matrices as structured transformations of vectors.

Lesson overview

Use matrices as structured transformations of vectors.

CourseFundamentals of Computing
Topic strandVectors and matrices
Assessment styleDigital exam practice
EvidenceWorked answer plus justification

Starter: make the model explicit

Before reading the worked example, write down the objects involved, the claim being made and the notation you expect to use. This prevents the common error of calculating before modelling.

Learning objectives

  • Read the dimensions of a matrix.
  • Multiply a small matrix by a vector.
  • Explain matrix transformation as a repeatable rule.

Learning outcomes

  • By the end of this lesson, you can read the dimensions of a matrix.
  • By the end of this lesson, you can multiply a small matrix by a vector.
  • By the end of this lesson, you can explain matrix transformation as a repeatable rule.

Key vocabulary

matrixrowcolumntransformation

What this lesson is about

A matrix is a rectangular arrangement of numbers. When used as a transformation, it takes an input vector and produces an output vector by combining components in a structured way.

This is why matrices appear in graphics, machine learning, networks and data processing: they provide a compact formal way to describe repeatable transformations.

Terms, acronyms and named methods

These are the phrases and named techniques used in this lesson. Read this section before the worked example so the notation and examples have a clear meaning.

MatrixPhrase. A rectangular array of values arranged in rows and columns.
TransformationPhrase. A rule that maps an input vector to an output vector. A matrix can encode a repeatable linear transformation.
Matrix-vector productNamed operation. The calculation Ax where each row of matrix A combines with vector x to produce one output component.

Formal notation and definitions

A ∈ ℝᵐˣⁿ has m rows and n columns.If A is m × n and x ∈ ℝⁿ, then Ax ∈ ℝᵐ.(Ax)ᵢ = Σⱼ aᵢⱼxⱼ.

How to read the symbols

ARm×nA\in\mathbb{R}^{m\times n}Matrix A has m rows and n columns.
AxA\mathbf{x}Matrix-vector product: A transforms input vector x.
(Ax)i(A\mathbf{x})_iThe i-th output component produced by row i of A.

Use matrix dimensions to check whether a multiplication is legal before calculating. The row-by-column calculation defines each output component.

Degree-level reasoning

Vectors and matrices encode structure. The dimensions, units and component meanings are part of the model, not incidental presentation.

A correct matrix calculation should also say what the transformed vector or product represents.

Do not stop at a correct-looking answer. State why the method is valid, whether the result depends on a hidden assumption, and what would count as a counterexample.

Worked formal model

This section shows the model, notation, calculation and interpretation as one worked answer. The notation is part of the reasoning, not decoration.

1. Context and objects

A 2 by 2 matrix can transform a 2D vector by combining its x and y components into a new position.

Objects: matrix A, input vector x, output vector Ax, and the coordinate meanings of each component.

Model cue: Use a matrix-vector multiplication layout: each output component is a row of the matrix dotted with the input vector.

2. Mathematical working

A=[2001],x=[35]A = \begin{bmatrix}2 & 0 \\ 0 & 1\end{bmatrix},\quad x = \begin{bmatrix}3 \\ 5\end{bmatrix}Ax=[2001][35]=[23+0503+15]=[65]Ax = \begin{bmatrix}2 & 0 \\ 0 & 1\end{bmatrix}\begin{bmatrix}3 \\ 5\end{bmatrix} = \begin{bmatrix}2\cdot3 + 0\cdot5 \\ 0\cdot3 + 1\cdot5\end{bmatrix} = \begin{bmatrix}6 \\ 5\end{bmatrix}
Plain text version
A = [[2, 0], [0, 1]], x = [3, 5]
Ax = [2*3 + 0*5, 0*3 + 1*5]
Ax = [6, 5]

3. How to read the working

  1. Read the input vector as an ordered pair of components, not as two unrelated numbers.
  2. Each row of the matrix defines one output component.
  3. The first output component is row 1 dotted with the input vector; the second output component is row 2 dotted with the input vector.
  4. Interpret the result as a transformation of state or geometry.

4. Computing meaning and check

The matrix is a reusable rule for transforming vectors. The row-by-column calculation shows exactly how each output coordinate is produced.

Now check: Write a 2 by 2 matrix that doubles both coordinates of a vector. Then apply it to (3, 5).

Worked example

From scenario to formal reasoning

Scenario: A 2 by 2 matrix can transform a 2D vector by combining its x and y components into a new position.

Method: Use the definitions and notation introduced above, then state what the result means in this computing scenario.

Reveal model answer

Let A = [[2, 0], [0, 1]] and x = [3, 5]. Then Ax = [2*3 + 0*5, 0*3 + 1*5] = [6, 5]. The matrix doubles the first coordinate and leaves the second coordinate unchanged, so the calculation is formal evidence for the geometric transformation.

Worked solution structure

How a strong answer should be written

  1. Define: State the domain and the objects under discussion. For this lesson, begin from A ∈ ℝᵐˣⁿ has m rows and n columns.
  2. Apply: Use the relevant definition from vectors and matrices; do not rely on the diagram, wording or intuition alone.
  3. Check: Test a boundary case, counterexample candidate or representation limit.
  4. Conclude: Write one sentence that connects the formal result back to the computing scenario.

Common misconception

A common mistake is multiplying dimensions mechanically without asking what the transformation means.

Guided practice

  1. Write the 2 by 2 matrix that doubles both coordinates, then apply it to (3, 5).
  2. Explain the row-by-column calculation for the first output component.
  3. Give a matrix that leaves x unchanged and negates y, then interpret it geometrically.
  4. State the dimension rule that allows a 2 by 2 matrix to multiply a 2-component vector.

Quick checks

1. Which matrix doubles both coordinates?

2. Before multiplying a matrix by a vector, what should you check?

Digital exam practice

Example exam task

Use a 2 by 2 matrix to double both coordinates of x = (3,5). Show the matrix-vector product and interpret the transformation.

Notation toolkit

AxA\mathbf{x}

Means: a matrix transformation applied to a vector

How to use: Use it when a rule changes a vector state.

m×nm\times n

Means: matrix dimensions: rows by columns

How to use: Use it before checking multiplication compatibility.

[abcd]\begin{bmatrix}a&b\\c&d\end{bmatrix}

Means: a 2 by 2 matrix written by rows

How to use: Use it to organise coefficients for a two-component transformation.

What a good answer is expected to show

A strong answer for this lesson defines matrix A, input vector x, output vector Ax, and the coordinate meanings of each component, applies the vectors and matrices method with visible working, and finishes by interpreting the result in the computing scenario.

How to solve it

  1. Read the input vector as an ordered pair of components, not as two unrelated numbers.
  2. Each row of the matrix defines one output component.
  3. The first output component is row 1 dotted with the input vector; the second output component is row 2 dotted with the input vector.
  4. Interpret the result as a transformation of state or geometry.

Model answer

Reveal model answer
A=[2002],x=[35]A=\begin{bmatrix}2&0\\0&2\end{bmatrix},\quad \mathbf{x}=\begin{bmatrix}3\\5\end{bmatrix}Ax=[23+0503+25]=[610]A\mathbf{x}=\begin{bmatrix}2\cdot3+0\cdot5\\0\cdot3+2\cdot5\end{bmatrix}=\begin{bmatrix}6\\10\end{bmatrix}

A matrix that doubles both coordinates is A = [[2,0],[0,2]]. For x = (3,5), Ax = (2·3 + 0·5, 0·3 + 2·5) = (6,10). The matrix is compatible with the 2-component vector and represents a scaling transformation.

Practise next

  1. Write the 2 by 2 matrix that doubles both coordinates, then apply it to (3, 5).
  2. Explain the row-by-column calculation for the first output component.

Self-marking criteria

  • Writes a compatible 2 by 2 matrix.
  • Shows row-by-column working.
  • Calculates (6,10).
  • Explains the repeated transformation rule.
  • Mentions dimension compatibility.

Extension

Change one assumption in the worked scenario and decide whether the same method still applies. If it does not, name the exact point where the reasoning breaks.

Study route

Save one clean worked answer from this lesson. Include the problem statement, notation, working, final answer and a short note explaining the computing meaning of the result.

Next lesson: Matrix Operations and Computing Applications.