Quick Example
Bell State: Quantum Circuit Example
Entangle two qubits
What this example teaches
Prepare a two-qubit Bell state.
Expected result
Ideal browser outcomes are 00 and 11, each with probability 1/2. These counts alone do not prove entanglement.
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
The link opens the editor. Save existing work, then choose Examples → Bell State → 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
- Computational-basis counts alone cannot distinguish an entangled Bell state from a classical mixture.
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
// Bell State — entangle two qubits
OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
creg c[2];
h q[0];
cx q[0],q[1];
measure q -> c;
Download OpenQASM circuitQiskit
# Bell State — entangle two qubits
from qiskit import QuantumCircuit
qc = QuantumCircuit(2, 2)
qc.h(0)
qc.cx(0, 1)
qc.measure([0, 1], [0, 1])
Download Qiskit circuitCirq
# Bell State — entangle two qubits
import cirq
q0, q1 = cirq.LineQubit.range(2)
circuit = cirq.Circuit([
cirq.H(q0),
cirq.CNOT(q0, q1),
cirq.measure(q0, q1, key="result"),
])
Download Cirq circuitPennyLane
# Bell State — entangle two qubits
import pennylane as qml
dev = qml.device("default.qubit", wires=2, shots=1000)
@qml.qnode(dev)
def bell_state():
qml.Hadamard(wires=0)
qml.CNOT(wires=[0, 1])
return qml.counts()
result = bell_state()
Download PennyLane circuitMarqov
# Bell State — entangle two qubits
from marqov import Circuit
circuit = Circuit().h(0).cnot(0, 1)
Download Marqov circuitSources 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
3ef89872aa81cc0f3afcaf43ef0135a9625438d43cdf47872ed197ba72f600e4
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.