Hello! Welcome back to our journey through linear algebra for quantum mechanics and deep learning.
In the last lesson, we learned how to represent the states of multi-qubit systems. We saw that an n-qubit system lives in a -dimensional Hilbert space, and any state can be written as a superposition of basis vectors like .
Today, we'll address the other side of the coin: the operators that act on these multi-qubit states. Just as we used the tensor product to build larger state vectors from smaller ones, we will now use it to build larger operator matrices. This will allow us to describe multi-qubit quantum gates, which are the building blocks of quantum algorithms.
Our focus will be on one of the most important two-qubit gates: the Controlled-NOT (CNOT) gate. Understanding its representation is a crucial step toward your goal of studying quantum mechanics.
Learning Outcome: Apply tensor products to represent operators on a multi-qubit system, such as the CNOT gate.
1. The Tensor Product of Operators
Imagine a two-qubit system. We might want to apply operator to the first qubit and operator to the second qubit. How do we find a single matrix that represents this combined operation?
The answer lies in the tensor product of the matrices for and . The resulting operator is a larger matrix that acts on the composite state space. The key property that defines this new operator is:
This elegant rule says that applying the tensor product operator is the same as applying each individual operator to its respective vector and then taking the tensor product of the results.
To see how this is constructed, please read the following brief explanation. It provides the crucial link between the desired property above and the resulting matrix structure.
Module 4: Quantum Linear Algebra, Part 2
The following text, 'Tensor products of operators' from Prof. Rahul Simha's notes, provides an excellent derivation for the tensor product of two matrices.
Please read the section '4.3 Tensor products of operators'. Focus on the derivation that starts with the goal C(v⊗w) = Av⊗Bw and ends with the block matrix definition of C = A⊗B. This is the 'why' behind the Kronecker product for matrices.
As the text shows, if is an matrix and is an matrix, their tensor product is an block matrix:
This is the Kronecker product applied to matrices, which you've already seen for vectors. Let's watch a quick video that shows a concrete calculation.
Quantum Computing: Dirac's Bra-Ket Notation and Tensor Product
This clip from the 'Advanced Maths' channel will visualize the calculation of a tensor product of two simple matrices.
Please watch from 14:40 to 16:49. Notice how each scalar element of the first matrix 'A' multiplies the entire second matrix 'B' to form a block in the final, larger matrix.
2. The Controlled-NOT (CNOT) Gate
The CNOT gate is a cornerstone of quantum computing. It's a two-qubit gate that performs a conditional operation. It has a control qubit and a target qubit. The logic is simple:
- If the control qubit is in the state , it does nothing to the target qubit.
- If the control qubit is in the state , it flips the target qubit (applies an , or NOT, gate).
Let's look at its standard representations.

The matrix acts on the 4D state vector of the two-qubit system. Let's verify its action on the computational basis states . Remember their vector forms: , , etc.
- Input : Control is , target is . We expect the target to flip, yielding .
- Input : Control is , target is . We expect the target to flip, yielding .

This matrix representation is correct, but for your goals in quantum mechanics, there is a more insightful way to represent it.
CNOT as a Sum of Tensor Products
We can express the CNOT's logic—"IF control is 0, DO Identity; IF control is 1, DO NOT"—using operators. In quantum mechanics, an "if" condition on a basis state like can be implemented with a projector, .
This leads to a beautiful construction of the CNOT operator:
Here, and are projectors acting on the first (control) qubit, while (Identity) and (Pauli-X/NOT) act on the second (target) qubit.
Let's verify this form gives the same 4x4 matrix. We need the matrices for the single-qubit operators:
Now, we compute the tensor products:
Adding these two matrices together gives us exactly the CNOT matrix we saw earlier. This powerful outer-product representation is used frequently in quantum mechanics literature.
Test your understanding!
Using the outer-product form, construct the 4x4 matrix for a "reversed" CNOT gate, where the second qubit is the control and the first qubit is the target. The logic is: "If the second qubit is , flip the first qubit."
Show answer
The logic translates to:
Notice the operators are swapped because and now act on the first qubit, while the projectors act on the second. Let's compute the matrix:
Let's do the second term more explicitly:
Summing the two parts:
This matrix swaps the states and , which is exactly what we expect: the state of the first qubit is flipped only when the second qubit is 1.
3. Operators That Create Entanglement
An important insight is that the CNOT gate cannot be written as a simple tensor product of two single-qubit gates, . It is an inherently two-qubit operation. This is precisely why it can create entanglement.
Consider the separable input state . In vector form, this is .
Let's apply CNOT:
Since and , the result is:
This is the famous Bell state, which we know from a previous lesson is entangled. An operator that can be factored as cannot create entanglement from a separable state, but operators like CNOT can.
Conclusion
In this lesson, you have learned how to represent operations on multi-qubit systems. This is a fundamental skill for both quantum computing and the broader study of quantum mechanics.
Key Takeaways:
- An operator acting separately on two subsystems is represented by the tensor product (Kronecker product) of their individual operator matrices.
- The key property is .
- The CNOT gate is a fundamental two-qubit operator that flips a target qubit conditional on the state of a control qubit.
- The CNOT gate can be represented elegantly as a sum of tensor products: .
- Operators like CNOT, which cannot be factored into a simple tensor product , are essential for creating entanglement.
Preview of the Next Lesson:
We have now covered the full basics of tensor products for quantum systems: defining spaces, representing states, and representing operators. You are now equipped to tackle topics in both quantum computing and deep learning. We will now move on to a new module focused on Matrix Calculus and Optimization, starting with how to compute gradients of functions with respect to vectors and matrices—a critical skill for training machine learning models.