Get AI summaries of any video or article — Sign up free
Qubits and Gates - Quantum Computer Programming w/ Qiskit p.2 thumbnail

Qubits and Gates - Quantum Computer Programming w/ Qiskit p.2

sentdex·
5 min read

Based on sentdex's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

A qubit isn’t treated as a fixed 0 or 1 before measurement; its Bloch-vector position encodes probabilities for both outcomes.

Briefing

Quantum computing’s edge isn’t just “more states,” it’s how qubits and gates manipulate probability amplitudes in a way classical circuits can’t match in a single pass. A classical circuit acting on n bits can only account for 2^n possible input/output combinations, while a quantum circuit can evolve a superposition across 2^n states simultaneously—through interference—using sequences of gates. That capability is why quantum systems are often discussed in terms of exponential state space: a 60-qubit machine, for instance, is framed as operating over 2^60 states at once, a scale that’s far beyond what classical aggregation would imply.

The tutorial then grounds that abstraction in a concrete visualization: the Bloch sphere. A single qubit is represented as a vector pointing somewhere on the sphere, with the poles corresponding to measurement outcomes 0 and 1. Before measurement, the qubit isn’t “a 0 or a 1”; it’s a state with a distribution of probabilities encoded in its position. When a gate is applied, it effectively rotates that Bloch vector—so the gate changes the qubit’s future measurement probabilities by rotating the state within Hilbert space. Measurement collapses the state to a definite classical result, but the probabilities come from where the vector was pointing right before collapse.

From there, the focus shifts to how specific gates behave. Hadamard (H) is used to create superposition, rotating the Bloch vector into a state where measurement yields 0 and 1 with roughly equal likelihood. Controlled-NOT (CNOT) is treated as the mechanism that entangles qubits: applying CNOT changes the target qubit based on the control qubit, and the resulting measurement outcomes are no longer independent. In the examples, measuring both qubits produces fewer joint combinations than a naive “50/50 times 50/50” expectation would suggest—evidence of entanglement rather than independent randomness.

The tutorial extends the same logic to three qubits, including a controlled-controlled-NOT (Toffoli-style behavior) where two qubits act as controls for a third. The Bloch-sphere plots show that intermediate qubits can end up in superpositions while the controlled qubit’s distribution reflects the combined control conditions. A recurring practical detail is that the plotted bit order appears reversed in the visualization outputs, and the author repeatedly checks this by changing which qubit is measured into which classical bit.

Finally, the tutorial highlights that many gates can be understood as rotations about axes on the Bloch sphere. Rotation gates (including X-like behavior and parameterized rotations such as Rx with angles like π, π/2, and π/4) change the qubit state by rotating the Bloch vector, and the resulting measurement histograms follow from that geometry. It also emphasizes that controlled rotations (e.g., controlled rotation around the Y axis) can be constructed from simpler primitives like CNOT plus single-qubit rotations, reinforcing a key programming mindset: gates are composable building blocks, and predicting their effects becomes easier by repeatedly mapping gate sequences to Bloch-vector movement and then to output distributions.

Overall, the core takeaway is a programming workflow: visualize the qubit state on the Bloch sphere, apply gates as rotations/controls/entangling operations, and use the predicted probability distributions to reason about what measurement outcomes should look like—especially as qubit counts grow and entanglement makes naive independence assumptions fail.

Cornell Notes

The tutorial frames quantum advantage as a consequence of how gates evolve qubits across a superposition of 2^n states, with interference shaping measurement probabilities. A single qubit is visualized on the Bloch sphere as a Bloch vector whose position encodes the probabilities of measuring 0 or 1; gates rotate that vector, and measurement collapses it to a definite outcome. Hadamard creates superposition, while CNOT introduces entanglement so joint measurement outcomes are correlated rather than independent. With three qubits, controlled-controlled operations further condition rotations and flips, changing the target qubit’s distribution based on two controls. The practical lesson is to predict outcomes by tracking Bloch-vector changes and then mapping them to histograms, while also noting that bit-order in plots may appear reversed.

Why does a quantum circuit “consider” more possibilities than a classical one in a single pass?

For n bits, the number of possible classical bit strings is 2^n. The key difference is how circuits process them: a classical circuit effectively handles only a limited set of states through its logic in one evolution, whereas a quantum circuit evolves a superposition across 2^n basis states at once. Gates act on the amplitudes of those basis states, and interference during the gate sequence determines the final measurement probabilities.

