Qubits and Gates - Quantum Computer Programming w/ Qiskit p.2
Based on sentdex's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.
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?
How does the Bloch sphere turn “probability” into something you can visualize?
What’s the difference between applying Hadamard and applying CNOT, in terms of what you see and what you measure?
In a two-qubit example, why might “50% then 50%” not produce four equally likely joint outcomes?
How do rotation gates relate to gates like NOT (X), and what does changing the rotation angle do?
Why does the tutorial repeatedly question whether the plotted qubit labels are reversed?
Review Questions
- If a qubit’s Bloch vector points exactly at the 0 pole, what measurement outcome should occur and why?
- Describe how CNOT changes the relationship between two qubits’ measurement outcomes compared with two independent Hadamard-prepared qubits.
- How would you predict the measurement distribution after applying a rotation gate with angle θ, using the Bloch-sphere picture?
Key Points
- 1
A qubit isn’t treated as a fixed 0 or 1 before measurement; its Bloch-vector position encodes probabilities for both outcomes.
- 2
Gates are modeled as transformations of the Bloch vector—often rotations—so predicting outcomes starts with tracking vector movement.
- 3
Hadamard creates superposition, producing roughly equal measurement probabilities for 0 and 1 in the single-qubit case.
- 4
CNOT introduces entanglement, making joint measurement outcomes correlated rather than independent 50/50 combinations.
- 5
Controlled-controlled operations (Toffoli-style behavior) extend conditional logic to a third qubit, shaping its distribution based on two controls.
- 6
Rotation gates with different angles (e.g., π, π/2, π/4) produce intermediate Bloch states and nontrivial histograms.
- 7
Bit ordering in Bloch-sphere/histogram visualizations may appear reversed, so verifying qubit-to-classical-bit mapping via targeted measurements is important.