Lesson 51 · 90 min · advanced
Noise, Decoherence, $T_1$ and $T_2$
A real qubit is never isolated: it exchanges energy and information with its surroundings, and its state evolves by a quantum channel rather than a unitary. This lesson derives the Kraus representation from a unitary interaction with an environment (Stinespring dilation), proves that every Kraus map is completely positive and trace preserving, and derives from explicit environment models the three channels that dominate NISQ hardware: amplitude damping (energy relaxation, ), phase damping (pure dephasing) and the depolarizing channel. It turns them into Bloch-vector dynamics, and with , which forces , and it computes exactly how local depolarizing noise degrades a Bell pair, with .
Prerequisites: Density Operators: Pure vs Mixed, The Bloch Sphere
Objectives and key results
Derive the Kraus form , , of a system that interacts unitarily with an environment, prove from , and prove that every Kraus map with this completeness relation is completely positive and trace preserving.
Derive the amplitude-damping channel from an excitation-exchanging interaction, compute its action on an arbitrary , and connect it to the decay law through and the semigroup law .
Derive phase damping from a controlled rotation of the environment, show that it only multiplies coherences by , and prove its equivalence with the phase-flip channel by the unitary freedom of Kraus operators.
Translate the channels into Bloch-vector dynamics, define , and , prove , and construct the thermal-relaxation channel used by the simulator.
Derive the depolarizing channel from the identity , convert between the PennyLane and Qiskit parametrisations, and recognise that different channels can agree on one input state.
Compute the fidelity and the entanglement of a Bell pair after local depolarizing noise exactly, and simulate noisy circuits with the density-matrix backend.
- theorem · Stinespring dilation and Kraus operators
- formula · Amplitude damping
- formula · Bloch-vector relaxation
- identity · Pauli twirl and the depolarizing channel
- formula · Bell pair under local depolarizing noise
Open systems and quantum channels#
Every circuit so far was a sequence of unitaries acting on an isolated register. Physical qubits are not isolated. A superconducting transmon couples to the electromagnetic modes of its readout resonator and to two-level defects in its substrate, and a trapped ion scatters photons from stray light. Each such coupling correlates the qubit with degrees of freedom that we neither control nor measure. Once the qubit is entangled with them, its own state is the reduced density matrix obtained by tracing them out, and it is in general mixed, even if the joint evolution is unitary. This loss of coherence to an unobserved environment is decoherence. On noisy intermediate-scale (NISQ) hardware it limits the depth of every circuit, including the variational circuits of the previous modules. A model whose expressive layers need more time than the coherence time of the device produces outputs close to the maximally mixed state, whatever its parameters.
The mathematical object that replaces the unitary is the quantum channel. We first characterise channels abstractly, then derive their Kraus form from a unitary model of system plus environment, and finally build the three channels that describe most hardware noise.
Definition
Quantum channel (CPTP map) and Kraus representation
A linear map from operators on to operators on is a quantum channel if it is
- trace preserving: for every operator , and
- completely positive: for every ancilla dimension the extended map sends positive semidefinite operators on to positive semidefinite operators.
A channel in Kraus form is with matrices , the Kraus operators, satisfying the completeness relation . A unitary gate is the special case of a single Kraus operator . Complete positivity, rather than positivity alone, is required because the qubit may be entangled with other qubits that the channel does not touch: the joint state must remain a valid density matrix.
From a unitary on system and environment to Kraus operators
Let a system with Hilbert space interact with an environment with orthonormal basis through a unitary on , with the environment initially in . Then the reduced evolution of the system is
the matrix elements of the Kraus operators are , and they satisfy .
Proof (7 steps)
- Step 1:Definition of the partial trace over in the orthonormal basis ; here is the isometry from to .
- Step 2:Both sides send to , and product vectors span the space.
- Step 3:Insert the second line into the first; the right factor is the adjoint of because .
- Step 4:Matrix elements in the product basis : the Kraus operator is the block of with environment output and environment input .
- Step 5:Matrix product , then the previous line; the double sum over and runs over all rows of .
- Step 6:, the sum is the matrix product of and , and .
- Step 7:The previous line holds for all ; trace preservation then follows from the cyclicity of the trace.
∎
Every Kraus map is completely positive and trace preserving
If , then is trace preserving and completely positive. Consequently it maps density matrices to density matrices, also when it acts on one part of an entangled state.
Proof (5 steps)
- Step 1:Linearity and cyclicity of the trace, then the completeness relation; this holds for every operator , not only for density matrices.
- Step 2:Definition of the extended map on product operators, and .
- Step 3:Product operators span all operators on and both sides are linear in .
- Step 4:For each term is positive semidefinite: its expectation value in any vector is an expectation value of .
- Step 5:A sum of positive semidefinite operators is positive semidefinite, and was arbitrary: is completely positive.
∎
Quick check
Which of these sets of single-qubit operators is a valid Kraus set of a quantum channel?
Amplitude damping and energy relaxation#
The excited state of a qubit has a higher energy than the ground state . At low temperature the qubit can lose this energy to its environment (by emitting a photon into a transmission line, or a phonon into the substrate) but practically never gains it back. Model the environment as a second two-level system that starts in its ground state . The interaction conserves the total number of excitations: has none and stays unchanged, while the one excitation of is transferred to the environment with probability ,
These two columns extend to a unitary by rotating the one-excitation subspace by the angle with , like a beam splitter of transmissivity . The matrix below is this for , in the basis with the system first. The two columns we fixed are the first and the third.
Unitary verified: (max deviation 0.0e+0)
Kraus operators and action of amplitude damping
- Step 1:Kraus operator of the dilation theorem, evaluated on the two basis states with the defining columns of .
- Step 2:A linear map is determined by its action on a basis.
- Step 3:Same computation for environment outcome : only the decay branch leaves an excitation in the environment.
- Step 4:Completeness, as guaranteed by the dilation theorem: .
- Step 5:For a diagonal the entries are with , ; and .
- Step 6:Sum of the two terms. The fraction of the excited population moves to ; the coherence shrinks by , not by .
Result
The parameter is a probability per idle period. Experiments instead report a rate. If the qubit is prepared in and left alone, the probability of still finding it excited decays exponentially, , where is the energy-relaxation time. Microscopically the exponential law follows from a weak, memoryless (Markovian) coupling to a broadband environment: in every short interval the excited population decays with probability , independently of the past. The next theorem shows that this is exactly what a family of amplitude-damping channels with a time-dependent describes.
Energy relaxation: γ(t) = 1 − e^{−t/T₁} and the semigroup law
Suppose the excited population of an idling qubit obeys . Then idling for a time is the amplitude-damping channel with . Moreover with , so that , and coherences decay as .
Proof (7 steps)
- Step 1:Integrating factor for the linear equation .
- Step 2:Match the channel's action on the excited population with the solution of the rate equation for every initial .
- Step 3:Apply the action of amplitude damping twice; each step multiplies the excited population by and the coherence by .
- Step 4:The second channel adds times the excited population left by the first; expand .
- Step 5:The three entries are those of , since for nonnegative factors.
- Step 6:Insert : two idle periods compose to one idle period of the total length, the semigroup property of a Markovian process.
- Step 7:Coherence factor of the channel with inserted: energy relaxation alone destroys coherence at half the population rate.
∎
For example, a qubit with prepared in and left idle for undergoes amplitude damping with . It is found in with probability , and a superposition prepared at the start would keep the fraction of its coherence. The semigroup law also shows that the order of slicing does not matter: a circuit that idles in two pieces of suffers exactly the damping of one idle period of .
Quick check
A qubit with is prepared in . After how many microseconds of idling has the probability of measuring dropped to ?
Pure dephasing and phase flips#
Energy exchange is not the only way to lose coherence. Suppose the qubit scatters an environmental particle elastically, without exchanging energy, but the scattered particle ends up in a state that depends on whether the qubit was in or in . The populations then stay the same, but the environment now carries partial which-state information, and the superposition between and decays. The simplest model is a controlled rotation of an environment qubit:
with and . On the platform this is the gate with the system on qubit and the environment on qubit . Fluctuations of the qubit frequency, for instance from flux noise in a transmon, have the same effect: they add a random phase to relative to , and averaging over the unknown phase damps the off-diagonal entries.
Kraus operators and action of phase damping
- Step 1:is block diagonal in the system basis with unitary blocks and , and the cross terms vanish because .
- Step 2:Kraus operator for environment outcome , with .
- Step 3:Environment outcome : only the branch in which the system is rotates the environment.
- Step 4:Completeness, as required by the dilation theorem.
- Step 5:Both Kraus operators are diagonal, so with and .
- Step 6:Sum of the two terms: , so the populations are unchanged and only the coherence is multiplied by .
- Step 7:Interpretation: , whose reduced coherence is . The more distinguishable the environment states, the smaller the coherence; orthogonal states () erase it.
Result
Circuit · 2 qubits
The dilation of phase damping with : the system qubit is put into by , and with rotates the environment qubit only in the branch . The joint state is pure, , but tracing out qubit leaves the system in , exactly the output of on and the target of the lab.
Phase flip = phase damping (unitary freedom of Kraus operators)
(i) If two Kraus sets are related by a unitary matrix , , they define the same channel. (ii) For the phase-flip channel , with Kraus operators , equals phase damping with , i.e. , and the two Kraus sets are related by the real orthogonal matrix .
Proof (5 steps)
- Step 1:Expand and ; because is unitary. This proves (i).
- Step 2:Conjugation by flips the sign of the off-diagonal entries; then add the two terms.
- Step 3:Comparison with the action of : both channels fix the populations and multiply the coherence by the same factor. The square root is nonnegative, which requires .
- Step 4:First row of applied to , (phase damping with ); the second entry is .
- Step 5:Second row of ; is real with orthonormal rows, so it is unitary, as (i) requires.
∎
Quick check
A phase-flip channel applies with probability . Which phase-damping parameter describes the same channel?
Bloch-vector relaxation: T₁, T₂ and T_φ#
A qubit state is a point of the Bloch ball, with . In components, , and . The populations therefore encode the longitudinal component , and the coherence encodes the transverse components . Hardware characterisation uses exactly this split. An inversion-recovery experiment prepares , waits, and measures , which yields . A Ramsey experiment prepares , waits, and measures the decay of the transverse component, which yields . We now derive both laws from the channels and see why the two times cannot be chosen independently.
Bloch-vector dynamics under amplitude and phase damping
Under the Bloch vector transforms as and ; under as and . With and the combined evolution is
Proof (6 steps)
- Step 1:The Pauli expansion of a qubit density matrix written out entry by entry.
- Step 2:Amplitude damping maps ; solve for the new and rearrange.
- Step 3:Amplitude damping multiplies by the real factor ; compare real and imaginary parts.
- Step 4:Same reading of the phase-damping action.
- Step 5:Insert ; phase damping does not change . The fixed point is , the ground state .
- Step 6:The transverse factors of the two channels multiply; by the semigroup theorem; the exponents add, which defines .
∎
Amplitude and phase damping commute, and T₂ ≤ 2T₁
for all . For any pure-dephasing time the coherence time satisfies , with equality exactly when there is no pure dephasing (). Conversely, measured and determine the pure-dephasing rate .
Proof (5 steps)
- Step 1:Apply amplitude damping, then phase damping, which keeps the populations and rescales the coherence.
- Step 2:Phase damping first leaves the populations unchanged, and amplitude damping acts on the populations through alone; the coherence factors are the same numbers in the opposite order.
- Step 3:Definition of from the Bloch theorem; a dephasing rate cannot be negative because .
- Step 4:Take reciprocals of positive numbers, which reverses the inequality.
- Step 5:Solve the defining relation for the pure-dephasing rate; a measurement with would contradict the model and indicates a non-Markovian or miscalibrated experiment.
∎
The thermal-relaxation channel of the simulator
- Step 1:The engine's parameters for thermalRelaxation with : amplitude damping for the population decay, phase damping for the remaining coherence decay.
- Step 2:Products of the phase-damping Kraus operators and amplitude-damping Kraus operators (the Kraus set of a composition); .
- Step 3:The last product vanishes and is dropped, so the channel has three Kraus operators when and two when (then and too).
- Step 4:Completeness: .
- Step 5:Sum of the three conjugations: the excited population collects , the ground population gains , and the coherence decays with , exactly the Bloch laws.
Result
The widget starts from the default , and the equatorial state . Drag the time slider and watch the Bloch vector. It shrinks towards the -axis with the time constant and climbs towards the north pole with the time constant . The trajectory is not a straight line, because the two components decay at different rates. The implied pure-dephasing time is . The widget also applies the engine's thermal-relaxation Kraus set to and shows that it agrees with the formulas to machine precision. The next instance sets , the pure- limit, where no pure dephasing is left and the channel is plain amplitude damping.
In the last instance the coherence time is short, , and the qubit is detuned from the frame of the control electronics by rad per microsecond. In the rotating frame the Bloch vector now precesses about the -axis, , while it relaxes. The measured is a damped oscillation : the Ramsey fringe from which experiments read off both the detuning and .
Quick check
A qubit has and . What is its pure-dephasing time in microseconds?
The depolarizing channel#
Amplitude and phase damping have a preferred axis, set by the energy eigenbasis. Gate errors in a long, compiled circuit are often modelled with no preferred direction: after each gate one of the three Pauli errors , , occurs with probability each. This is the depolarizing channel in the convention of PennyLane's DepolarizingChannel and of the platform's engine,
Completeness is immediate, since every Pauli matrix squares to the identity: . To see what the channel does geometrically, we need one identity about Pauli conjugations.
Pauli twirl: Σ_P PAP = 2 Tr(A) I
For every complex matrix , . Equivalently, averaging the conjugations of by the four Pauli matrices gives .
Proof (5 steps)
- Step 1:An arbitrary complex matrix.
- Step 2:Left multiplication by swaps the rows, right multiplication swaps the columns.
- Step 3:Direct multiplication with , using and .
- Step 4:Conjugation by flips the sign of the off-diagonal entries.
- Step 5:Add the four matrices entry by entry: the off-diagonal entries cancel in pairs.
∎
The depolarizing channel shrinks the Bloch vector by 1 − 4p/3
- Step 1:The Pauli-twirl lemma with , minus the term ; .
- Step 2:Substitute into the Kraus form and collect the terms in : .
- Step 3:Insert the Bloch form: the identity part is preserved and every Bloch component is multiplied by the same factor, so the ball shrinks uniformly towards its centre.
- Step 4:Qiskit's depolarizing_error with parameter mixes with the maximally mixed state with weight ; equate the coefficients of . The same physical error has , e.g. is .
- Step 5:At the factor vanishes and every input is mapped to the maximally mixed state (complete depolarisation). For the factor is negative: the channel is still completely positive (it has a Kraus form), but it inverts the Bloch vector while shrinking it.
Result
Different channels, same output. Take the input , with and . Phase damping with multiplies the coherence by . Depolarizing with multiplies the whole Bloch vector by . Both therefore output the same state,
The two channels are nevertheless different, because they treat the -axis differently. On phase damping does nothing, , whereas depolarizing shrinks from to , . As maps of the Bloch ball, scales the axes by and by , so they agree exactly on the equatorial plane. A channel on a qubit is a linear map on a four-dimensional space of operators. One input state fixes only part of it, and identifying a channel (process tomography) requires inputs whose density matrices span all operators, for instance , , and . The lab asks you to prepare this state, and both routes are accepted.
Quick check
Phase damping with and depolarizing with give the same output on . On which of these inputs do their outputs differ?
Noisy entanglement: the Bell-state fidelity#
Entangled states are the resource behind teleportation, superdense coding and the entangling layers of variational circuits, and they are especially fragile. We compute exactly what happens when both qubits of the Bell pair independently undergo depolarizing noise of strength , for example while they wait for the next layer of a circuit. The computation is clean in the Pauli basis, because the depolarizing channel acts on Pauli operators by plain multiplication. The local channel has the Kraus operators ; on the platform it is the circuit , followed by and .
Pauli expansion of the Bell projector
.
Proof (5 steps)
- Step 1:Expand the outer product in the basis .
- Step 2:.
- Step 3:and , so the phases are , and .
- Step 4:On the pair the matrix elements are ; on the pair they are .
- Step 5:Add the two previous results and compare with the first line.
∎
Bell pair under local depolarizing noise
Let . Then
with diagonal and corner entries , and the fidelity with the ideal pair is . For : and .
Proof (8 steps)
- Step 1:The operator form of the depolarizing derivation, with and .
- Step 2:The Kraus operators of the product channel are ; the double sum factorises.
- Step 3:Each non-identity factor contributes one factor .
- Step 4:Linearity applied to the Pauli expansion of the Bell projector; regroup the identity term.
- Step 5:The lemma again: the noisy pair is a mixture of the ideal pair and white noise, a Werner state with weight .
- Step 6:Read off the entries from times the Bell matrix plus on the diagonal.
- Step 7:, so only the four diagonal pairs survive: ; note for .
- Step 8:Exact arithmetic. Each qubit alone keeps the fidelity with its own pure input, but the pair loses more, because the correlations decay with .
∎
When does the noisy Bell pair stay entangled?
The Werner state is entangled if and only if , equivalently . Under local depolarizing noise , so the pair stays entangled exactly for .
Proof (7 steps)
- Step 1:Partial transpose on the second qubit; maps to .
- Step 2:has eigenvalue on the symmetric states and on the singlet ; .
- Step 3:Peres criterion: a separable state has a positive semidefinite partial transpose, since is again a density matrix. Hence , where , implies entanglement.
- Step 4:Converse at : regroup the Pauli expansion into three terms.
- Step 5:Each term is a mixture of product states: e.g. , and the cross terms cancel in the average; likewise with the eigenstates , for which and average to .
- Step 6:A convex combination of the separable and the product state is separable: .
- Step 7:Insert , , and solve; for , , so the pair is still entangled (the partial transpose has the eigenvalue ).
∎
The same Pauli-basis argument scales to deep circuits. If every layer is followed by depolarizing noise of strength on each qubit, a -local Pauli observable measured after layers is multiplied by roughly . Expectation values, and with them the gradients of a variational circuit, are pulled towards zero exponentially in the depth: a noise-induced barren plateau, which no choice of initial parameters can avoid. The next lesson turns this predictable damping into a resource. Zero-noise extrapolation measures the damped values at amplified noise levels and extrapolates back to zero noise.
Noisy circuits on the platform#
In a platform circuit, noise channels are operations of their own. In the circuit IR a channel op is written , with the channel names amplitudeDamping , phaseDamping , depolarizing , bitFlip , phaseFlip and thermalRelaxation . In the lab circuit script the same channels are statements with the qubit first, for example . Any circuit that contains a channel is simulated exactly on the density-matrix backend, which stores the full matrix and applies each Kraus set with . This limits noisy simulation to qubits, against for pure statevectors.
The TypeScript cell below runs four experiments on the engine. (1) It shows that followed by phase damping and followed by depolarizing give the same state, and that the two channels differ on . (2) It checks the semigroup law: idling and then equals idling . (3) It relaxes , with , under thermal relaxation with , , and compares the Bloch vector with the two exponential laws in parentheses. (4) It prepares the noisy Bell pair with and prints its density matrix and fidelity.
import { DensityMatrix, amplitudeDamping, blochVector, runCircuit } from '@/lib/quantum-simulator';
// Circuit-IR helpers: a gate op and a noise-channel op (channels run on the density-matrix backend).
const gate = (name: string, targets: number[], params?: number[]) => ({ kind: 'gate', gate: name, targets, ...(params ? { params } : {}) });
const channel = (name: string, target: number, params: number[]) => ({ kind: 'channel', channel: name, targets: [target], params });
const run = (numQubits: number, ops: object[]) =>
new DensityMatrix(numQubits, runCircuit({ version: 1, numQubits, numClbits: 0, ops }, { backend: 'density', seed: 0 }).densityMatrix!);
const f6 = (v: number) => (Math.abs(v) < 5e-13 ? 0 : v).toFixed(6);
const show = (rho: DensityMatrix) =>
'[' + Array.from({ length: rho.dim }, (_, r) => '[' + Array.from({ length: rho.dim }, (_, c) => f6(rho.get(r, c).re)).join(', ') + ']').join(', ') + ']';
// (1) Same output on |+>, different channels: phase damping 0.64 and depolarizing 0.3. On |0> they differ.
console.log('H; phaseDamping(0.64) -> ' + show(run(1, [gate('H', [0]), channel('phaseDamping', 0, [0.64])])));
console.log('H; depolarizing(0.3) -> ' + show(run(1, [gate('H', [0]), channel('depolarizing', 0, [0.3])])));
console.log('|0>: phaseDamping(0.64) -> ' + show(run(1, [channel('phaseDamping', 0, [0.64])])) + ', depolarizing(0.3) -> ' + show(run(1, [channel('depolarizing', 0, [0.3])])));
// (2) Amplitude damping is a semigroup: idling 10 us then 20 us equals idling 30 us (T1 = 50 us).
const T1 = 50, T2 = 30;
const gammaOf = (t: number) => 1 - Math.exp(-t / T1);
const excited = () => run(1, [gate('X', [0])]);
const twoSteps = excited().applyKraus(amplitudeDamping(gammaOf(10)), [0]).applyKraus(amplitudeDamping(gammaOf(20)), [0]);
const oneStep = excited().applyKraus(amplitudeDamping(gammaOf(30)), [0]);
console.log('P(1) after 10 + 20 us = ' + f6(twoSteps.get(1, 1).re) + ', after 30 us = ' + f6(oneStep.get(1, 1).re) + ', e^{-30/50} = ' + f6(Math.exp(-30 / T1)));
// (3) thermalRelaxation(T1, T2, t) on RY(2 pi/3)|0>: the Bloch vector follows the T1 / T2 formulas exactly.
const r0 = blochVector(run(1, [gate('RY', [0], [(2 * Math.PI) / 3])]));
for (const t of [0, 10, 30, 60, 150]) {
const r = blochVector(run(1, [gate('RY', [0], [(2 * Math.PI) / 3]), channel('thermalRelaxation', 0, [T1, T2, t])]));
const rx = r0.x * Math.exp(-t / T2);
const rz = 1 - (1 - r0.z) * Math.exp(-t / T1);
console.log('t = ' + String(t).padStart(3) + ': r_x = ' + f6(r.x) + ' (' + f6(rx) + '), r_z = ' + f6(r.z) + ' (' + f6(rz) + ')');
}
// (4) Bell state with local depolarizing noise p = 0.1 on both qubits: F = (1 + 3 f^2)/4 with f = 1 - 4p/3.
const p = 0.1, f = 1 - (4 * p) / 3;
const noisyBell = run(2, [gate('H', [0]), gate('CNOT', [0, 1]), channel('depolarizing', 0, [p]), channel('depolarizing', 1, [p])]);
const F = 0.5 * (noisyBell.get(0, 0).re + noisyBell.get(0, 3).re + noisyBell.get(3, 0).re + noisyBell.get(3, 3).re);
console.log('rho = ' + show(noisyBell));
console.log('F = <Phi+|rho|Phi+> = ' + F.toFixed(12) + ', (1 + 3 f^2)/4 = ' + ((1 + 3 * f * f) / 4).toFixed(12) + ', purity = ' + f6(noisyBell.purity()));Expected output
H; phaseDamping(0.64) -> [[0.500000, 0.300000], [0.300000, 0.500000]]
H; depolarizing(0.3) -> [[0.500000, 0.300000], [0.300000, 0.500000]]
|0>: phaseDamping(0.64) -> [[1.000000, 0.000000], [0.000000, 0.000000]], depolarizing(0.3) -> [[0.800000, 0.000000], [0.000000, 0.200000]]
P(1) after 10 + 20 us = 0.548812, after 30 us = 0.548812, e^{-30/50} = 0.548812
t = 0: r_x = 0.866025 (0.866025), r_z = -0.500000 (-0.500000)
t = 10: r_x = 0.620534 (0.620534), r_z = -0.228096 (-0.228096)
t = 30: r_x = 0.318593 (0.318593), r_z = 0.176783 (0.176783)
t = 60: r_x = 0.117204 (0.117204), r_z = 0.548209 (0.548209)
t = 150: r_x = 0.005835 (0.005835), r_z = 0.925319 (0.925319)
rho = [[0.437778, 0.000000, 0.000000, 0.375556], [0.000000, 0.062222, 0.000000, 0.000000], [0.000000, 0.000000, 0.062222, 0.000000], [0.375556, 0.000000, 0.000000, 0.437778]]
F = <Phi+|rho|Phi+> = 0.813333333333, (1 + 3 f^2)/4 = 0.813333333333, purity = 0.673126The table shows the two time scales. The transverse component has fallen to after . The longitudinal component crosses zero when , i.e. at , and it is still below the ground state after . The NumPy cell below repeats the derivations of this lesson independently of the engine. It extracts the Kraus operators from the dilation by slicing its matrix, , and checks the reduced evolution against . It reproduces the relaxation table, checks the Pauli-twirl identity on a fixed non-Hermitian complex matrix and the shrink factors for , compares the two channels on and on , and evaluates the noisy Bell pair, including the negative eigenvalue of its partial transpose.
import numpy as np
I2 = np.eye(2, dtype=complex)
X = np.array([[0, 1], [1, 0]], dtype=complex)
Y = np.array([[0, -1j], [1j, 0]])
Z = np.diag([1.0 + 0j, -1.0])
def apply(kraus, rho):
return sum(K @ rho @ K.conj().T for K in kraus)
def complete(kraus):
return np.allclose(sum(K.conj().T @ K for K in kraus), np.eye(kraus[0].shape[0]), atol=1e-12)
def amp_damp(g):
return [np.diag([1, np.sqrt(1 - g)]).astype(complex), np.array([[0, np.sqrt(g)], [0, 0]], dtype=complex)]
def phase_damp(lam):
return [np.diag([1, np.sqrt(1 - lam)]).astype(complex), np.diag([0, np.sqrt(lam)]).astype(complex)]
def depolarizing(p):
return [np.sqrt(1 - p) * I2] + [np.sqrt(p / 3) * P for P in (X, Y, Z)]
def show(m):
m = np.where(np.abs(m) < 5e-13, 0, m)
cell = lambda z: f"{z.real:.6f}" if abs(z.imag) < 5e-13 else f"{z.real:.6f}{z.imag:+.6f}j"
return "[[" + "], [".join(", ".join(cell(z) for z in row) for row in m) + "]]"
# (1) Stinespring -> Kraus: K_k = <k|_E U |0>_E for the amplitude-damping unitary on (system, environment).
g = 0.36
c, s = np.sqrt(1 - g), np.sqrt(g)
U = np.array([[1, 0, 0, 0], [0, c, s, 0], [0, -s, c, 0], [0, 0, 0, 1]], dtype=complex) # basis |system env>
print("U unitary:", np.allclose(U.conj().T @ U, np.eye(4)))
K = [U.reshape(2, 2, 2, 2)[:, k, :, 0] for k in range(2)] # K_k[i, j] = <i k| U |j 0>
print("K_0 =", show(K[0]), " K_1 =", show(K[1]), " complete:", complete(K))
rho = np.array([[0.3, 0.2 - 0.1j], [0.2 + 0.1j, 0.7]])
dilated = U @ np.kron(rho, np.diag([1, 0])) @ U.conj().T
reduced = np.einsum("iaja->ij", dilated.reshape(2, 2, 2, 2)) # partial trace over the environment
print("Tr_E[U(rho x |0><0|)U+] =", show(reduced), " = sum_k K rho K+:", np.allclose(reduced, apply(K, rho)))
# (2)-(4) T1 / T2 relaxation of the Bloch vector of RY(2 pi / 3)|0>, r(0) = (sin 2pi/3, 0, cos 2pi/3).
T1, T2 = 50.0, 30.0
Tphi = 1 / (1 / T2 - 1 / (2 * T1))
print(f"T1 = {T1}, T2 = {T2}: T_phi = {Tphi:.6f}, 2*T1 = {2 * T1}")
th = 2 * np.pi / 3
psi = np.array([np.cos(th / 2), np.sin(th / 2)], dtype=complex)
rho0 = np.outer(psi, psi.conj())
bloch = lambda r: np.real([np.trace(r @ P) for P in (X, Y, Z)])
rx0, rz0 = bloch(rho0)[0], bloch(rho0)[2]
print(" t r_x r_z | r_x(0)e^{-t/T2} 1-(1-r_z(0))e^{-t/T1}")
for t in (0, 10, 30, 60, 150):
gamma, lam = 1 - np.exp(-t / T1), 1 - np.exp(-2 * t / Tphi)
r = bloch(apply(phase_damp(lam), apply(amp_damp(gamma), rho0)))
print(f"{t:4d} {r[0]:+.6f} {r[2]:+.6f} | {rx0 * np.exp(-t / T2):+.6f} {1 - (1 - rz0) * np.exp(-t / T1):+.6f}")
# Semigroup: idle periods of 10 us and 20 us compose to one of 30 us, since 1 - gamma = (1 - g1)(1 - g2).
g1, g2, g3 = (1 - np.exp(-t / T1) for t in (10, 20, 30))
r1 = apply(amp_damp(g2), apply(amp_damp(g1), rho0))
print(f"AD(g2) AD(g1) = AD(g): {np.allclose(r1, apply(amp_damp(g3), rho0))}, (1-g1)(1-g2) = {(1 - g1) * (1 - g2):.6f} = 1-g = {1 - g3:.6f}")
# (5) Depolarizing: sum_P P A P = 2 Tr(A) I for any 2x2 A, and the Bloch vector shrinks by 1 - 4p/3.
A = np.array([[1 + 2j, -0.5], [3j, 4 - 1j]])
print("sum_P P A P = 2 Tr(A) I:", np.allclose(sum(P @ A @ P for P in (I2, X, Y, Z)), 2 * np.trace(A) * I2))
for p in (0.3, 0.75, 1.0):
out = apply(depolarizing(p), rho)
print(f"p = {p:.2f}: r_out = {1 - 4 * p / 3:+.6f} * r_in:", np.allclose(bloch(out), (1 - 4 * p / 3) * bloch(rho)))
# Same output on |+>, different channels: phase damping 0.64 and depolarizing 0.3; they differ on |0>.
plus = np.full((2, 2), 0.5, dtype=complex)
zero = np.diag([1, 0]).astype(complex)
print("|+>: PD(0.64) ->", show(apply(phase_damp(0.64), plus)), " DEP(0.3) ->", show(apply(depolarizing(0.3), plus)))
print("|0>: PD(0.64) ->", show(apply(phase_damp(0.64), zero)), " DEP(0.3) ->", show(apply(depolarizing(0.3), zero)))
# (6) Bell state |Phi+> with local depolarizing p = 0.1 on both qubits.
p = 0.1
f = 1 - 4 * p / 3
phi = np.array([1, 0, 0, 1], dtype=complex) / np.sqrt(2)
bell = np.outer(phi, phi.conj())
print("|Phi+><Phi+| = (II + XX - YY + ZZ)/4:", np.allclose(bell, (np.eye(4) + np.kron(X, X) - np.kron(Y, Y) + np.kron(Z, Z)) / 4))
noisy = apply([np.kron(Ka, Kb) for Ka in depolarizing(p) for Kb in depolarizing(p)], bell)
F = np.real(phi.conj() @ noisy @ phi)
print(f"f = {f:.10f}, F = {F:.10f}, (1 + 3 f^2)/4 = {(1 + 3 * f ** 2) / 4:.10f}")
print("rho =", show(noisy))
print(f"(1 + f^2)/4 = {(1 + f ** 2) / 4:.6f}, (1 - f^2)/4 = {(1 - f ** 2) / 4:.6f}, f^2/2 = {f ** 2 / 2:.6f}")
pt = noisy.reshape(2, 2, 2, 2).transpose(0, 3, 2, 1).reshape(4, 4) # partial transpose on qubit 1
print(f"min eigenvalue of the partial transpose = {np.linalg.eigvalsh(pt).min():.10f} = (1 - 3 f^2)/4 = {(1 - 3 * f ** 2) / 4:.10f}")Expected output
U unitary: True
K_0 = [[1.000000, 0.000000], [0.000000, 0.800000]] K_1 = [[0.000000, 0.600000], [0.000000, 0.000000]] complete: True
Tr_E[U(rho x |0><0|)U+] = [[0.552000, 0.160000-0.080000j], [0.160000+0.080000j, 0.448000]] = sum_k K rho K+: True
T1 = 50.0, T2 = 30.0: T_phi = 42.857143, 2*T1 = 100.0
t r_x r_z | r_x(0)e^{-t/T2} 1-(1-r_z(0))e^{-t/T1}
0 +0.866025 -0.500000 | +0.866025 -0.500000
10 +0.620534 -0.228096 | +0.620534 -0.228096
30 +0.318593 +0.176783 | +0.318593 +0.176783
60 +0.117204 +0.548209 | +0.117204 +0.548209
150 +0.005835 +0.925319 | +0.005835 +0.925319
AD(g2) AD(g1) = AD(g): True, (1-g1)(1-g2) = 0.548812 = 1-g = 0.548812
sum_P P A P = 2 Tr(A) I: True
p = 0.30: r_out = +0.600000 * r_in: True
p = 0.75: r_out = +0.000000 * r_in: True
p = 1.00: r_out = -0.333333 * r_in: True
|+>: PD(0.64) -> [[0.500000, 0.300000], [0.300000, 0.500000]] DEP(0.3) -> [[0.500000, 0.300000], [0.300000, 0.500000]]
|0>: PD(0.64) -> [[1.000000, 0.000000], [0.000000, 0.000000]] DEP(0.3) -> [[0.800000, 0.000000], [0.000000, 0.200000]]
|Phi+><Phi+| = (II + XX - YY + ZZ)/4: True
f = 0.8666666667, F = 0.8133333333, (1 + 3 f^2)/4 = 0.8133333333
rho = [[0.437778, 0.000000, 0.000000, 0.375556], [0.000000, 0.062222, 0.000000, 0.000000], [0.000000, 0.000000, 0.062222, 0.000000], [0.375556, 0.000000, 0.000000, 0.437778]]
(1 + f^2)/4 = 0.437778, (1 - f^2)/4 = 0.062222, f^2/2 = 0.375556
min eigenvalue of the partial transpose = -0.3133333333 = (1 - 3 f^2)/4 = -0.3133333333The lab has two steps. First, compute the damping parameter and the surviving excited population of a qubit that idles for with . Second, build a one-gate circuit with noise channels that prepares from ; the grader simulates it on the density-matrix backend and compares the result by trace distance.
References
- M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information, 10th anniversary edition, Cambridge University Press (2010), chapter 8: Quantum noise and quantum operations.doi:10.1017/CBO9780511976667
- P. Krantz, M. Kjaergaard, F. Yan, T. P. Orlando, S. Gustavsson and W. D. Oliver, A quantum engineer's guide to superconducting qubits, Applied Physics Reviews 6, 021318 (2019).doi:10.1063/1.5089550
- W. F. Stinespring, Positive functions on C*-algebras, Proceedings of the American Mathematical Society 6, 211–216 (1955).doi:10.1090/S0002-9939-1955-0069403-4
- M.-D. Choi, Completely positive linear maps on complex matrices, Linear Algebra and its Applications 10, 285–290 (1975).doi:10.1016/0024-3795(75)90075-0
- A. Peres, Separability criterion for density matrices, Physical Review Letters 77, 1413–1415 (1996).doi:10.1103/PhysRevLett.77.1413
- R. F. Werner, Quantum states with Einstein-Podolsky-Rosen correlations admitting a hidden-variable model, Physical Review A 40, 4277–4281 (1989).doi:10.1103/PhysRevA.40.4277
- PennyLane documentation: qml.DepolarizingChannel (Kraus operators √(1−p) I, √(p/3) X, √(p/3) Y, √(p/3) Z).docs.pennylane.ai
- PennyLane documentation: qml.AmplitudeDamping, qml.PhaseDamping and qml.ThermalRelaxationError.docs.pennylane.ai
- Qiskit Aer documentation: noise.depolarizing_error (E(ρ) = (1 − λ)ρ + λ I/2ⁿ) and noise.thermal_relaxation_error.qiskit.github.io
Hands-on labs
Amplitude damping, T1 decay and engineered dephasing
2 steps · auto-gradedOpen labCompute the energy-relaxation probability of an idling qubit and its surviving excited population, then build a one-qubit noisy circuit that prepares the mixed state from with one gate and noise channels simulated on the density-matrix backend.