Welcome to the first lesson of our second module, "Manipulating Qubits with Quantum Gates."
In the last module, we built a complete picture of a single qubit. We learned how to represent its state using vectors and visualize it on the Bloch sphere, and crucially, how to calculate the probabilities of measurement outcomes using the Born rule. So far, we've only discussed static states. The logical next question is: how do we change a qubit's state to perform a computation?
This lesson answers that question. Our goal is to apply the Pauli (X, Y, Z) and Hadamard (H) gates to a qubit state and interpret the result. These gates are the fundamental building blocks of quantum circuits, much like NOT, AND, and OR gates are for classical electronics. By applying these gates, we can manipulate the amplitudes ( and ) of a qubit's state vector, thereby controlling its evolution and the final probabilities of its measurement outcomes.
1. What are Quantum Gates?
In quantum computing, a gate is an operation that transforms the state of one or more qubits. For a single qubit, whose state can be described by a 2D column vector, a gate is represented by a 2x2 matrix. Applying a gate to a qubit is equivalent to multiplying the gate's matrix by the qubit's state vector.
However, not just any matrix can be a quantum gate. Quantum gates must be unitary. This is a critical requirement with two major implications:
- It preserves probability: A unitary transformation preserves the length of a vector. Since the squared length of the state vector corresponds to the total probability (which must be 1), this ensures the physics remains consistent.
- It is reversible: Every unitary matrix has an inverse (its conjugate transpose). This means every quantum operation can be undone, which is a fundamental difference from many classical gates like AND, where information is irreversibly lost.
The following video provides an excellent explanation of why this unitary property is essential.
Quantum Computing: Understanding Quantum Gates - Pauli-X, Z, Hadamard, CNOT, SWAP, and Rotation Gate
This video from Advanced Maths explains why quantum gates must be unitary to preserve probabilities.
Watch the section from the start of the explanation to understand the connection between preserving the vector's norm and the unitary property.
With this foundational concept in mind, let's explore the most important single-qubit gates.
2. The Pauli-X Gate: The Quantum NOT
The Pauli-X gate (or just X gate) is the quantum analogue of the classical NOT gate. It flips the state of the qubit.
- It transforms to .
- It transforms to .
Its matrix representation is:
Let's see this in action. If we apply the X gate to the state :
As expected, the state is flipped.
What about a superposition state, like ?
The X gate swaps the amplitudes of the and states.

Geometrically, the X gate corresponds to a 180-degree rotation of the state vector around the x-axis of the Bloch sphere.
Single qubit and its logic gates
The video "Single qubit and its logic gates" provides a great visualization of this effect.
Watch the clip from the beginning of the section on the Pauli-X gate. Focus on how flipping from the north pole (|0\rangle) to the south pole (|1\rangle) is visualized as a rotation around the x-axis.
3. The Hadamard Gate: The Superposition Creator
The Hadamard gate (H gate) is one of the most powerful and uniquely quantum gates. It is used to create superpositions. It transforms a definite basis state ( or ) into an equal superposition of both.
Its matrix representation is:
Let's apply it to the state:
This creates the state, an equal superposition where measuring 0 or 1 is equally likely.
Now let's apply it to the state:
This creates the state. Notice the minus sign on the component; this is a phase difference, which will be very important later.
A key property of the Hadamard gate is that it is its own inverse. Applying it twice returns the qubit to its original state. (the identity matrix). This is like taking a state into superposition and then bringing it back out again.
Quantum Computing: Understanding Quantum Gates - Pauli-X, Z, Hadamard, CNOT, SWAP, and Rotation Gate
Let's return to the "Advanced Maths" video to see a clear, worked-out example of the Hadamard gate's action.
Watch the segment on the Hadamard gate from the introduction of the gate. Pay attention to how it creates the |+\rangle and |-\rangle states from the basis states.
4. The Pauli-Z and Pauli-Y Gates: Phase and Flips
The last two gates in this lesson, the Z and Y gates, complete the Pauli family.
The Pauli-Z Gate: The Phase Flip
The Z gate leaves the state unchanged but applies a phase flip to the state (multiplying it by -1).
Its matrix representation is:
You might wonder what the point of this is. After all, the measurement probabilities for and are identical, since . However, the relative phase between components in a superposition is critical. For example, if we apply a Z gate to the state:
The Z gate flips the phase of the second term, transforming into . This ability to manipulate phase is the secret ingredient behind quantum interference, the engine of many quantum algorithms. Geometrically, the Z gate is a 180-degree rotation around the z-axis of the Bloch sphere.
The Pauli-Y Gate
The Y gate can be thought of as a combination of a bit flip (like X) and a phase flip (like Z).
Its matrix is:
It flips the qubit between and but also introduces complex phases. Geometrically, it's a 180-degree rotation around the y-axis of the Bloch sphere.
The IBM Qiskit resource below provides a great summary of these gates, including their matrix forms and circuit symbols.
Get started with Qiskit in the classroom
This resource from IBM Quantum Learning introduces the most common single-qubit gates.
Please read the section "Single-qubit gates," which starts after the section on vector notation. Focus on the definitions, truth tables, and matrix representations for the X, Hadamard, and Z gates. Note the circuit symbols used in Qiskit—we'll be using these soon.
Summary of Gates
The Pauli and Hadamard gates are the foundational tools for manipulating a single qubit. Each performs a specific rotation on the Bloch sphere, altering the qubit's state vector in a precise, reversible way.

Conclusion
In this lesson, we transitioned from describing static qubit states to actively manipulating them. We've defined what quantum gates are and explored the actions of the most fundamental set: the Pauli (X, Y, Z) and Hadamard (H) gates.
Key Takeaways:
- Quantum gates are represented by unitary matrices that transform a qubit's state vector. This ensures operations are reversible and conserve probability.
- The Pauli-X gate is a quantum NOT, flipping by swapping the state vector's amplitudes.
- The Hadamard gate is a superposition generator, transforming basis states into an equal superposition (, ).
- The Pauli-Z gate is a phase-flip, leaving alone but changing . It is crucial for manipulating the relative phase in a superposition.
- The Pauli-Y gate combines a bit-flip with a phase-flip.
Preview of the Next Lesson:
Now that we've covered the essential rotations and flips, we'll move on to gates that perform more subtle transformations. In the next lesson, we will explore the phase gates (S and T), which apply rotations of smaller angles than the Pauli gates. This will give us finer control over a qubit's phase, a necessary tool for building more complex quantum algorithms.