How does the Bloch sphere turn “probability” into something you can visualize?

A qubit is represented as a vector on the Bloch sphere. The poles correspond to measurement outcomes: pointing to the “0” pole means measurement yields 0 with certainty; pointing to the “1” pole means measurement yields 1 with certainty. For vectors in between, measurement collapses the state to 0 or 1 with probabilities determined by the vector’s position. Gates then rotate the vector, changing those probabilities before collapse.

What’s the difference between applying Hadamard and applying CNOT, in terms of what you see and what you measure?

Hadamard (H) rotates the Bloch vector into a superposition, so measuring the qubit yields 0 and 1 with roughly equal probability. CNOT uses a control qubit to condition the target qubit, and that conditional action produces entanglement. In measurements, the joint outcomes show correlations: you don’t get the full set of combinations expected from independent 50/50 behavior, because the qubits’ states are linked by the control-target operation.

In a two-qubit example, why might “50% then 50%” not produce four equally likely joint outcomes?

If qubits were independent, a 50/50 distribution on each would yield four joint outcomes (00, 01, 10, 11) with equal probabilities. The tutorial’s CNOT example instead yields only two dominant joint outcomes, indicating entanglement. The control qubit’s state determines how the target qubit evolves, so the measurement results are correlated rather than independent.

How do rotation gates relate to gates like NOT (X), and what does changing the rotation angle do?

The NOT gate (X) is treated as a rotation on the Bloch sphere (about the X axis). Parameterized rotation gates rotate the Bloch vector by an angle θ around a chosen axis. Changing θ changes where the vector ends up, which directly changes the measurement histogram. For example, rotating by π/2 or π/4 yields intermediate states rather than full flips, producing nontrivial probability distributions.

Why does the tutorial repeatedly question whether the plotted qubit labels are reversed?

The author observes that the histogram outcomes don’t match the expected probabilities if the plotted qubit index order is assumed to be “as labeled.” To test this, the circuit is modified so a specific qubit is measured into a specific classical bit, and the resulting distribution is checked. The mismatch suggests the visualization/bit ordering in the plotting library may reverse the mapping between qubit indices and displayed labels.

Review Questions

  1. If a qubit’s Bloch vector points exactly at the 0 pole, what measurement outcome should occur and why?
  2. Describe how CNOT changes the relationship between two qubits’ measurement outcomes compared with two independent Hadamard-prepared qubits.
  3. How would you predict the measurement distribution after applying a rotation gate with angle θ, using the Bloch-sphere picture?

Key Points

  1. 1

    A qubit isn’t treated as a fixed 0 or 1 before measurement; its Bloch-vector position encodes probabilities for both outcomes.

  2. 2

    Gates are modeled as transformations of the Bloch vector—often rotations—so predicting outcomes starts with tracking vector movement.

  3. 3

    Hadamard creates superposition, producing roughly equal measurement probabilities for 0 and 1 in the single-qubit case.

  4. 4

    CNOT introduces entanglement, making joint measurement outcomes correlated rather than independent 50/50 combinations.

  5. 5

    Controlled-controlled operations (Toffoli-style behavior) extend conditional logic to a third qubit, shaping its distribution based on two controls.

  6. 6

    Rotation gates with different angles (e.g., π, π/2, π/4) produce intermediate Bloch states and nontrivial histograms.

  7. 7

    Bit ordering in Bloch-sphere/histogram visualizations may appear reversed, so verifying qubit-to-classical-bit mapping via targeted measurements is important.

Highlights

The Bloch sphere turns gate effects into geometry: applying a gate rotates the Bloch vector, and measurement collapses it to 0 or 1 with probabilities set by that position.
CNOT doesn’t just “flip sometimes”—it entangles qubits, which shows up as fewer joint outcomes than independent 50/50 behavior would predict.
Rotation gates provide a unifying view: NOT (X) behaves like a rotation, and changing θ moves the vector to new probability distributions.
Controlled rotations can be built from simpler primitives (like CNOT plus single-qubit rotations), reinforcing that complex gates are composable building blocks.

Topics

Mentioned

  • Johnna Stat
  • Qiskit
  • CNOT
  • Hilbert
  • IBM
  • Google