The Dot Product
WHY: The dot product IS what a neuron computes. Every incoming signal gets multiplied by its synaptic weight, then everything sums to one number. That number determines whether the neuron fires. This operation appears in PCA, in neural decoding, and in every layer of every AI model.
The LGN (your brain's first visual relay, between eye and cortex) receives from 3 retinal neurons.
• Retinal firing rates: r = [15, 7, 3] Hz
• Synaptic weights: w = [4, 3, 1]
• LGN activity: g = 4×15 + 3×7 + 1×3 = 60 + 21 + 3 = 84
That sum of (weight × input) IS the dot product: g = w · r
Algebraic definition: w · r = w₁r₁ + w₂r₂ + ... + wₙrₙ Multiply corresponding components, then sum everything up. Result: always a single number (a scalar).
vector + vector → vector. scalar × vector → vector. vector · vector → scalar (one number).
Geometric definition: w · r = ‖w‖ ‖r‖ cos(θ) θ = angle between the two vectors.
Same result, geometric view. The dot product depends on lengths AND the angle between vectors.
What the angle tells you:
• θ = 0° (same direction): cos(0°) = 1 → maximum — input pattern matches what the neuron 'prefers'
• θ = 90° (perpendicular): cos(90°) = 0 → no response — the input is completely irrelevant to this neuron
• θ = 180° (opposite): cos(180°) = −1 → strongest inhibition
The dot product is a similarity measure between two vectors.
import numpy as np
w = np.array([4, 3, 1]) # synaptic weights
r = np.array([15, 7, 3]) # retinal firing rates
g = np.dot(w, r) # LGN neuron activity
print(g) # 84np.dot(a, b) — the most important NumPy function in computational neuroscience.