Preparing the Bell state |Φ+⟩ = (|00⟩ + |11⟩)/√2 using a single-parameter variational quantum circuit, optimised with a hand-implemented parameter-shift rule.
Built with PennyLane.
A variational circuit consisting of an RY rotation followed by a CNOT gate is trained to produce equal-weight superposition across |00⟩ and |11⟩. The cost function minimises the expectation values ⟨Z₀⟩² + (⟨Z₀Z₁⟩ − 1)², driving the system toward the target entangled state.
Optimisation uses gradient descent with the parameter-shift rule — a hardware-compatible method that estimates gradients using only circuit evaluations at shifted parameters (p ± π/2), without accessing internal quantum state. This makes the approach directly transferable to real hardware.
RY is drawn from a universal gate set {RX, RY, CNOT} adopted for this project — sufficient for arbitrary single- and two-qubit operations.
RY(p) ──●──
│
I ───⊕──
The model was trained using Gradient Descent with a tolerance (
- Convergence: The algorithm reached the stopping criterion at iteration 1410.
-
Final Parameter (
$p$ ):$\approx 1.5956$ (converging toward the theoretical value of$\pi/2 \approx 1.5708$ ). -
Final Error:
$0.0001$ .
At the optimal parameter, the circuit produces
| Observable | Initial ( |
Optimised |
|---|---|---|
| ~0.99 | ~0.50 | |
| ~0.01 | ~0.50 |
bell-state-vqc/
├── bell_state_vqc.ipynb # main notebook
├── figures/ # plots
│ ├── circuit-diagram.png
│ ├── states-probabilities.png
│ └── parameter-evolution.png
├── requirements.txt
└── README.md
pip install -r requirements.txt
jupyter notebook bell_state_vqc.ipynbpennylane
numpy
matplotlib
seaborn
Code written independently as part of self-directed study into variational quantum algorithms. Documentation refined iteratively.


