Question 1
3 marksLet u=[2,−1] and v=[4,3]. Give a dictionary representation of u, calculate u+v and calculate −2u.
Show solution and marking guidance
Indicative answer
- {0:2, 1:-1}.
- u+v=[6,2].
- −2u=[−4,2].
Loading…
Free A-Level Computer Science guide
The same vector can be an indexed collection, a function on component indices, or a geometric arrow. Keep those representations consistent while applying one operation at a time.
Content owner: Michael Print · Written for A-Level learners · Checked against official specifications
Explore the idea
A vector has indexed components from one field. Here the field is the real numbers and the dimension is two. Change coordinates and compare addition, scaling and convex combinations.
A vector in R² has two ordered real components, such as [3,1]. A list can store them, a dictionary can map indices 0 and 1 to their values, and a function on {0,1} expresses that same mapping.
Addition and scalar multiplication act component by component. A convex combination uses non-negative coefficients summing to one. The dot product sums matching component products and produces a scalar; with nonzero vectors it can determine their angle.
AQA 7517 · 4.2.8.1
Useful foundations
By the end, you should be able to
AQA: vectors over a field, indexed/function/geometric representations, addition, scalar multiplication, convex combinations, dot products and angle application. Examples use real components and exclude zero-vector angle division.
Shared foundations and optional extensions are labelled separately; this page does not claim complete coverage of the qualification.
R² describes two components from the field of real numbers. The vector [3,1] can be represented as {0:3, 1:1}, or f(0)=3 and f(1)=1 on index set {0,1}. Its geometric arrow runs from the origin to (3,1).
A vector need not be two-dimensional; the index set fixes its dimension. Combining vectors componentwise requires compatible dimensions. A geometric point and an arrow from the origin can share coordinates without making every arbitrary record a mathematical vector.
For u=[3,1] and v=[1,3], u+v=[4,4]. Multiplying u by scalar 2 gives [6,2]. Addition corresponds to translation; positive scaling changes magnitude, negative scaling also reverses direction, and zero scaling gives the zero vector.
Python list addition concatenates rather than performing mathematical vector addition. Build matching component results explicitly, for example [u[i] + v[i] for i in range(len(u))], after checking dimensions.
For 0 ≤ α ≤ 1, αu+(1−α)v has coefficients that are non-negative and sum to one. At α=0 it is v; at α=1 it is u. Intermediate weights lie on the segment connecting their coordinate points.
With α=0.25, u=[3,1] and v=[1,3], the result is [1.5,2.5]. Coefficients 2 and −1 still sum to one but are not a convex combination because one coefficient is negative.
u·v = Σ uᵢvᵢ. Here 3×1 + 1×3 = 6. Magnitudes are |u|=sqrt(10) and |v|=sqrt(10), so cos θ=6/10=0.6 and θ≈53.13°. Use the angle unit required by the question.
If either vector is zero, dividing by |u||v| is undefined. A dot product of zero establishes perpendicularity only when both vectors are nonzero. Rounding intermediate magnitudes too early can also distort an angle.
Worked example
4 original questions total 12 marks. Attempt each before opening the independently written indicative marking guidance.
Let u=[2,−1] and v=[4,3]. Give a dictionary representation of u, calculate u+v and calculate −2u.
Indicative answer
For u=[2,0], v=[0,4], compute 0.25u+0.75v. Explain whether 2u−v is a convex combination.
Indicative answer
For u=[1,1] and v=[1,−1], find the dot product and the angle. State the nonzero condition required by the angle formula.
Indicative answer
Explain why Python [2,1] + [3,4] does not perform vector addition. Give the mathematical result and the Python list result.
Indicative answer
This guide addresses AQA 7517 4.2.8.1. Check your examination year and the complete specification for the assessment scope.
These are independently written explanations and practice questions. CompSciTutoring.co.uk is not affiliated with or endorsed by an examination board. The marking guidance is indicative; always check the syllabus for your examination year.
Found an error? Email a correction.
Use the free examples first, then explore one-to-one tuition if guided practice would help.