Define a vector as a data structure and as a mathematical object
Represent vectors as lists and as dictionaries (sparse vectors)
Perform vector addition, scalar multiplication and dot product
Explain the convex combination of two vectors
Vectors
What is a Vector?
In computing, a vector is a one-dimensional array of numbers (a list of real numbers). Mathematically, a vector represents magnitude and direction in n-dimensional space. In the OCR H446 context, vectors are studied both as data structures and mathematical objects with specific operations.
Vector as a List
v = [3, 7, 2, 5] w = [1, 4, 6, 0]
Fixed-length sequence of numbers. Index-accessed. Can be implemented as an array.
Sparse Vector (Dictionary)
v = {0:3, 2:7, 5:1} (only non-zero entries stored)
Efficient for high-dimensional vectors with mostly zero values — e.g. text data in NLP.
Vector Operations
Vector Addition and Scalar Multiplication
Vector Addition — element-by-element
[3, 7, 2] + [1, 4, 6] = [4, 11, 8]
Scalar Multiplication — multiply every element by a scalar
3 × [2, 5, 1] = [6, 15, 3]
Properties: vectors must have the same length for addition. Scalar multiplication scales the magnitude without changing direction. These operations underpin linear algebra used in machine learning and 3D graphics.
Result is a scalar (single number). Used in neural networks, similarity measures.
Convex Combination
A point between two vectors: C = (1−t)·u + t·v, where 0 ≤ t ≤ 1
When t=0: C=u. When t=1: C=v. When t=0.5: C is midpoint between u and v. Used in computer graphics (interpolation, animation, colour blending).
Exam Practice
OCR H446 Style · 4 marks
Vectors u = [2, 5, 3] and v = [4, 1, 6]. (a) Calculate u + v. [1 mark] (b) Calculate 2 × u. [1 mark] (c) Calculate the dot product u · v. [1 mark] (d) Find the convex combination of u and v when t = 0.25. [1 mark]
Performing dot product as element-by-element result — the dot product sums the products: it produces a single scalar, not a vector. Students often write [3×1, 7×4, 2×6] and stop without summing. Always sum at the end to get one number.
!
Getting the convex combination formula wrong direction — C = (1−t)u + tv. When t=0 you get u; when t=1 you get v. Swapping the formula (tu + (1−t)v) reverses which endpoint you're closer to when t=0.25.
!
Saying vectors and arrays are the same thing — a vector in the OCR H446 context has mathematical operations defined on it (addition, scalar multiplication, dot product) and represents a mathematical object. Not all arrays are vectors — the mathematical operations give vectors special meaning.