Linear Combinations
This is the most important concept in linear algebra for neuroscience. First: what IS a linear combination? Then: why does it matter everywhere?
WHAT: The NMA definition
We call a group of 2 or more vectors a set of vectors. A linear combination of a set of vectors is a combination of that set using scalar multiplication and vector addition.
Essentially: multiply each vector in the set by a scalar, then add all the scaled vectors together. The output — another vector — is a linear combination of the set.
Formally: a vector u is a linear combination of vectors v₁, v₂, ..., vₙ with scalar weights c₁, c₂, ..., cₙ if:
u = c₁v₁ + c₂v₂ + ... + cₙvₙ
Example: x = [3, 1], y = [-1, 2], a = 2, b = 3 z = 2×[3,1] + 3×[-1,2] = [6, 2] + [-3, 6] = [3, 8] z is a linear combination of x and y.
Scale each vector by its weight, then add. That's it.
Think about this — with x = [3,1] and y = [-1,2], play with different values of a and b:
1. How does ax compare to x when a is negative?
2. How does ax compare to x when a is a fraction?
3. Can you get z to point to anywhere in 2D space with combinations of a and b?
4. Would that be true no matter what x and y are, as long as they're both 2D?
(We answer question 3 in the Span lesson — spoiler: it depends on whether x and y point in different directions.)
WHY 1 — Every neuron computes one.
The LGN (Lateral Geniculate Nucleus) is your brain's first visual relay station — it sits between your eyes and visual cortex. One LGN neuron receives signals from 3 retinal neurons with synaptic weights [4, 3, 1]. If those neurons fire at [10, 5, 2] Hz:
LGN output = 4×10 + 3×5 + 1×2 = 57
That weighted sum across all inputs IS a linear combination.
WHY 2 — PCA uses linear combinations to make neural data visible.
You record 100 neurons. You cannot plot 100 dimensions — humans see in 3D. But neurons are correlated: groups fire together. PCA finds 3 'summary directions,' each one a specific weighted mix of all 100 neurons, that captures most of the information. Now you can plot it. Linear combinations are how you compress without losing what matters.
WHY 3 — Every AI does this too.
When GPT processes a word, it turns it into a vector of ~1000 numbers. At each layer, it computes a weighted sum of those 1000 numbers — multiplying each by a learned weight and adding up. The weights are what the network learned during training. This is exactly what a biological neuron does. Linear algebra is the shared language of both brains and AI.
import numpy as np
x = np.array([3, 1])
y = np.array([-1, 2])
# Linear combination: z = 2x + 3y
z = 2*x + 3*y
print(z) # [3, 8]
# LGN neuron: weights × retinal firing rates
weights = np.array([4, 3, 1])
firing_rates = np.array([10, 5, 2])
output = np.sum(weights * firing_rates)
print(output) # 57Any weighted sum of vectors is a linear combination. The LGN neuron computes one every millisecond.