Skip to topic
    ← Back to course topics

    Vectors — AQA A-Level Computer Science

    In AQA A-Level Computer Science, a vector is defined mathematically as an element of a vector space and computationally represented as a 1D array, list, or function mapping keys to real numbers. Mastering vector operations—including addition, scalar multiplication, dot product, and convex combinations—is essential for computer graphics, physics engines, and machine learning models.

    Vectors explained

    This statement uses the maps-to arrow to show a mapping from the input 3 to the output 2.718281828.

    Read the full explanation

    In this item, the arrow tells the learner that the value on the left is the input and the value on the right is the output produced by a rule or function. The number 2.718281828 is an approximation of Euler's number e, which is the base of natural logarithms. Learners should recognise that a mapping pair does not by itself reveal the rule; it simply records one input-output relationship. To use such pairs in computing contexts, a student might check whether a candidate function f produces f(3) = 2.718281828, or write the pair in a table of inputs and outputs. Recognising the pair as a single data point, not a definition, prevents the common error of assuming the mapping is a general rule.

    Your focus

    1. 3 ↦ 2.718281828

    Which command word is this?

    Perform mathematical operations step-by-step to arrive at a numerical solution. Working must be shown to secure method marks.

    Vectors exam tips

    Topic Overview

    Vectors bridge pure mathematics and computer science, representing entities that possess both magnitude and direction or serving as ordered collections of numeric attributes. In AQA A-Level Computer Science, vectors are examined both as abstract mathematical structures and as concrete computing abstractions implemented via one-dimensional arrays, lists, or dictionary-style functions.

    Understanding vectors and their core operations is foundational to computer graphics pipelines, computer vision, data science, and artificial intelligence. Whether transforming 3D models in a rendering engine, computing cosine similarities in search engines, or calculating velocities in game physics, vector algebra provides the fundamental computational toolset.

    Key Concepts
    • →Representation: Vectors can be represented as geometric arrows, ordered lists/1D arrays of components, or as functions mapping an index set to real numbers.
    • →Vector Addition & Scalar Multiplication: Adding vectors component by component, and scaling vectors by multiplying each component by a single real value.
    • →Dot Product (Scalar Product): The sum of the products of corresponding components, yielding a scalar used to determine angles, projections, and orthogonality.
    • →Convex Combination: A linear combination alpha * u + beta * v where weights are non-negative and sum to 1, used for geometric interpolation between points.
    Marking Points
    • Identifies 3 as the input and 2.718281828 as the output of the mapping
    • Recognises that the pair is one data point and does not define the whole function
    • Recognises 2.718281828 as an approximation of e to nine decimal places
    • Checks a proposed rule by substituting 3 and comparing the output
    Examiner Tips
    • 💡Name the input before the arrow and the output after it in your answer
    • 💡Test any candidate rule by substituting the input and checking the output matches
    • 💡Remember that one mapping pair cannot uniquely determine a function
    • 💡When asked to represent a vector as a function, explicitly define the domain and the mapping rule, e.g., f: {0, 1, 2} -> R where f(0) = 4, f(1) = -2, f(2) = 7.
    • 💡In calculation questions, clearly show each individual multiplication step before adding the terms to ensure method marks even if an arithmetic error occurs.
    • 💡Always state whether a final output is a scalar or a vector to prevent ambiguity in your written answers.
    Common Mistakes
    • Treats a single input-output pair as proof of the complete rule; one pair can be produced by many different functions
    • Reverses the input and output, reading 2.718281828 as the argument and 3 as the result
    • Assumes the decimal is exact rather than a rounded approximation of e
    • Believing vectors can only represent 2D or 3D physical coordinates, whereas in computer science they frequently represent n-dimensional feature spaces such as word embeddings or RGB colour channels.
    • Treating the dot product as component-wise multiplication that outputs another vector, rather than summing the products to yield a scalar.
    • Assuming any linear combination is a convex combination, neglecting the strict constraints that alpha >= 0, beta >= 0, and alpha + beta = 1.
    Revision Plan
    1. 1Day 1-2: Master the three representations of vectors (arrows/tuples, 1D arrays, and mathematical functions).
    2. 2Day 3-4: Practice vector addition, subtraction, and scalar multiplication both algebraically and graphically.
    3. 3Day 5-6: Focus on the dot product, practicing manual calculations, orthogonality tests, and geometric angle interpretations.
    4. 4Day 7-8: Learn convex combinations, linear interpolation (lerp), and their real-world applications in rendering and animation.
    5. 5Day 9-10: Work through past AQA exam questions to refine your speed and terminology.
    Exam Question Types
    • 📋Calculation questions: Computing scalar multiples, vector additions, dot products, or convex combinations.
    • 📋Definition and representation questions: Defining a vector mathematically, writing a vector as a formal function, or describing array storage.
    • 📋Application and scenario questions: Explaining how vectors and dot products are used in 3D graphics, collision detection, or text search algorithms.
    Command Word Expectations (AQA)
    Calculate

    Perform mathematical operations step-by-step to arrive at a numerical solution. Working must be shown to secure method marks.

    Explain

    Provide a reasoned explanation detailing how or why a vector operation works, linking mathematical properties to the scenario.

    State

    Give a concise, factual answer or definition without extensive discussion or calculation.

    How Students Lose Marks (Examiner Pitfalls)
    Pitfall: Confusing the dot product output with a vector instead of a scalar value.
    ❌ Weak Answer (Loses Marks):The dot product of [2, 3] and [4, 1] is [8, 3].
    Example improved answer:The dot product is calculated as (2 * 4) + (3 * 1) = 8 + 3 = 11, which produces a single scalar value rather than a vector.
    Examiner Tip: Always remember that the dot product is also called the scalar product; the result must always be a single real number, never a vector or list.
    Pitfall: Omitting the necessary non-negativity and sum constraints when defining a convex combination.
    ❌ Weak Answer (Loses Marks):A convex combination is when you multiply two vectors by alpha and beta and add them together.
    Example improved answer:A convex combination of vectors u and v is an expression of the form alpha * u + beta * v, where alpha >= 0, beta >= 0, and alpha + beta = 1.
    Examiner Tip: Marks are frequently lost by forgetting to specify that alpha and beta must be non-negative and sum exactly to 1.
    Step-by-Step Worked Solutions

    Question: Given vectors a = [3, -1, 4] and b = [2, 5, -2], calculate the dot product a . b and determine whether the two vectors are orthogonal.

    1. 1.Step 1: Write out the component-wise products: (3 * 2) + (-1 * 5) + (4 * -2).
    2. 2.Step 2: Evaluate each multiplication: 6 + (-5) + (-8).
    3. 3.Step 3: Sum the scalar terms: 6 - 5 - 8 = -7.
    4. 4.Step 4: Test for orthogonality. Two vectors are orthogonal if and only if their dot product equals 0. Since -7 != 0, the vectors are not orthogonal.
    Final Answer: The dot product a . b is -7. Because a . b != 0, the vectors are not orthogonal.

    Question: A graphics engine interpolates between point P = [10, 40] and point Q = [50, 120] using a convex combination with alpha = 0.25 and beta = 0.75. Calculate the coordinates of the resulting point R.

    1. 1.Step 1: Check that the weights define a valid convex combination: alpha >= 0 (0.25 >= 0), beta >= 0 (0.75 >= 0), and alpha + beta = 0.25 + 0.75 = 1.0.
    2. 2.Step 2: Apply the formula R = alpha * P + beta * Q: R = 0.25 * [10, 40] + 0.75 * [50, 120].
    3. 3.Step 3: Multiply each vector by its scalar weight: 0.25 * [10, 40] = [2.5, 10]; 0.75 * [50, 120] = [37.5, 90].
    4. 4.Step 4: Sum the resulting components: R = [2.5 + 37.5, 10 + 90] = [40, 100].
    Final Answer: The coordinates of point R are [40, 100].
    Active Recall Memory Test
    What is the mathematical condition for two non-zero vectors u and v to be orthogonal?
    Key Fact: Their dot product must equal zero (u . v = 0).
    What constraints must be satisfied for alpha * u + beta * v to be a convex combination?
    Key Fact: alpha >= 0, beta >= 0, and alpha + beta = 1.
    How can a 4-element vector [7, 0, 3, 9] be defined as a function f?
    Key Fact: f: {0, 1, 2, 3} -> R where f(0) = 7, f(1) = 0, f(2) = 3, and f(3) = 9.
    Does the dot product of two vectors produce a vector or a scalar?
    Key Fact: A scalar (a single real number).
    Frequently Asked Questions
    Why does AQA define vectors as functions in Computer Science?
    Defining a vector as a function mapping an index set to real numbers provides a formal, implementation-independent abstraction. In this model, the domain of the function represents the dimension indices, and the codomain represents the values stored at those positions. This mathematical formulation mirrors how associative arrays, dictionaries, or sparse vectors operate in real-world software systems.
    What is the practical difference between a vector and a 1D array?
    A 1D array is a low-level data structure representing contiguous memory locations allocated to store elements of a particular data type. A vector is an abstract mathematical object equipped with specific algebraic operations like addition, scalar multiplication, and inner products. While arrays are the standard vehicle to implement vectors in software, a vector carries mathematical meaning that raw arrays do not inherently have.
    How is the dot product used in computer graphics and game development?
    The dot product is vital in computer graphics for calculating surface shading, reflections, and field-of-view visibility. By computing the dot product between a surface normal vector and an incident light direction vector, engines calculate the cosine of the angle between them, determining how brightly lit the surface should be. If the dot product is negative or zero, the surface faces away from the light source and remains in shadow.
    What is a convex combination and where is it used in programming?
    A convex combination is a weighted sum of vectors where the weights are non-negative and sum to exactly 1. In computing, it forms the foundation of linear interpolation (commonly known as 'lerp'), which smoothly transitions between two points, colours, or camera positions over time. Because the weights are constrained between 0 and 1, the resulting vector is guaranteed to lie on the line segment connecting the two original endpoints.
    How are high-dimensional vectors used in machine learning and search engines?
    In natural language processing and information retrieval, documents, words, and user queries are transformed into high-dimensional vectors known as embeddings. Each dimension represents a learned semantic feature or keyword weight. Search engines compare vectors by taking their dot product or cosine similarity; vectors pointing in nearly the same direction indicate closely related concepts, enabling semantic search and recommendation algorithms.