Free degree-level computing lessons for careful independent study.

Degree Level Programmes · Formal Computing Foundations · Lesson 10

Vectors as Data, Geometry and State

Use vectors to represent ordered numerical information.

Lesson overview

Use vectors to represent ordered numerical information.

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

  • Represent a point or state as a vector.
  • Add and scale vectors in simple cases.
  • Explain why vector order matters.

Learning outcomes

  • By the end of this lesson, you can represent a point or state as a vector.
  • By the end of this lesson, you can add and scale vectors in simple cases.
  • By the end of this lesson, you can explain why vector order matters.

Key vocabulary

vectorcomponentmagnitudestate

What this lesson is about

A vector is an ordered collection of numbers. It can represent position, velocity, colour, feature values, probabilities or any state where each component has a fixed meaning.

The order of components matters. A vector is not merely a bag of values; changing component order changes the interpretation of the data.

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.

VectorPhrase. An ordered list of numerical components. In computing it can model position, movement, features, state or measurements.
ComponentPhrase. One position inside a vector. Components have fixed meanings, so their order matters.
Scalar multiplicationNamed operation. Multiplying every component of a vector by the same number.

Formal notation and definitions

v = (v₁, v₂, ..., vₙ) ∈ ℝⁿ.u + v = (u₁ + v₁, ..., uₙ + vₙ).λv = (λv₁, ..., λvₙ).

How to read the symbols

vRn\mathbf{v}\in\mathbb{R}^nA vector with n real-valued components.
viv_iThe i-th component of vector v.
λv\lambda\mathbf{v}Scalar multiplication: every component of v is multiplied by lambda.

Use vector notation to keep component order visible. Each component has a fixed meaning, so swapping components changes the model.

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 two-component vector can represent a player's screen position, while a second vector represents movement per frame.

Objects: position vector p, velocity vector v, their components, and the updated state vector.

Model cue: Use an arrow diagram for a 2D vector and a labelled tuple beside it. The arrow shows direction and magnitude; the tuple shows ordered components.

2. Mathematical working

p=[104],v=[31]\mathbf{p}=\begin{bmatrix}10\\4\end{bmatrix},\quad \mathbf{v}=\begin{bmatrix}3\\-1\end{bmatrix}p+v=[10+34+(1)]=[133]\mathbf{p}+\mathbf{v}=\begin{bmatrix}10+3\\4+(-1)\end{bmatrix}=\begin{bmatrix}13\\3\end{bmatrix}2v=[62]2\mathbf{v}=\begin{bmatrix}6\\-2\end{bmatrix}
Plain text version
v = (v₁, v₂, ..., vₙ) ∈ ℝⁿ.
u + v = (u₁ + v₁, ..., uₙ + vₙ).
λv = (λv₁, ..., λvₙ).

Worked use: If position p = (10, 4) and velocity v = (3, -1), then after one time step the new position is p + v = (13, 3). The first component and second component must keep their meanings throughout the model.

3. How to read the working

  1. Read each vector vertically as ordered components: the first component and second component have fixed meanings.
  2. For p + v, add matching components only: first with first, second with second.
  3. For 2v, multiply every component by the same scalar 2.
  4. Interpret the resulting vector as an updated state, such as a new position after one time step.

4. Computing meaning and check

The vector calculation updates state component by component. The order and units of the components are part of the model, not display details.

Now check: Explain what would go wrong if the vector components were swapped in a movement system.

Worked example

From scenario to formal reasoning

Scenario: A two-component vector can represent a player's screen position, while a second vector represents movement per frame.

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

Reveal model answer

If position p = (10, 4) and velocity v = (3, -1), then after one time step the new position is p + v = (13, 3). The first component and second component must keep their meanings throughout the model.

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 v = (v₁, v₂, ..., vₙ) ∈ ℝⁿ.
  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 treating a vector as just a list. In many models, the components have fixed meanings and units.

Guided practice

  1. Represent a screen position as p = (10, 4) and movement as v = (3, -1), then calculate p + v.
  2. Explain what each component means before doing the vector addition.
  3. Calculate 2v and describe the movement interpretation.
  4. Write one bug that could occur if the x and y components were swapped.

Quick checks

1. If p = (10,4) and v = (3,-1), what is p + v?

2. Why does vector component order matter?

Digital exam practice

Example exam task

A game object has position p = (10,4) and velocity v = (3,-1). Calculate p + v and 2v, then explain why component order and units matter.

Notation toolkit

v\mathbf{v}

Means: a vector: ordered numerical components

How to use: Use it for position, movement, state or feature data.

p+v\mathbf{p}+\mathbf{v}

Means: component-wise vector addition

How to use: Use it for updating a state by a movement or change vector.

cvc\mathbf{v}

Means: scalar multiplication of every component

How to use: Use it when a movement or state change is scaled.

What a good answer is expected to show

A strong answer for this lesson defines position vector p, velocity vector v, their components, and the updated state vector, 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 each vector vertically as ordered components: the first component and second component have fixed meanings.
  2. For p + v, add matching components only: first with first, second with second.
  3. For 2v, multiply every component by the same scalar 2.
  4. Interpret the resulting vector as an updated state, such as a new position after one time step.

Model answer

Reveal model answer
p=[104],v=[31]\mathbf{p}=\begin{bmatrix}10\\4\end{bmatrix},\quad \mathbf{v}=\begin{bmatrix}3\\-1\end{bmatrix}p+v=[133],2v=[62]\mathbf{p}+\mathbf{v}=\begin{bmatrix}13\\3\end{bmatrix},\quad 2\mathbf{v}=\begin{bmatrix}6\\-2\end{bmatrix}

p + v = (10, 4) + (3, -1) = (13, 3). Also 2v = (6, -2). The first component and second component must keep fixed meanings, such as x and y position, otherwise movement can occur in the wrong direction or wrong unit.

Practise next

  1. Represent a screen position as p = (10, 4) and movement as v = (3, -1), then calculate p + v.
  2. Explain what each component means before doing the vector addition.

Self-marking criteria

  • Adds matching components only.
  • Calculates p + v = (13,3).
  • Calculates 2v = (6,-2).
  • Names what each component represents.
  • Explains a realistic swapped-component bug.

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: Matrices and Transformations.