When it comes to linear algebra, there’s a relationship between vectors and matrices that I’m not yet understanding.
I believe I won’t really understand the purpose of quantum gates and quantum circuits until I understand what a matrix is. So. I asked Claude AI to help clarify these points for me.
Here’s part of what it said:
Vectors and Matrices
A vector is just a list of numbers that represents something — a point, a direction, or (in quantum computing) a “state.” Think of it as an arrow pointing somewhere.
A matrix is a grid of numbers whose job is to transform a vector into a new vector. You feed a vector in, the matrix moves/stretches/rotates it, and a new vector comes out.
So the relationship is:
Matrix × Vector = New Vector
The matrix is the action. The vector is the thing being acted on.
A tiny example: if a vector points “up,” a certain matrix could rotate it to point “sideways.” The matrix didn’t change what a vector is — it changed where it points.
Why This Matters for Quantum Computing
In quantum computing:
- A qubit’s state is a vector (usually written like |0⟩ or |1⟩, or a mix of both).
- A quantum gate is a matrix. When you “apply a gate” to a qubit, you’re just doing matrix × vector — the gate transforms the qubit’s state into a new state.
- A quantum circuit is simply a sequence of these matrix transformations applied one after another.
So the whole picture is: qubit states are vectors, gates are matrices, circuits are chains of matrix multiplications, and tensor products glue multiple qubits/gates together into a bigger system.
Let’s build it with numbers.
A Concrete Example
Say we have a vector:
v = [1]
[0]
Let’s apply a matrix that swaps the two numbers:
M = [0 1]
[1 0]
Matrix-vector multiplication works like this: each row of the matrix “asks” the vector a question and spits out one number.
M × v = [0×1 + 1×0] = [0]
[1×1 + 0×0] [1]
So [1,0] became [0,1]. The matrix swapped the two entries. That’s it — that’s what the matrix did.
What Determines the Numbers in a Matrix?
Here’s the key insight that makes everything click: a matrix is completely determined by what it does to the basic building-block vectors.
In 2D, the two basic building blocks are:
e1 = [1] e2 = [0]
[0] [1]
Every other vector is just some combination of these two. So if you know where a matrix sends e1 and where it sends e2, you know everything about that matrix — because:
- The first column of the matrix = where e1 ends up
- The second column of the matrix = where e2 ends up
Look back at our swap matrix [0 1; 1 0]. Column 1 is [0,1] — that’s where e1=[1,0] goes. Column 2 is [1,0] — that’s where e2=[0,1] goes. The matrix is literally just a record of “here’s where each basic direction lands.”
So the answer to “what determines the numbers” is: you decide what transformation you want, figure out where it sends the basic vectors, and that becomes the matrix. The numbers aren’t arbitrary — they’re a recipe built from a design goal.
Is It the Same in Quantum Computing?
Yes — exactly the same logic, with one extra rule.
In quantum computing, the “basic building blocks” are the states |0⟩ and |1⟩:
|0⟩ = [1] |1⟩ = [0]
[0] [1]
To build a gate, you decide: “Where do I want |0⟩ to go? Where do I want |1⟩ to go?” Those answers become the columns of your matrix — same as before.
Example: the quantum NOT gate (X gate) — you want it to flip |0⟩ into |1⟩ and flip |1⟩ into |0⟩. So:
- Column 1 (where |0⟩ goes) = [0,1]
- Column 2 (where |1⟩ goes) = [1,0]
X = [0 1]
[1 0]
Notice — it’s the exact same matrix as our swap example! That’s not a coincidence. It’s the same mathematical action: swap the two components.
The one extra rule (the “one extra thing”): in quantum computing, gates must be unitary, meaning they preserve the total “length” (probability) of the vector — you can rotate/flip a qubit’s state, but you can never stretch or shrink it out of proportion, because the numbers in a qubit’s vector represent probabilities that must always add up to 100%. A regular linear algebra matrix has no such restriction — it’s free to stretch, squash, or distort vectors however it wants.
How do you know what effect a gate will have? You work backward from your goal: decide what you want to happen to |0⟩ and |1⟩, write those as the columns of the matrix, and check that it’s unitary. Then multiplying that matrix by any qubit’s state tells you exactly what the gate does to it.
Want to try building your own simple gate next (like one that leaves |0⟩ alone but flips |1⟩‘s sign), to test this “design the columns” method yourself?
I won’t pretend 100% understanding of quantum gate (matrix) influence on a qubit’s state (vector), but I least feel more confident proceeding with my learning “for now” after reading this explanation.
(My learning progression description would have me “not give up” on the math part anyway, so…here goes.)