Linear Algebra, Complex Numbers & Python — Before Module 1
No quantum computing yet — just the three toolkits every module after this one quietly assumes you already have: vectors and matrices, complex numbers, and enough Python to follow the code. If any of it already feels familiar, skim; if none of it does, take your time here first.
Even Maya — whose molecule classifier you'll follow starting in Module 6 — went back and brushed up on exactly these three things first. This page is that brush-up, for you.
Linear Algebra & Vector Spaces
A vector is simply an ordered list of numbers. In two dimensions, the vector (3, 2) can be drawn as an arrow starting at the origin and ending at the point 3 across and 2 up. Drag the sliders below and watch the arrow move exactly where you'd expect.
A matrix is a grid of numbers that transforms a vector into a new one — rotating it, stretching it, flipping it, or some mix of all three. Multiplying a vector by a matrix is just following the matrix's instructions for where the arrow's tip should move to.
One special case matters more than any other in this whole course: an eigenvector of a matrix is a vector that the matrix only scales — it never changes direction, only length. Every other vector gets pushed off its original line. Drag the angle slider below and watch for the two spots where the solid arrow never leaves the dashed line.
Last idea for this chapter: when you combine two separate quantum systems — say, two individual qubits — into one joint system, you use the tensor product. A 2-number vector combined with another 2-number vector produces a 4-number vector, built by multiplying every pair of entries.
0
1
1\u00d71 = 1
0\u00d70 = 0
0\u00d71 = 0
- Vector = an ordered list of numbers, drawable as an arrow.
- Matrix = a grid of numbers that transforms a vector into a new one.
- Eigenvector = a vector a specific matrix only stretches or shrinks, never rotates off its own line.
- Tensor product = the operation for combining two separate systems into one joint, bigger vector.
Complex Numbers & Dirac Notation
A complex number has two parts: a real part and an imaginary part, written a + bi, where i is defined so that i\u00b2 = \u22121 (something no ordinary real number can do). You can plot a + bi on a 2D plane exactly like a vector — real part on the horizontal axis, imaginary part on the vertical one.
Two things about a complex number matter constantly in this course: its magnitude (distance from the origin — how "big" it is) and its phase (the angle it points at). In quantum mechanics, a state's complex numbers are called amplitudes, and the rule connecting them to something measurable is: probability = magnitude squared. Try it below.
Physicists write quantum states in Dirac notation (also called bra-ket notation) instead of plain vector brackets — mostly because it is compact and makes a few operations very readable. Tap each card to see what the symbols mean.
- Complex number = a + bi, plottable on a 2D plane just like a vector.
- Magnitude = distance from the origin; phase = the angle it points at.
- Amplitude = the quantum-mechanics name for these complex numbers inside a state.
- Probability = |amplitude|\u00B2 — the single most-used formula in this entire course.
- Ket |\u03C8\u27E9 = a quantum state, written as a column of amplitudes; bra \u27E8\u03C8| = its mirror image, used for computing overlaps.
Python & NumPy Primer
A NumPy array is how Python represents a vector or matrix. Read each snippet below, guess the output, then reveal it.
v = np.array([3, 2])
print(v)
print(v.shape)
(2,)
M = np.array([[0, -1], [1, 0]]) # a 90\u00b0 rotation
v = np.array([1, 0])
print(M @ v)
z = 3 + 4j # NumPy/Python use 'j' for i
print(np.abs(z)) # magnitude
print(np.angle(z, deg=True)) # phase in degrees
53.13... # same magnitude/phase idea from Primer 2
- NumPy arrays are how every vector and matrix in this course actually gets represented in code.
- The @ operator (or
np.dot) performs matrix multiplication — the code version of Primer 1's transformations. - Python spells i as j in complex number literals, purely a notation quirk to remember.
- np.kron is the tensor product from Primer 1, ready to use on real arrays.
qml.RY(theta, wires=0), it is quietly doing exactly the matrix-vector multiplication you just predicted above — just with a name instead of a raw matrix.Primer Assessment
Three synthesis questions, one per chapter. Your result adapts to your whole session — chapters where you struggled above get flagged for review here.