Skip to documentation
← Algorithm guides

Algorithm guide · primitive

Rényi-2 entropy

Interfere two independently prepared copies to estimate subsystem purity and entanglement entropy from one ancilla.

Circuit size: 5 qubits; 1 measured ancilla

Before you begin

Density matrices and partial trace · Controlled SWAP · Logarithms base two

Review quantum fundamentals →
Notation used in this lesson
|ψ⟩ and ⟨ψ|
A state vector (ket) and its conjugate transpose (bra). ⟨a|b⟩ is their inner product.
α, β and i
α and β are complex amplitudes; i²=−1. A probability is the squared magnitude |α|².
XOR, · and ⊗
XOR adds bits modulo two. In s·x, multiply corresponding bits and XOR them. ⊗ combines registers or operations on different wires.
U†, Σ and Tr
U† is the adjoint (inverse for a unitary). Σ sums terms. Tr is the matrix trace, the sum of diagonal entries.
Probability, shots and angles
Ideal probabilities describe the model; measured shot frequencies fluctuate. Angles inside trigonometric expressions are in radians unless explicitly labeled turns.

1. The problem

Estimate the purity of subsystem A of a prepared pure two-qubit state, then compute its Rényi-2 entropy. Compare with the purity of the whole AB state.

2. How it works

Interfere two independently prepared copies with a SWAP controlled by one ancilla. Swapping only A probes its reduced state; swapping both A and B probes the whole state. Entangled pure pairs have mixed subsystems even though the whole pair is pure.

  1. Prepare two copies

    Each pair is √(1−p)|00⟩+√p|11⟩. This repeats a known preparation; it does not clone an unknown state.

  2. Interfere

    H on the ancilla, controlled SWAP of the selected subsystem(s), then H.

  3. Measure ancilla

    Repeat to estimate P(0).

  4. Decode

    Compute purity=2P(0)−1 and S2=−log2(purity).

3. The mathematics, one idea at a time

ρ_A=diag(1−p,p); Tr(ρ_A²)=(1−p)²+p²

Tracing out B removes the cross terms; A’s eigenvalues are 1−p and p.

P_ancilla(0)=[1+Tr(ρ_A²)]/2; S2=−log2 Tr(ρ_A²)

The ancilla encodes purity, and the logarithm reports entropy in bits.

Tr(ρ_AB²)=1 for this pure preparation

Whole-state purity remains one even when the reduced entropy is nonzero.

Work this through by hand

4. A Bell pair has one bit of reduced Rényi entropy

Five fixed qubits: an ancilla and two prepared two-qubit copies. Start at p=0 as a zero-entropy baseline; p=1/2 is the simplest entangled example.

Choose p=0.5 and Subsystem A.

StageCalculation or stateWhat it means
Reduced stateρ_A=diag(1/2,1/2)Either local computational outcome is equally likely.
Purity(1/2)²+(1/2)²=1/2The subsystem is mixed.
Ancilla and entropyP(0)=3/4; P(1)=1/4; S2=−log2(1/2)=1A probability measurement gives the entropy estimate after classical decoding.

Expected outcomes for this example

These are ideal predictions for the stated configuration, not a result already measured by your browser. Rows describing alternative modes or combined events are labeled explicitly.

Outcome or eventIdeal probabilityInterpretation
075% idealAncilla outcome used for purity.
125% idealComplementary ancilla outcome.

5. Load the worked example in Composer

The worked example can use smaller or simpler inputs than the gallery defaults. The button below loads the exact circuit used in this lesson.

Schmidt weight p
0.5
Readout
Subsystem A
  1. Save any current circuit you want to keep, then open the worked example. Loading it does not execute a paid hardware job.
  2. Trace the preparation, main operations and measurements against the worked table. Check the gate editor for controls, targets and angles.
  3. Start with an ideal noiseless simulator compatible with the circuit. Mid-circuit measurement, reset and feed-forward require support from the chosen backend.
  4. Inspect the live preview. For a recorded experiment, open Execute, set the available backend options and shots, and Run. Sign in when prompted to retain it in My Jobs.
  5. Read the output as described below before changing one setting and repeating. The guide describes the original example; edits can change the answer.

6. Read the output correctly

Read c0 only. With an observed zero fraction f0, calculate purity≈2f0−1, then the entropy.

Finite samples can give an unphysical purity estimate outside the allowed range. Do not take a logarithm of a nonpositive raw estimate or interpret it as a physical entropy.

Switch to Whole AB: the ideal ancilla is always 0, purity is 1 and whole-state S2 is 0.

A bit label is a register value; its bar height is a probability or count. For S shots and observed count k, the sampled frequency is k/S. A typical sampling scale for probability p is √[p(1−p)/S]; this is not a strict error bound. Finite samples do not have to match the ideal percentages exactly.

7. Common mistakes & limits

  • Reduced mixedness implies entanglement here because AB is pure; it is not a general entanglement certificate for mixed AB states.
  • Nonidentical or correlated copies do not measure the advertised purity; the overlap signal changes.

8. Check your understanding

What are reduced purity and S2 for p=0?

Reveal the reasoning

ρ_A=|0⟩⟨0|, purity=1 and S2=0. The pair is the product |00⟩.

9. Further study

The lesson’s register mappings, supported inputs and loadable example follow Quantket’s implemented circuit. A reference may use different wire names, bit order or resource conventions.

Gallery reference: defaults, definitions & implementation notes

Inputs & default settings

Tune entanglement and compare a subsystem SWAP with a whole-state SWAP; inspect ancilla counts in Classical bits.

These are the gallery defaults. The worked example above may override them. Configure the card to change the inputs before loading its editable circuit.

Schmidt weight p
Default: 0.5 · A probability from 0 to 1 inclusive.

Probability of |11> in each copy: 0 or 1 gives a product state; 0.5 gives a Bell state.

Readout
Default: subsystem · Choices for the current settings: Subsystem A (Reduced purity; entanglement for pure AB.); Whole AB comparison (Full pure-state entropy stays zero.).

Implementation notes

Ancilla q0 probes AB on q1,q2 and a separately prepared copy on q3,q4. Both preparations produce sqrt(1-p)|00> + sqrt(p)|11>; this repeats a known preparation, not cloning an unknown state. Subsystem mode swaps only A (q1,q3), measuring Tr(rho_A^2). Whole-state mode also swaps B (q2,q4), measuring Tr(rho_AB^2)=1 for these pure states, even when A and B are entangled. Repeated ancilla shots estimate purity as 2P(0)-1 and Renyi-2 entropy as -log2(purity), in bits. Reduced entropy measures entanglement here because AB is pure; mixedness alone does not establish entanglement for a mixed AB state. Copies must be identical and independent, or the signal is Tr(rho sigma), not purity. Finite samples fluctuate, and circuit edits can invalidate these assumptions.

Default example: predictions & circuit facts

These values describe the unedited default setup. They are predictions and circuit properties, not measured results from your saved execution.

Ideal purity
0.5000
Ideal subsystem S2
1.0000 bits
Ancilla P(0)
75.00%
Ancilla P(1)
25.00%

Read your saved result

Check the submitted circuit, measured register and execution settings in Run details. Exact results give computed probabilities; sampled results show frequencies from the recorded shots. Edited circuits and noise can change the expected outcome. The algorithm label records the circuit's origin; it does not certify an edited circuit or a measured result.