Where you'll see this: a single neuron in a neural network computes a weighted sum of its inputs — that's a linear combination. Mixing colours on a screen (30% red + 59% green + 11% blue = perceived brightness). Any blend, mix, or weighted average is a linear combination.
You know how to scale a vector. You know how to add two vectors. Put those two ideas together and you get one of the most important concepts in all of linear algebra: the linear combination.
The idea
Take two vectors v1 and v2. Scale each one by some number, then add the results:
av1+bv2 The numbers a and b are called coefficients (or weights). By choosing different values for them you get different results. The collection of all possible results is something we'll explore in the next lesson.
A concrete example
Let v1=[2, 0] (points right) and v2=[0, 2] (points up). Then:
- 1.5v1+1v2=[3, 2]
- 0v1+2v2=[0, 4]
- −1v1+0.5v2=[−2, 1]
Every point on the grid can be reached this way — just pick the right a and b.
Try it
In the interactive, v₁ and v₂ are fixed. Use the sliders to set a and b and land the result on the ★ target. The arrow goes blue → pink → result, showing the two steps of the combination geometrically.
Hint: the target is at [3, 2]. Since v₁ = [2, 0], you need
a×2=3, so
a=1.5. Since v₂ = [0, 2], you need
b×2=2, so
b=1.
Why this matters
Linear combinations are everywhere in applications:
- Computer graphics: every pixel colour is a weighted sum of red, green, and blue
- Machine learning: a neuron computes a weighted sum of its inputs — that's a linear combination
- Signals: any waveform can be expressed as a weighted sum of sine waves (Fourier series)
In code
import numpy as np
v1 = np.array([2, 0])
v2 = np.array([0, 2])
a, b = 1.5, 1.0
result = a * v1 + b * v2
print(result) # [3. 2.]