Basic Concepts
of Quantum Computing
Introduction to the fundamental ideas of quantum mechanics and quantum computing, with a focus on the postulates of quantum mechanics, the qubit, measurement, and quantum gates.
Postulates of Quantum Mechanics
Quantum mechanics is built on three fundamental postulates that tell us how to describe a physical system, how to measure it, and how it evolves over time.
Postulate 1 β State of the system
In practice for a qubit: the space is βΒ², and the state is a column vector (Ξ±, Ξ²)α΅ with |Ξ±|Β²+|Ξ²|Β² = 1. Nothing more exotic than a normalized vector!
Postulate 2 β Measurement
First the simple version, then the formal one.
With the system in state |Οβ©, the probability of obtaining Ξ»β is:
This postulate is dense β let's tackle it piece by piece with three questions:
Only the eigenvalues of L. If L = Z has eigenvalues +1 and β1, you will never get 0, 0.7, or a complex number β only "+1" or "β1". The eigenvalues are the "menu" of possible outcomes.
Why real? Because L is Hermitian β eigenvalues always real β the results on the instrument are real numbers. If L were not Hermitian, you would get complex numbers on a display, which makes no physical sense.
P(Ξ»β) = |β¨uβ|Οβ©|Β² β the squared modulus of the inner product between state |Οβ© and eigenvector |uββ©.
Geometric intuition: β¨uβ|Οβ© measures how much |Οβ© "points in the same direction" as |uββ©. If |Οβ© = |uββ© exactly, the projection is 1 β P = 1 (certainty). If they are orthogonal, the projection is 0 β P = 0 (impossible).
The state collapses to |uββ©. The superposition disappears: the system "chooses" an eigenvector and stays there. If you measure again immediately with the same observable, you get Ξ»β again with P = 1 β because |Ο_afterβ© = |uββ© is already an eigenvector.
Important: measuring changes the state. You are not just "reading" β you are interacting.
Step-by-step example: measuring with Z
Let us follow the three steps of the postulate with L = Z and state |Οβ© = Ξ±|0β© + Ξ²|1β©.
eigenvalues
| 1 | 0 |
| 0 | β1 |
Possible outcomes: only "+1" or "β1"
Works for any diagonal matrix: diag(a, b) has eigenvalues a and b β just read them.
eigenvectors
|uββ© = |1β© = (0, 1)α΅ for Ξ»β = β1
probabilities
P("β1") = |β¨1|Οβ©|Β² = |Ξ±*Β·0 + Ξ²*Β·1|Β² = |Ξ²|Β²
Check: |Ξ±|Β² + |Ξ²|Β² = 1 β (probabilities sum to 1)
collapse
If "β1" β state becomes |1β©
Measuring again immediately gives the same result with P=1
Example 2: what if the state is already an eigenvector?
What happens if we measure Z on the qubit |Οβ© = |0β©? Intuitively: we are already "on" |0β©, so the outcome should be certain.
Example 3: measuring Z on a balanced superposition
What happens with |Οβ© = |+β© = (|0β© + |1β©)/β2? This state is "exactly halfway" between |0β© and |1β©.
Quick tricks for finding eigenvalues
Given a diagonal matrix:
| a | 0 |
| 0 | b |
| 1 |
| 0 |
| a |
| 0 |
| 1 |
| 0 |
| a | 0 |
| 0 | b |
| 0 |
| 1 |
| 0 |
| b |
| 0 |
| 1 |
Why? A diagonal matrix does not "mix" the components β it multiplies each one by its coefficient, leaving it in its direction.
Example: Z β (Ξ»=+1, |0β©) e (Ξ»=β1, |1β©) | S β (Ξ»=1, |0β©) e (Ξ»=j, |1β©) | T β (Ξ»=1, |0β©) e (Ξ»=ejΟ/4, |1β©)
Proof: L|uβ© = Ξ»|uβ© β LΒ²|uβ© = λ²|uβ© = |uβ© β λ² = 1 β Ξ» = Β±1.
Works for X, Y, Z, H and any Pauli β no determinant to calculate.
For a 2Γ2 matrix with eigenvalues Ξ»β and Ξ»β:
β Ξ»β+Ξ»β = 0 and Ξ»βΒ·Ξ»β = β1 β eigenvalues are +1 and β1. (Again: just sum and product, no equation to solve.)
This is the foundation of the quantum random number generator (QRNG): prepare |+β©, measure, get 0 or 1 with probability exactly 1/2 β and the randomness is fundamental, not due to ignorance.
Postulate 3 β Time evolution
A key property: if U is unitary and |Οβ©, |Οβ© are orthogonal, then U|Οβ© and U|Οβ© are still orthogonal. Unitary transformations preserve distances.
Given L = X = ((0,1),(1,0)), what are the possible outcomes if we use X as an observable?
Remember: possible outcomes = eigenvalues of L.
Given |Οβ© = Ξ±|0β© + Ξ²|1β© and L = X with eigenvectors |+β© = (1/β2)(1,1)α΅ and |ββ© = (1/β2)(1,β1)α΅, what is P("+1")?
The Pauli Matrices
The Pauli matrices are the three most important 2Γ2 matrices in quantum computing. They appear everywhere: as observables for measuring, as gates for transforming, and as building blocks for any qubit operation.
| 0 | 1 |
| 1 | 0 |
| 0 | βj |
| j | 0 |
| 1 | 0 |
| 0 | β1 |
This means the same matrix can do two things depending on how you use it:
The eigenvectors of each
Each one has a pair of orthogonal eigenvectors with eigenvalues +1 and β1. These eigenvectors define the measurement basis β the possible states the system can collapse into.
Z is diagonal β eigenvectors are |0β© and |1β© by trick A β zero calculations
X is not diagonal β eigenvectors are "tilted" relative to |0β© and |1β©
Like X but with complex coefficients
What does "measuring in a basis" mean
When we say "measuring in basis {|0β©,|1β©}" or "measuring in basis {|+β©,|ββ©}", we are specifying which states the system can collapse into β not the numbers we read.
Direct comparison: same state, different bases
Start from the same state |Οβ© = |+β© = (|0β©+|1β©)/β2 and measure first with Z, then with X:
The chosen basis determines how much you "resolve" the superposition.
Geometric visualization
Measuring in a basis is like projecting the state vector onto the axes of the chosen basis. The probability of each outcome is the square of that projection.
If the state is already aligned with a basis axis β P = 1 (certainty). If it is at 45Β° β P = 1/2 (maximum uncertainty).
Summary: the three Pauli bases
The Qubit
A qubit is the simplest quantum physical system: when measured, it gives one of two possible outcomes (e.g. spin up/down, horizontal/vertical polarization).
| Ξ± |
| Ξ² |
Global phase β changes nothing
Two states |Οβ© and ejΟ|Οβ© are physically indistinguishable. The global phase does not change any measurable probability:
Bloch representation
Using the fact that the global phase is irrelevant, we can write every qubit as:
Orthogonal state β quick trick
|Οβ© = Ξ²*|0β© β Ξ±*|1β©
No need to solve any linear system!
Given |Οβ© = (1/β2)|0β© + (j/β2)|1β© and |Οβ© = |1β©, calculate β¨Ο|Οβ©.
Remember: the bra β¨Ο| = conjugate transpose of |Οβ©.
Find |Οβ© orthogonal to |Οβ© = (1/β2)|0β© + (j/β2)|1β© using the quick trick.
Measuring a Qubit
Measuring a qubit in the computational basis {|0β©, |1β©} means applying the observable Lz = Z. The quantum circuit is drawn as:
Global phase β changes nothing
If |Ο'β© = ejΟ|Οβ©, then:
Relative phase β changes everything
|+β© = (|0β©+|1β©)/β2 and |ββ© = (|0β©β|1β©)/β2 give the same results when measured in the {|0β©,|1β©} basis (P("0")=P("1")=1/2 for both). But they are distinguishable when measured in the {|+β©,|ββ©} basis!
Given |Οβ© = (β3/2)|0β© + (1/2)|1β©, what is the probability of getting "1"?
|Οβ© = (1/β2)|0β© + (1/β2)|1β© and |Ο'β© = (1/β2)|0β© β (1/β2)|1β©. When measured in the {|0β©,|1β©} basis, do they give the same distribution? (yes/no)
Transforming a Qubit
Quantum transformations on a qubit are represented by 2Γ2 unitary matrices. The most important are the Pauli matrices:
| 1 | 0 |
| 0 | 1 |
| 0 | 1 |
| 1 | 0 |
| 1 | 0 |
| 0 | β1 |
| 0 | βj |
| j | 0 |
Effect of each gate
Hadamard Gate
| 1 | 1 |
| 1 | β1 |
Hadamard is fundamental in almost all quantum algorithms for creating superposition. It also has a remarkable property:
Putting H before and after a gate "changes" it to the opposite axis. In formulas:
| 1 | 1 |
| 1 | β1 |
| 0 | 1 |
| 1 | 0 |
| 1 | 1 |
| 1 | β1 |
| 1 | 0 |
| 0 | β1 |
Given |Οβ© = (3/5)|0β© + (4/5)|1β©, calculate X|Οβ©.
Calculate H|1β©. What state do you get? Write the result as a combination of |0β© and |1β©.
Quantum Gates β Complete Catalogue
Each gate is presented with three pieces of information: the matrix, the visual effect on the Bloch sphere, and how it appears and is used in circuits.
Single-qubit Pauli gates
The three Pauli gates X, Y, Z are both unitary and Hermitian β they act as gates (transformations) and as observables (measurements).
| 0 | 1 |
| 1 | 0 |
XΒ² = I eigenvalues: Β±1β’ |0β© β |1β© and |1β© β |0β©: swaps the poles
β’ |+β© β |+β© and |ββ© β |ββ©: equator points fixed
The quantum analogue of a classical NOT gate.
| 1 | 0 |
| 0 | β1 |
ZΒ² = I eigenvalues: Β±1Z = SΒ² = Tβ΄β’ |0β© β |0β©: north pole fixed (eigenvector, Ξ»=+1)
β’ |1β© β β|1β©: south pole gains phase β1 (Ξ»=β1)
β’ |+β© β |ββ©: swaps the equator states
Diagonal matrix β eigenvalues and eigenvectors readable at a glance.
| 0 | βj |
| j | 0 |
YΒ² = I Y = iXZeigenvalues: Β±1
β’ |0β© β j|1β© and |1β© β βj|0β©
β’ Combines bit-flip (like X) with phase-flip (like Z)
β’ Eigenstates: |+jβ© = (|0β©+j|1β©)/β2 (Ξ»=+1) and |βjβ© (Ξ»=β1)
The only Pauli with purely imaginary off-diagonal entries.
| 1 | 1 |
| 1 | β1 |
HΒ² = I HXH = Z HZH = Xβ’ |0β© β |+β©: the north pole goes to the equator (east)
β’ |1β© β |ββ©: the south pole goes to the equator (west)
β’ Swaps the Z β X axes on the sphere
Used to create superposition from a classical state.
| 1 | 0 |
| 0 | j |
SΒ² = Zβ’ |0β© β |0β©: north pole fixed (eigenvector)
β’ |1β© β j|1β©: south pole gains phase j (β‘ 90Β° rotation)
β’ |+β© β |+jβ©: (1,1)/β2 becomes (1,j)/β2
Moves points on the equator a quarter turn eastward.
| 1 | 0 |
| 0 | ejΟ/4 |
TΒ² = S Tβ΄ = Z TβΈ = Iβ’ |0β© β |0β©: north pole fixed
β’ |1β© β ejΟ/4|1β©: phase of Ο/4 (45Β°)
β’ Half of S, which is half of Z
The "smallest" rotation gate in the Z family.
| 1+j | 1βj |
| 1βj | 1+j |
(βX)Β² = Xβ’ |0β© β (|0β© β j|1β©)/β2: halfway towards |1β©
β’ Applied twice: |0β© β X|0β© = |1β© (complete NOT)
How to do half a NOT β the state is "halfway" between |0β© and |1β©.
Rotation Gates Rx, Ry, Rz
The rotation gates are the continuous version of the Pauli gates: they rotate the state on the Bloch sphere by any angle ΞΈ around a chosen axis.
| eβjΞΈ/2 | 0 |
| 0 | ejΞΈ/2 |
β’ Never changes the measurement probability in the Z basis (|Ξ±|Β² and |Ξ²|Β² remain unchanged)
β’ Only changes the relative phase between |0β© and |1β©
Imagine a globe rotating: latitude unchanged, longitude changes.
| cos ΞΈ/2 | βj sin ΞΈ/2 |
| βj sin ΞΈ/2 | cos ΞΈ/2 |
β’ ΞΈ=Ο/2: |0β© β (|0β© β j|1β©)/β2
β’ ΞΈ=Ο: |0β© β |1β© (i.e. gate X!)
Mixes the |0β© and |1β© components, changing the measurement probabilities.
| cos ΞΈ/2 | βsin ΞΈ/2 |
| sin ΞΈ/2 | cos ΞΈ/2 |
β’ ΞΈ=Ο/2: |0β© β (|0β©+|1β©)/β2 = |+β© (like H but without phases)
β’ ΞΈ=Ο: |0β© β |1β©
β’ It is the only rotation that keeps amplitudes real if you start from a real vector
Used when you want to mix |0β© and |1β© without introducing complex phases.
Rotation axes β visual summary
Each gate rotates the Bloch sphere around a fixed axis. The coloured axis line and circular arrow show exactly which axis and which direction.
Interactive: choose a gate
Relationships between Paulis
Calculate HZH by multiplying the three matrices (you can do it step by step: first ZH, then HΒ·(ZH)).
Expected result: the matrix X = ((0,1),(1,0)).
Calculate S|+β© where |+β© = (1/β2)(1,1)α΅. Write the result as a vector.
Basis Change
Given two orthonormal bases {|0β©,|1β©,...,|Nβ1β©} and {|vββ©,|vββ©,...,|vNβ1β©}, there exists a unitary operator U that maps one basis to the other:
Example: from {|0β©,|1β©} to {|+β©,|ββ©}
| 1 |
| 1 |
| 1 |
| β1 |
| 1 | 0 |
| 1 | 0 |
| 0 | 1 |
| 0 | β1 |
| 1 | 1 |
| 1 | β1 |
Checking that U is unitary
Decomposition in the new basis
The components in the new basis are computed as inner products with the new basis vectors.
Given |Οβ© = |0β©, write its components in the basis {|+β©, |ββ©}, i.e. find cβ and cβ such that |0β© = cβ|+β© + cβ|ββ©.
U = H maps |0β©β|+β© and |1β©β|ββ©. Which matrix maps in the opposite direction, i.e. |+β©β|0β© and |ββ©β|1β©?
Measurement in an Arbitrary Basis
In the lab, we can usually only measure in the computational basis {|0β©,|1β©}. How do we measure in a different basis, e.g. {|+β©,|ββ©}?
1. Apply U (which maps |vββ© β |ββ©) to obtain |Ο'β© = U|Οβ©
2. Measure |Ο'β© in the computational basis {|0β©,|1β©}
3. The outcome "β" corresponds to result |vββ© in the original system
Example: measuring in the basis {|+β©, |ββ©}
The circuit is very simple: a single H gate before the measurement:
General case: measuring in the eigenvector basis of L = (Z+X)/β2
From the notes: L = (Z+X)/β2 = H (Hadamard). The eigenvalues are Β±1 (trick: LΒ² = I β Ξ» = Β±1) and the eigenvectors are:
| cos Ο/8 |
| sin Ο/8 |
| sin Ο/8 |
| βcos Ο/8 |
Circuit for measuring in the basis {|uββ©, |uββ©}
The basis change matrix U = |0β©β¨uβ| + |1β©β¨uβ| turns out to be U = Ry(Ο/4)Β·Z, so the circuit is:
Given |Οβ© = Ξ±|0β© + Ξ²|1β©, calculate P("+") = |β¨+|Οβ©|Β².
Check that XΒ² = I, then use this to immediately conclude the eigenvalues of X.
Tricks & Summary
If L is Hermitian and LΒ² = I, then Ξ» = Β±1 without any calculation. Works for X, Y, Z, H and any unitary combination of Paulis.
H "swaps" the X and Z axes of the Bloch sphere. Use it to transform a problem with X into one with Z (easier because Z is diagonal).
If you have ejΟ|Οβ© in front of something, immediately drop the ejΟ factor β it does not change any probability and greatly simplifies the calculation.
Given Ξ±|0β© + Ξ²|1β©, the orthogonal state is Ξ²*|0β© β Ξ±*|1β©. No system to solve.
Build the matrix U = Ξ£β |ββ©β¨vβ|, apply it before the standard measurement. For {|+β©,|ββ©} a single H gate suffices.
The phase gate hierarchy. Useful for simplifying gate sequences: SΒ·S = Z, TΒ·T = S, etc.