In computer science (AQA 7517), a vector is a mathematical object representing a quantity with both magnitude and direction. Vectors are used in machine learning, computer graphics, physics simulations, and data science.
A vector can be represented as a 1D array of real numbers:
v = (3, 4) // 2D vector u = (1, 2, 3) // 3D vector w = (0.5, 1.2, -0.8, 2.1) // 4D vector
In AQA 7517, vectors are represented as a list of numbers (components). A vector of dimension n has n components.
// AQA representation using a 1D array v ← [3, 4] // vector with 2 components
Add corresponding components:
u = (1, 2, 3) v = (4, 5, 6) u + v = (1+4, 2+5, 3+6) = (5, 7, 9)
Multiply each component by a scalar (number):
v = (2, 3, 4) 3 × v = (3×2, 3×3, 3×4) = (6, 9, 12)
Multiply corresponding components and sum the results. Result is a scalar (number):
u = (1, 2, 3)
v = (4, 5, 6)
u · v = (1×4) + (2×5) + (3×6)
= 4 + 10 + 18
= 32
The dot product is used in: cosine similarity (angle between vectors), neural networks, recommendation systems.
Convolution slides one vector across another, computing element-wise products and summing. Used in signal processing and convolutional neural networks (CNNs).
// Convolution of [1,2,3] with kernel [0,1,0]: Position 0: 1×0 + 2×1 + 3×0 = 2 // This is a simplified 1D convolution
The magnitude of vector v = (v₁, v₂, v₃) is:
|v| = √(v₁² + v₂² + v₃²) // Example: v = (3, 4) |v| = √(3² + 4²) = √(9 + 16) = √25 = 5
| Application | How vectors are used |
|---|---|
| Machine learning | Data points represented as feature vectors; dot products compute similarity |
| Computer graphics | Positions, colours, and normals represented as vectors |
| Natural language processing | Word embeddings — words represented as high-dimensional vectors |
| Physics simulation | Velocity, acceleration, force represented as vectors |
| Recommendation systems | User and item preference vectors; cosine similarity measures overlap |
8 questions · instantly marked · AQA 7517 standard
| Term | Definition |
|---|
10 questions · 10 minutes