You now know what entangled states are but you haven’t seen how to make one. This lesson fixes that. There are three two-qubit gates you’ll see in almost every quantum circuit: CNOT, CZ, and SWAP. We’ll look at each in turn, starting with the most important one.
CNOT: the entanglement-maker
The CNOT gate — short for “controlled-NOT” — takes two qubits as input: a control and a target. Its rule is:
If the control is in state , flip the target. Otherwise, leave it alone.
In table form:
| Input | Output |
|---|---|
Here I’m using qubit 0 as control and qubit 1 as target, so means “qubit 1 is 0 and qubit 0 is 1” — and since qubit 0 (the control) is 1, we flip qubit 1, giving . (Yes, this is confusing the first time you read it. Sit with it for a moment.)
Written as a matrix in the basis with qubit 0 as the control:
The top-left block is the identity (because when the control is , nothing happens) and the bottom-right block is the Pauli (because when the control is , the target gets flipped).
CNOT is classical-looking on definite inputs — but its real superpower is what it does to superpositions.
The entanglement recipe
Here’s the most famous circuit in quantum computing:
- Start with both qubits in , so the joint state is .
- Apply to qubit 0. The joint state becomes — still a product state, since it equals .
- Apply . Let’s work through it term by term:
- (control is 0, do nothing)
- (control is 1, flip target: qubit 1 goes from 0 to 1)
So the final state is:
This is the Bell state. We made an entangled state out of two completely independent qubits using only and one CNOT. The concurrence is 1. This is exactly the recipe the “entanglement maker” follows in the widget — try it below.
Reset, then: , . Watch the concurrence jump from to .
CZ: the symmetric one
The CZ gate (controlled-Z) is simpler and more symmetric. It applies a gate (a phase flip) to the target when the control is :
Notice the only off-diagonal is zero: CZ is a diagonal matrix. All it does is multiply the amplitude by . That’s it.
Here’s the cute part: CZ is symmetric between the two qubits. In , there’s a clear “control” and “target” — swap their roles and you get a different gate. But doesn’t care which qubit you call “control” and which you call “target”; the action is the same. That makes particularly natural for hardware where both qubits are on equal footing (like many superconducting architectures).
There’s also a magic identity:
In words: CNOT is a CZ “sandwich” with Hadamards on the target. This is a direct consequence of the identity you saw in the Pauli lesson, and it means you can always convert between CNOT and CZ using single-qubit gates.
SWAP: the exchange
The third two-qubit gate is SWAP. It does what the name suggests — exchanges the states of the two qubits:
After a SWAP, whatever was in qubit 0 is now in qubit 1 and vice versa. This is useful in real hardware where not every pair of qubits can be directly coupled — you have to “walk” a state around the chip by swapping it through intermediate qubits.
Unlike CNOT and CZ, SWAP alone cannot create entanglement. It just moves existing states around. If the input was a product state, the output is still a product state (just with the qubits swapped). You can verify this in the widget: start from any product state, apply SWAP, and the concurrence stays at 0.
SWAP can be built from three CNOTs:
This is a neat exercise to work through. Try it in the widget: apply those three CNOTs to various input states and verify that it’s the same as SWAP.
Why CNOT is special
Here is a fact that will take the rest of the course to fully appreciate:
The set is universal for quantum computation.
With just those three gates — Hadamard, T, and CNOT — you can approximate any quantum computation to arbitrary precision. No other gates are needed. The Hadamard creates superposition, the T contributes the missing bit of “non-Clifford” magic, and CNOT connects qubits so they can entangle.
CNOT plays the role in quantum computing that NAND plays in classical computing: it’s the universal gate that (together with a couple of friends) can express everything. On many real quantum processors, CNOT is the only native two-qubit gate the hardware implements — every multi-qubit operation in your algorithm gets compiled down into a sequence of CNOTs and single-qubit rotations.
What’s next
You now have all the ingredients: qubits, single-qubit gates, and two-qubit gates including one (CNOT) that creates entanglement. In the final lesson of Module 4, we put the pieces together properly and meet the four Bell states — the simplest maximally entangled systems in quantum mechanics — and see what makes their measurement correlations genuinely strange.