ProductBlogAlgorithmsAboutSign inSign up

Quick Example

Superposition: Quantum Circuit Example

Equal probability with Hadamard gates

What this example teaches

Prepare three independent qubits in equal superposition.

Expected result

All eight three-bit outcomes have ideal probability 1/8.

Browser bit strings list physical wires q0 first, including auxiliary wires. Native classical-register strings can use another order; inspect the declared measurements.

These are ideal probabilities. Sampled frequencies fluctuate when more than one outcome is possible; they need not match percentages exactly. An ideal outcome with probability 100% has no finite-shot variation. Hardware noise is a separate effect.

Try the example

Open Run in Marqov →

The link opens the editor. Save existing work, then choose Examples → Superposition → framework. Click Run, choose an available browser simulator, then click Run in browser. The link does not preselect or execute the example.

Scope and limitations

  • This circuit prepares independent qubits; it does not demonstrate entanglement.

These expected answers describe the fixed circuit. This page does not establish a completed hosted or hardware run. Read the user guide for this example.

Inspect and download the circuit

Inspect the same fixed circuit in five frameworks. Browser execution translates supported circuit definitions into OpenQASM; it does not run general Python. Outside Marqov, Qiskit, Cirq, and Marqov snippets need a separate simulator invocation. PennyLane invokes its QNode and stores sampled counts in result.

OpenQASM
// Superposition — Hadamard on 3 qubits (8 equal outcomes)
OPENQASM 2.0;
include "qelib1.inc";
qreg q[3];
creg c[3];
h q[0];
h q[1];
h q[2];
measure q -> c;
Download OpenQASM circuit
Qiskit
# Superposition — Hadamard on 3 qubits (8 equal outcomes)
from qiskit import QuantumCircuit

qc = QuantumCircuit(3, 3)
qc.h([0, 1, 2])
qc.measure([0, 1, 2], [0, 1, 2])
Download Qiskit circuit
Cirq
# Superposition — Hadamard on 3 qubits (8 equal outcomes)
import cirq

qubits = cirq.LineQubit.range(3)
circuit = cirq.Circuit([
    cirq.H.on_each(*qubits),
    cirq.measure(*qubits, key="result"),
])
Download Cirq circuit
PennyLane
# Superposition — Hadamard on 3 qubits (8 equal outcomes)
import pennylane as qml

dev = qml.device("default.qubit", wires=3, shots=1000)

@qml.qnode(dev)
def superposition():
    for i in range(3):
        qml.Hadamard(wires=i)
    return qml.counts()

result = superposition()
Download PennyLane circuit
Marqov
# Superposition — Hadamard on 3 qubits (8 equal outcomes)
from marqov import Circuit

circuit = Circuit().h(0).h(1).h(2)
Download Marqov circuit

Sources and provenance

These references explain the concept and gate conventions. The snippets originate in Marqov's internal example collection; an upstream code attribution has not been established.

Snapshot identity
Source revision
df5a80cd474144684bf69dbda237b28ce40cc48c
Example version
0b88f9877ea24e5ec51fd54b00ff3c7471368b509f10eeca5e1a31bfd423592f

The source revision identifies the editor collection used for this snapshot. The example version identifies its five exact code variants; neither is evidence of a hosted run.

Go deeper

For a paper-based experiment with scientific comparisons and execution evidence, read Research Replications. Its published scope and availability are separate from this small teaching circuit.

Explore all twelve Quick Examples →