<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Andreabenassi on Medium]]></title>
        <description><![CDATA[Stories by Andreabenassi on Medium]]></description>
        <link>https://medium.com/@andreabenassi02?source=rss-ca66d3ee83a8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*viha8c-ObqgetKar</url>
            <title>Stories by Andreabenassi on Medium</title>
            <link>https://medium.com/@andreabenassi02?source=rss-ca66d3ee83a8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 18:07:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@andreabenassi02/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Day 19 Qucode Cohort 3]]></title>
            <link>https://medium.com/@andreabenassi02/day-19-qucode-cohort-3-5b3d61147b3e?source=rss-ca66d3ee83a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b3d61147b3e</guid>
            <category><![CDATA[quantum-computing]]></category>
            <category><![CDATA[quantum-machine-learning]]></category>
            <category><![CDATA[cohort-3]]></category>
            <category><![CDATA[quantum-learning]]></category>
            <category><![CDATA[qucode]]></category>
            <dc:creator><![CDATA[Andreabenassi]]></dc:creator>
            <pubDate>Sat, 20 Sep 2025 13:46:54 GMT</pubDate>
            <atom:updated>2025-09-20T13:46:54.189Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Topic: Quantum Machine Learning Basics, Quantum data encoding, Quantum neural networks</strong></p><p>Quantum Machine Learning (QML) is an emerging research area that fuses quantum computing with machine learning. Its goal is not to simply “port” classical ML to quantum hardware, but to leverage quantum mechanics — superposition, entanglement, interference — to create new models that can capture complex patterns in data more efficiently.</p><p>At its heart, QML hinges on three pillars:</p><ol><li><strong>Quantum data encoding (quantum feature maps):</strong> how classical data are represented as quantum states.</li><li><strong>Variational quantum models (quantum neural networks):</strong> parameterized quantum circuits trained like neural networks.</li><li><strong>Hybrid optimization loops:</strong> where classical optimizers update quantum circuit parameters based on measurements.</li></ol><h4>1. From Classical ML to Quantum ML</h4><p>Classical ML models (e.g. neural networks, SVMs) rely on feature maps that transform data into high-dimensional spaces where classification or regression is easier. Quantum computers natively manipulate vectors in a Hilbert space of dimension 2^n for n qubits, providing a natural “high-dimensional” setting.</p><p>The hope is that quantum feature maps can generate data representations not efficiently reproducible classically, leading to potential quantum advantages in pattern recognition.</p><h4>2. Quantum Data Encoding</h4><p>Encoding is the first and most critical step: mapping classical vectors x∈R^d into quantum states |ψ(x)⟩.</p><p><strong>2.1 Common Encoding Strategies</strong></p><ol><li><strong>Basis (computational) encoding:</strong><br> Encode each bit of binary data as a qubit state ∣0⟩ or ∣1⟩. Efficient but scales poorly with real-valued data.</li><li><strong>Amplitude encoding:</strong><br>Normalize a vector x and use its components as amplitudes</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/1*ZqJ563V_cgdcdFYMtjDimA.png" /></figure><p>Very compact (exponentially many features in nnn qubits), but requires complex state preparation.</p><p>3. <strong>Angle (rotation) encoding:</strong><br> Encode data into rotation angles of single-qubit gates. For example,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/242/1*6Nlf85m5q-nZg3wkorxlrQ.png" /></figure><p>Simple and widely used on near-term devices</p><p><strong>2.2 Feature Maps and Kernels</strong></p><p>A quantum feature map is a unitary Uϕ(x) that embeds data into Hilbert space:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/218/1*zdBBsyxXOXujehPDxpxwpQ.png" /></figure><p>The kernel between two data points is then the inner product:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*9HodXzv81h1IQHgJNAMSQw.png" /></figure><p>Quantum kernels can capture correlations beyond classical kernels. Qiskit provides built-in feature maps (ZFeatureMap, ZZFeatureMap, PauliFeatureMap), with tunable parameters: <em>entanglement type</em> (linear, circular, full), <em>repetitions</em>, and choice of rotation gates.</p><h4>3. Quantum Neural Networks</h4><p>A Quantum Neural Network (QNN) is essentially a parameterized quantum circuit:</p><ol><li><strong>Input layer:</strong> data encoding via a feature map.</li><li><strong>Hidden layers:</strong> variational layers with parameterized rotations and entangling gates</li><li><strong>Output layer:</strong> measurement of qubits to yield classical probabilities or expectation values</li></ol><p>Mathematically, a QNN defines a function</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*7Zdf1sSUcoupF3VGPSgciw.png" /></figure><p>where M is a measurement operator and θ are trainable parameters.</p><p><strong>3.1 Geometric Intuition (Grover-like rotations)</strong></p><p>As visualized on the Bloch sphere, parameterized gates rotate qubits through specific angles. Training a QNN can be seen as finding the correct rotation trajectory so that measurement probabilities align with labels. This is why many QNN tutorials emphasize the geometric picture: encoding rotates qubits by data-dependent angles, then variational layers rotate further to separate classes.</p><p><strong>3.2 Architectures</strong></p><ul><li><strong>TwoLocal ansatz:</strong> alternating single-qubit rotations and entangling layers.</li><li><strong>Hardware-efficient ansatz:</strong> optimized for device connectivity.</li><li><strong>Problem-inspired ansatz:</strong> e.g., quantum convolutional networks or Hamiltonian-inspired layers.</li></ul><h3>4. Training Quantum Neural Networks</h3><p>QNNs are trained in <strong>hybrid quantum-classical loops</strong>, analogous to Variational Quantum Algorithms (VQE, QAOA).</p><ol><li>Encode data point x into a quantum circuit</li><li>Run circuit on a QPU or simulator, measure observables</li><li>Define a loss function (e.g., cross-entropy for classification, MSE for regression)</li><li>Use a classical optimizer (SPSA, Adam, L-BFGS) to update circuit parameters</li></ol><p><strong>4.1 Sampler vs Estimator Models in Qiskit</strong></p><ul><li><strong>SamplerQNN:</strong> maps input → measurement probabilities → predicted class.</li><li><strong>EstimatorQNN:</strong> outputs expectation values of observables (e.g., Pauli-Z or Hamiltonians), useful for regression and variational problems</li></ul><p><strong>4.2 Integration with PyTorch / TensorFlow</strong></p><p>Qiskit’s TorchConnector allows QNNs to integrate with PyTorch, enabling GPU-accelerated training loops, auto-differentiation, and mixing quantum layers with classical deep nets (hybrid QML).</p><h4>5. Example Workflows</h4><p>To make QML concepts more concrete, let us examine two canonical workflows: classification and regression. Both rely on the same underlying machinery, feature maps for data encoding, variational ansatz circuits for trainable layers, and a hybrid optimization loop. The main difference, as in normal machine learning, lies in the <strong>loss functions</strong> used and the <strong>tasks</strong> they address.</p><p><strong>5.1 Classification (Variational Quantum Classifier, VQC)</strong></p><p>The <strong>Variational Quantum Classifier (VQC)</strong> is the quantum analogue of a classical supervised classifier. The pipeline consists of:</p><ol><li><strong>Feature map (encoding):</strong><br> Classical inputs (e.g., 2D points from a dataset) are encoded into quantum states. A common choice is the <strong>ZZFeatureMap</strong>, which uses entangling rotations to capture pairwise correlations between features</li><li><strong>Variational ansatz (model):</strong><br> After encoding, a parameterized quantum circuit (often the <strong>TwoLocal ansatz</strong>) is applied. This ansatz alternates between single-qubit rotation gates and entangling layers, with trainable parameters that are updated during optimization.</li><li><strong>Training loop:</strong><br> The circuit is wrapped into a VQC object in Qiskit. Training proceeds as follows:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*87c27O70RBcZm9H7eUvNvA.png" /></figure><p>4.<strong> Evaluation:</strong><br> The output is a set of <strong>class probabilities</strong>, from which labels are assigned. Performance is measured using accuracy or other classification metrics like in normal machine learning.</p><p>The key point: the VQC learns a decision boundary not directly in the classical feature space, but in the quantum feature space induced by the encoding and entangling structure.</p><p><strong>5.2 Regression (Variational Quantum Regressor, VQR)</strong></p><p>Regression tasks focus on predicting <strong>continuous values</strong> rather than discrete labels. The <strong>Variational Quantum Regressor (VQR)</strong> adapts the same architecture but changes the objective:</p><ol><li><strong>Feature map:</strong><br> Input variables (e.g., scalar values along a sine wave) are encoded into qubit rotations. For regression, even simple one-qubit encodings can suffice.</li><li><strong>Variational ansatz:</strong><br> A parameterized circuit (often shallow and hardware-efficient) is applied to transform the encoded input.</li><li><strong>Training loop:</strong><br> Instead of classification loss, the objective is <strong>Mean Squared Error (MSE)</strong> between the predicted expectation values (obtained from qubit measurements) and the true continuous labels.</li><li><strong>Evaluation:</strong><br> After training, the regressor can output smooth predictions for unseen data points.</li></ol><p>The key point: the VQR illustrates how quantum circuits can interpolate and approximate continuous functions, highlighting their potential in regression-based applications such as physics simulations and forecasting.</p><h3>6. Challenges in QML</h3><ol><li><strong>Barren Plateaus:</strong> gradients vanish for deep random circuits, limiting trainability.</li><li><strong>Encoding bottleneck:</strong> loading large classical datasets into quantum states may erase advantages.</li><li><strong>Noise &amp; decoherence:</strong> small circuits can be trained, but scaling remains difficult.</li><li><strong>Lack of “killer app” yet:</strong> no clear evidence of quantum advantage in practical ML tasks on current devices.</li></ol><h3>7. Opportunities and Applications</h3><p>Despite challenges, QML is being explored for:</p><ol><li><strong>Chemistry &amp; physics simulations</strong>: QNNs as ansatz for many-body wavefunctions.</li><li><strong>Finance:</strong> portfolio optimization and risk modeling.</li><li><strong>Healthcare:</strong> quantum-enhanced classification of molecular or imaging data.</li><li><strong>Generative modeling:</strong> quantum GANs and quantum Boltzmann machines.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b3d61147b3e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 18 Qucode Cohort 3]]></title>
            <link>https://medium.com/@andreabenassi02/day-18-qucode-cohort-3-48e0a57fd212?source=rss-ca66d3ee83a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/48e0a57fd212</guid>
            <category><![CDATA[quantum-computing]]></category>
            <category><![CDATA[quantum-learning]]></category>
            <category><![CDATA[quantum]]></category>
            <category><![CDATA[qucode]]></category>
            <category><![CDATA[cohort-3]]></category>
            <dc:creator><![CDATA[Andreabenassi]]></dc:creator>
            <pubDate>Fri, 19 Sep 2025 13:23:19 GMT</pubDate>
            <atom:updated>2025-09-19T13:23:19.469Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Topic: Variational Quantum Algorithms, Hybrid quantum-classical computing</strong></p><h4>1. Motivation and the hybrid paradigm</h4><p>Large, fault-tolerant quantum computers remain years away. NISQ devices offer tens–few hundreds of noisy qubits, limited coherence, and imperfect gates. VQAs are explicitly designed to bridge current hardware capabilities and useful problems: they use short (shallow) parameterized circuits interleaved with classical optimization to solve variational problems such as ground-state chemistry or combinatorial optimization.</p><p>Conceptually a VQA implements the minimization</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*7cueZeXN8OJjkdinHvxB3w.png" /></figure><p>where |ψ(θ)⟩ is prepared by a parameterized quantum circuit (ansatz) and H is the problem Hamiltonian (or more generally, an observable encoding the cost). The variational principle guarantees that the minimum over all quantum states (if accessible) is the ground state energy. In practice we restrict to an ansatz family and trade exactness for tractability. This VQE workflow — construct Hamiltonian, prepare |ψ(θ)⟩, measure Pauli terms, combine results, and update parameters is central to VQE and appears in standard teaching materials</p><h4>2. Variational principle &amp; Hamiltonian decomposition</h4><p><strong>2.1 Variational principle</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*kNV2SUbZ_TZjlY2mWm121g.png" /></figure><p><strong>2.2 Hamiltonian → Pauli decomposition</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*sLkktE39fcxepdqgLXQe4Q.png" /></figure><h4>3. Ansatz design: expressibility, locality and hardware constraints</h4><p>The choice of ansatz |ψ(θ)⟩=U(θ)|0⟩ is the most consequential design decision.</p><p><strong>Two main classes</strong></p><ol><li><strong>Problem-inspired ansätze</strong></li></ol><ul><li><em>Unitary Coupled Cluster (UCC)</em> and its truncations (UCCSD) for chemistry: generated from fermionic excitation operators T, the ansatz is e^(T−T†)∣HF⟩. UCC is physically motivated but leads to deep circuits after mapping to qubits (Trotterization).</li><li><em>Hamiltonian variational ansatz:</em> build layers inspired by terms in H</li></ul><p>2.<strong> Hardware-efficient ansätze</strong></p><ul><li>Layers of parametrized single-qubit rotations and entangling gates matched to the device’s connectivity. Very shallow, easy to compile, but often highly expressive (sometimes too expressive) and vulnerable to barren-plateau gradients.</li></ul><p><strong>Design tradeoffs</strong></p><ol><li><em>Expressibility</em> (ability to represent many states) vs <em>trainability</em> (avoidance of barren plateaus, presence of useful gradients).</li><li><em>Locality</em>: ansätze composed of local gates preserve problem locality and reduce entangling overhead.</li><li><em>Symmetry preservation</em>: conserve particle number, spin, parity etc. — reduces search space and prevents spurious states.</li></ol><p><strong>Adaptive ansätze</strong> (e.g., ADAPT-VQE) build circuits iteratively by selecting operators that maximally reduce energy, achieving compact circuits with better trainability.</p><h4>4. The hybrid loop &amp; optimization</h4><p>A prototypical VQA loop:</p><ol><li>Choose ansatz U(θ) and classical optimizer.</li><li>Prepare ∣ψ(θ)⟩=U(θ)∣0⟩</li><li>Measure each Pauli string Pp​ (or grouped sets) to estimate ⟨Pp⟩</li><li>Compute the cost E(θ)=∑hp⟨Pp⟩</li><li>θ←θ+Δθ using a classical optimizer (gradient-free or gradient-based).</li><li>Repeat until convergence.</li></ol><pre>initialize θ<br>while not converged:<br>    prepare |ψ(θ)⟩ on QPU<br>    measure groups of Pauli strings → estimate E(θ)<br>    compute ∇E(θ) (optionally)<br>    update θ with classical optimizer</pre><p>Practical systems must manage shot budgets (measurements), classical compute latency, and noise.</p><h4>5. Gradient evaluation: parameter-shift, SPSA, and natural gradient</h4><p><strong>5.1 Parameter-shift rule (exact gradient for many common gates)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*Wq_5VYUo_md8jlHXVf27Jw.png" /></figure><p><strong>5.2 Stochastic gradient estimators (SPSA)</strong></p><p>When parameters are many or shot budgets tight, Simultaneous Perturbation Stochastic Approximation (SPSA) estimates gradients with only two cost evaluations per iteration by perturbing all parameters at once along a random direction. SPSA is robust to noise and popular in early VQE/QAOA experiments.</p><p><strong>5.3 Quantum natural gradient (QNG)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*SSzn1wVP8TetAJrZWMTHsQ.png" /></figure><h4>6. Measurement strategies and shot complexity</h4><p>Directly measuring every Pauli term independently is wasteful. Strategies to reduce shots:</p><ul><li><strong>Pauli grouping:</strong> group commuting Pauli strings that can be measured simultaneously (either via tensor-product basis or general commuting sets), reducing the number of measurement circuits.</li><li><strong>Circuit recompilation:</strong> apply local rotations to measure many terms in the same basis.</li><li><strong>Classical shadows:</strong> randomized single-qubit Clifford measurements produce a data structure (a “shadow”) from which many observables can be estimated with sublinear overhead in the number of observables (subject to variance bounds). This is especially powerful when many expectation values are needed.</li><li><strong>Importance sampling &amp; adaptive shot allocation:</strong> allocate shots proportional to coefficient magnitude ∣hp∣ and variance to minimize estimator variance for a fixed shot budget.</li></ul><p>Shot complexity to reach energy precision ϵ scales roughly like O(Var(H)/ϵ²); variance reduction (grouping, classical shadows) is therefore crucial.</p><h4>7. Error mitigation and noise-aware strategies</h4><p>VQAs do not remove noise; they can be <em>robust</em> to some errors but require mitigation for quantitative accuracy.</p><p>Common techniques:</p><ol><li><strong>Zero-Noise Extrapolation (ZNE):</strong> artificially scale noise (e.g., by stretching gate durations or repeating gates) to obtain estimates at multiple noise strengths and extrapolate back to zero noise.</li><li><strong>Probabilistic Error Cancellation (PEC):</strong> invert noise channels stochastically using noisy gate characterizations — unbiased but incurs exponential sampling overhead in noise strength.</li><li><strong>Symmetry verification / postselection:</strong> reject measurement outcomes violating conserved quantities (e.g., particle number), reducing error at a cost of effective shots.</li><li><strong>Subspace expansion / linear response:</strong> expand the variational state in a small subspace of error-excited states and solve a generalized eigenproblem to correct energy.</li><li><strong>Readout error mitigation:</strong> classical calibration and inversion of readout error matrices.</li></ol><p>Error mitigation is not error correction — it trades extra measurements and classical processing to reduce bias.</p><h4>8. Trainability issues: barren plateaus &amp; remedies</h4><p><strong>Barren plateaus</strong>: large, random parameterized circuits tend to have gradients that vanish exponentially in system size — making optimization infeasible. Causes include:</p><ul><li>Random global ansätze (high expressibility).</li><li>Deep ansätze with many parameters.</li><li>Certain choices of cost function (global vs local).</li></ul><p><strong>Mitigations</strong></p><ul><li>Use <em>local cost functions</em> (measure observables with local support).</li><li>Use <em>problem-inspired</em> ansätze preserving symmetries.</li><li><em>Layerwise training</em>: grow the ansatz and train shallowly (progressive ansatz expansion).</li><li><em>Smart initialization</em>: initialize near physically meaningful states (Hartree–Fock, mean-field).</li><li><em>Noise-induced effects</em>: interestingly, certain levels of noise can either worsen or sometimes (in special cases) help escape plateaus; in practice noise usually harms trainability.</li></ul><p>Understanding and managing trainability remains an active research frontier.</p><h4>9. Fermions → qubits: mappings and resource considerations (chemistry focus)</h4><p>For electronic structure problems:</p><ol><li><strong>Second quantization:</strong> express Hamiltonian with fermionic creation/annihilation ap†, ap​ as</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*HvtCM--CPTSNslci7Kui-Q.png" /></figure><p>2. <strong>Mapping to qubits:</strong></p><ul><li><em>Jordan–Wigner:</em> simple, maps apa_pap​ to strings of Zs times ladder operators; results in long Pauli strings but straightforward.</li><li><em>Bravyi–Kitaev:</em> reduces average string length by mixing parities and occupations; often preferred for fewer long Pauli strings.</li><li><em>Tapering by symmetries:</em> use point group or spin symmetries to reduce qubits (Bravyi–Kitaev + symmetry reduction).</li></ul><p>3.<strong> Active space selection:</strong> freeze core orbitals; only treat chemically relevant orbitals with quantum resources.</p><p>Resource planning must account for qubit count after mapping, circuit depth of UCC or alternative ansätze, and measurement overhead.</p><h4>10. Advanced algorithmic variants &amp; extensions</h4><ol><li><strong>ADAPT-VQE:</strong> iteratively builds ansatz by selecting operators with largest gradient contributions (adaptive, compact circuits).</li><li><strong>Variational Quantum Imaginary Time Evolution (VarQITE):</strong> approximate imaginary time evolution variationally to converge to ground states.</li><li><strong>Quantum Subspace Expansion (QSE):</strong> get excited states or correct errors by expanding around the variational state.</li><li><strong>VQD (Variational Quantum Deflation):</strong> compute excited states sequentially by adding penalty terms to cost.</li><li><strong>Layerwise and block-wise training:</strong> improves convergence and combats barren plateaus.</li><li><strong>Hybrid classical pre/post-processing:</strong> warm-start parameters from classical heuristics or use classical post-processing to refine outputs.</li></ol><h4>11. Conclusion</h4><p>VQAs are the most practical family of quantum algorithms for near-term hardware. They combine physics-inspired modeling, quantum state preparation, and classical optimization in a hybrid loop tailored to shallow circuits and limited coherence times. Success demands careful engineering: choose the right ansatz, manage measurement costs, mitigate noise, and use optimizers suited to noisy, shot-limited settings. While VQAs are heuristics, practical wins in chemistry, optimization, and quantum-enhanced data science are plausible in the coming years as hardware, software, and algorithmic techniques co-evolve.</p><p>For a succinct description of the VQE workflow and foundational slides used in many training courses, see the IBM-authored lecture on VQE that lays out the variational principle, Hamiltonian decomposition, and the hybrid loop in pedagogical detail.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48e0a57fd212" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 17 Qucode Cohort 3]]></title>
            <link>https://medium.com/@andreabenassi02/day-17-qucode-cohort-3-ecfed53f3b08?source=rss-ca66d3ee83a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/ecfed53f3b08</guid>
            <category><![CDATA[cohort-3]]></category>
            <category><![CDATA[quantum]]></category>
            <category><![CDATA[quantum-computing]]></category>
            <category><![CDATA[qucode]]></category>
            <category><![CDATA[quantum-learning]]></category>
            <dc:creator><![CDATA[Andreabenassi]]></dc:creator>
            <pubDate>Thu, 18 Sep 2025 15:19:38 GMT</pubDate>
            <atom:updated>2025-09-18T15:19:38.975Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Topic: Grover’s Algorithm &amp; Search ProblemsQuadratic speedup, Database search</strong></p><p>Quantum search is one of the crown jewels of quantum algorithms. Unlike Shor’s exponential breakthrough for factoring, Grover’s algorithm gives a <strong>provable quadratic speedup</strong> for unstructured search: if a classical algorithm needs O(N) queries to find a marked item in an unsorted database of size N, Grover needs only O(√N) queries. That quadratic advantage is small asymptotically but huge in practice for symmetric-key cryptography and brute-force search, and it plays a foundational role in amplitude amplification, quantum counting, and many quantum-walk based search algorithms.</p><h3>Outline</h3><ol><li>Problem statement: unstructured search and the oracle model</li><li>Oracle types (phase vs. standard) and implementation template</li><li>The 2-D subspace reduction (rigorous derivation)</li><li>Grover operator as a rotation — exact formulas and optimal iteration count</li><li>Multiple solutions, unknown k, and amplitude amplification variants</li><li>Quantum counting &amp; using QFT to estimate k</li><li>Optimality and lower bounds (query complexity)</li><li>Grover from the perspective of quantum walks, hitting times and absorbing walks</li><li>Practicalities: gate decomposition, complexity vs. queries, noise concerns, cryptographic implications</li><li>Worked Qiskit example (3-qubit Grover for a single marked item)</li></ol><h4>1. Problem statement and model</h4><p><strong>Unstructured search.</strong> You have an item set and a Boolean function (oracle) and a market set:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*VE4ykR3p9GxcZFvCcbRnuA.png" /></figure><p>The task is to find any x∈M. In the <em>black-box</em> (or oracle) model we count the number of times we must query f. Classically, in the worst case you need O(N/k) queries; if k=1, this is O(N).</p><p><strong>Quantum model.</strong> We are given a unitary implementation of the oracle (query) that acts on computational basis states. There are two common oracle conventions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*_rx9bSSRnhyfM5XC5_JCyA.png" /></figure><p>Throughout the algorithm we assume availability of a phase oracle (or an equivalent construction using Uf​ and an ancilla).</p><p><strong>Query complexity.</strong> We count the number of times the algorithm invokes the oracle (phase flip). Gate complexity will be discussed later.</p><h4>2. Oracle implementation</h4><p>Two implementation patterns are common:</p><ul><li><strong>Phase oracle via ancilla (phase kickback):</strong> Prepare ancilla |−⟩, compute f(x) into ancilla with a reversible circuit (classical reversible logic embedded in quantum) and uncompute: the ancilla accumulates a (−1)^f(x) phase and returns to |−⟩. This gives the phase oracle using a single call to the reversible circuit and one Z on ancilla.</li><li><strong>Direct phase flip on matched bit-patterns:</strong> If M corresponds to a small set of explicit bit patterns, map the marked pattern(s) to |11…1⟩ by applying Xs to selected qubits, apply a multi-controlled-Z or controlled-phase gate to flip the phase on |11…1⟩, then undo the Xs. For n qubits this requires an n-controlled-Z (or implementation via ancilla chain) which is feasible for small n.</li></ul><p>The cost of implementing the oracle is application dependent and dominates real-world runtime; query complexity counts oracle calls, but gate-level resources matter for implementation.</p><h4>3. Reduction to a two-dimensional subspace</h4><p>Grover’s magic comes from the fact that the whole N-dimensional state space effectively reduces to a two-dimensional subspace spanned by:</p><ol><li>|β⟩: the uniform superposition over marked states,</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/276/1*u6PywilQVeVXWo8CqMOB5Q.png" /></figure><p>2. |α⟩: the uniform superposition over unmarked states,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/316/1*Tgh3EgH92fRLQfaTMML20A.png" /></figure><h4>4. Grover operator as a rotation</h4><p><strong>Operators involved</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*yyHStY2Q30Dz1KuM7MofUw.png" /></figure><p>Both D and Of​ are reflections (Hermitian and unitary, with eigenvalues ±1). A product of two reflections in a plane is a rotation: G is a rotation in the {|α⟩,|β⟩} plane.</p><p><strong>Rotation angle calculation</strong></p><p>Compute action of G on the two basis vectors. Using the geometry:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*yjlj7b0wi5ru1ZeTcQzGPg.png" /></figure><p>Proof is direct by induction using the reflections or by diagonalization of G in the two-dimensional subspace.</p><p><strong>Success probability</strong></p><p>After t iterations, the amplitude on marked subspace is sin⁡((2t+1)θ). Thus the probability of measuring a marked item is</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*zYhDLkgU2Ryn85oxLaiOow.png" /></figure><p>Optimal t to maximize the probability​ is the integer nearest to</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*mLlBTgf_a03hI2GNEtv7qg.png" /></figure><p>In the single-solution case (k=1) Grover achieves O(N) queries.</p><p><strong>Overshooting and integer rounding</strong></p><p>Because t must be an integer, one either picks the nearest integer to topt​ (giving a high success probability) or uses amplitude amplification variants / quantum counting when k is unknown to avoid large success-probability oscillations.</p><h4>5 Multiple solutions and unknown k</h4><p><strong>Known k</strong></p><p>If k is known, the same analysis applies with θ=arcsin⁡ √k and t≈π/(4θ) The runtime is O(√N/√k)</p><p><strong>Unknown k</strong></p><p>If we don’t know k (a common practical situation), several strategies exist:</p><ol><li><strong>Quantum counting</strong> (next section) estimates k using phase estimation techniques (QFT) on the Grover operator, then run Grover with estimated k.</li><li><strong>Adaptive search schedules</strong>: run Grover for increasing numbers of iterations (e.g., powers of two), measuring after each schedule and restarting until success. This yields expected O(√N/√k) queries up to constant factors.</li><li><strong>Fixed-point search / amplitude amplification</strong>: There exist variants of amplitude amplification that are “fixed-point” (they converge monotonically without oscillation) but give weaker asymptotic constants. These avoid overshooting but are more complex.</li></ol><p>Amplitude amplification generalizes Grover to boost success probability of any (possibly randomized) quantum subroutine A that produces a “good” state with probability p. It uses controlled applications of A, A†, and reflections to boost success to near 1 with O(1/p) repetitions. Grover’s algorithm is amplitude amplification where A is preparing the uniform superposition.</p><h4>6 Quantum counting (estimating k using phase estimation &amp; QFT)</h4><p>Quantum counting uses phase estimation on the Grover operator G. Because G acts as a rotation by angle 2θ in the two-dimensional invariant subspace, its eigenvalues restricted to that subspace are e^(±i2θ). Phase estimation applied to G yields an estimate of 2θ, from which one extracts sin⁡2θ=k and therefore k.</p><p>Summary of procedure:</p><ol><li>Implement controlled-G2j operations (this requires implementing controlled versions of the oracle and diffusion).</li><li>Apply standard phase estimation using an auxiliary register and inverse QFT.</li><li>Read off estimate of the eigenphase φ=2θ/2π (or directly 2θ), convert to θ, then to k=Nsin⁡2θ.</li></ol><p>Quantum counting allows you to determine k (approximately) with cost comparable to a few Grover iterations times the cost of phase estimation (i.e., extra log factors), enabling a near-optimal choice of iterations for Grover afterwards.</p><h4>7 Lower bounds and optimality</h4><p>Grover’s O(√N) query complexity is optimal in the black-box model: Bennett, Bernstein, Brassard, and Vazirani (the BBBV theorem) prove any quantum algorithm that finds a marked item in an unstructured database must make Ω(√N/√k) queries. Informally, one can show that the inner product of states evolves slowly per oracle call, and distinguishing marked vs. unmarked requires Ω(√N) queries when k=1. Thus Grover is asymptotically optimal in the oracle model.</p><p>Two important conceptual distinctions arise:</p><ul><li><strong>Query complexity</strong> counts oracle calls (abstract cost measure).</li><li><strong>Gate complexity</strong> includes the detailed cost of implementing each oracle call and diffusion; real hardware cares about gate depth, qubit count, connectivity, and error rates.</li></ul><h4>8 Grover &amp; quantum walks</h4><p>Grover’s algorithm can be viewed as a special case of <strong>quantum walk</strong> search on the complete graph. Quantum walks are quantum analogues of classical random walks and come in discrete- and continuous-time flavors. They have been used to design search algorithms on structured spaces (graphs, lattices) where items are not uniformly accessible.</p><p>Key points:</p><ul><li><strong>Classical random walk hitting time</strong> is the expected number of steps to reach a marked vertex starting from a distribution. Quantum walks can sometimes <strong>quadratically</strong> reduce hitting times compared to classical random walks (in favorable graphs).</li><li><strong>Szegedy’s quantum walk</strong> framework transforms a classical Markov chain into a quantum walk; its discriminant operator can be expressed as a product of reflections, and search is implemented by introducing an absorbing projector for marked states. This is conceptually analogous to Grover: product of reflections → rotation in an invariant subspace.</li><li><strong>Absorbing walks &amp; detection</strong>: One can model detection of marked states by making them absorbing in a classical walk. The quantum analogue employs a reflection on marked subspace and achieves faster detection via interference.</li><li><strong>Quantum fast-forwarding</strong>: In some contexts, quantum walks can simulate ttt-step classical walk evolution faster (in the sense of fewer quantum steps), which can help in detection tasks.</li></ul><p>Important caveat: the precise speedups on structured graphs depend on geometry and dimension. For example, spatial search on a 2D grid via quantum walk has runtime O(√(Nlog⁡N))(up to polylog factors) rather than exactly O(√N). There are a number of refined results (Ambainis, Childs &amp; Goldstone, Tulsi, etc.) showing varied behaviour. The relationship between Grover and quantum-walk search is deep: Grover is essentially a 0-dimensional (complete graph) quantum walk.</p><h4>9 Practical considerations, resource accounting, and cryptographic impact</h4><p><strong>Gate-level decomposition &amp; cost</strong></p><p>Diffusion operator: D=2|s⟩⟨s|−I is usually implemented via:</p><ol><li>Hadamard on all qubits,</li><li>X on all qubits,</li><li>Multi-controlled-Z (phase flip on |11…1⟩) implemented using ancilla chain or multi-controlled-X (Toffoli cascade) and local gates,</li><li>X on all qubits,</li><li>Hadamard on all.</li></ol><p>On an n-qubit system (i.e. N=2^n), a naive multi-controlled-Z can be implemented with O(n) Toffoli-like gates using ancillas; cost scales polynomially in n. Hence each Grover iteration has depth roughly polynomial in n plus the cost of implementing the oracle.</p><p><strong>Oracle complexity dominates</strong></p><p>If the oracle itself is expensive (e.g., a complex classical test), the time-per-query can be large. Query complexity accounts for the number of oracle calls, but real runtime = (# queries) × (cost per query). In cryptographic contexts, the oracle often is a simple function (e.g., “does this key decrypt ciphertext to known prefix?”), so cost per query may be small — making Grover practically significant.</p><p><strong>Noise and NISQ devices</strong></p><p>Grover requires coherent amplitude amplification across many iterations. Noise and decoherence quickly degrade success probability. For current NISQ hardware, only tiny toy instances are realistic; error-corrected, large-scale quantum computers would be required to realize the theoretical speedups on large N.</p><p><strong>Cryptographic implications</strong></p><p>Grover gives an effective square-root attack on brute-force key search. Effective complexity for a key of length mmm becomes O(2^(m/2)). The concrete mitigation is to double key lengths: AES-128 becomes ~2⁶⁴ work under Grover, so AES-256 (effective ~2¹²⁸) is recommended for long-term security.</p><h4>10 Worked Qiskit example</h4><p>Below is a compact Qiskit-style circuit (annotated) that performs Grover search on n=3 qubits (i.e. N=8) for a single marked state |111⟩. For pedagogy we choose |111⟩ so the oracle is just a multi-controlled phase flip on |111⟩. This is a small, runnable pattern you can adapt.</p><blockquote><strong><em>Note:</em></strong><em> this is illustrative code for Qiskit (API names are standard Qiskit; you can paste it into a recent Qiskit installation).</em></blockquote><pre># Qiskit Grover toy example (3 qubits, marked state |111&gt;)<br>from qiskit import QuantumCircuit, Aer, transpile, assemble<br>from qiskit.visualization import plot_histogram<br><br>n = 3<br>qc = QuantumCircuit(n, n)<br><br># 1) Prepare uniform superposition |s&gt;<br>qc.h(range(n))<br><br># Grover iteration: (oracle) followed by (diffusion)<br>def oracle_mark_111(qc):<br>    # phase flip on |111&gt;: implement CCZ via H on target + CCX<br>    qc.h(2)<br>    qc.ccx(0, 1, 2)    # Toffoli: flips qubit 2 when q0=q1=1<br>    qc.h(2)<br><br>def diffusion(qc):<br>    # inversion about mean: H X (phase flip on |111|) X H<br>    qc.h(range(n))<br>    qc.x(range(n))<br>    qc.h(2)<br>    qc.ccx(0, 1, 2)<br>    qc.h(2)<br>    qc.x(range(n))<br>    qc.h(range(n))<br><br># Number of iterations for N=8, k=1 -&gt; t ≈ floor(pi/4 * sqrt(8)) ≈ 2<br>iterations = 2<br>for _ in range(iterations):<br>    oracle_mark_111(qc)<br>    diffusion(qc)<br><br># Measure<br>qc.measure(range(n), range(n))<br><br># Simulate<br>sim = Aer.get_backend(&#39;aer_simulator&#39;)<br>tqc = transpile(qc, sim)<br>qobj = assemble(tqc, shots=2048)<br>res = sim.run(qobj).result()<br>counts = res.get_counts()<br>print(counts)  # expect &#39;111&#39; to dominate</pre><p>If you run this, you should see a strong peak on &#39;111&#39; (most of the counts) when the number of iterations is chosen near the optimal ttt. If you choose too many iterations you will “overshoot” and the success probability drops due to the rotation dynamics described above.</p><h4>Final remarks, caveats and intuitions</h4><ul><li><strong>Geometric intuition</strong>: Grover repeatedly reflects the state vector about two axes — the marked-subspace reflection (oracle) and the mean reflection (diffusion). The composition of two reflections is a rotation; each Grover iterate rotates the state vector closer to the marked subspace by a fixed angle 2θ.</li><li><strong>Quadratic speedup</strong>: Grover is provably optimal in the black-box model; you cannot do better than O(N/k) queries without additional structure.</li><li><strong>Generality</strong>: Grover is not just for databases — amplitude amplification generalizes the technique to boost success of arbitrary probabilistic quantum routines.</li><li><strong>Quantum-walk extensions</strong>: For searches constrained by geometry or connectivity, quantum-walk based algorithms generalize and sometimes refine the speedups (spatial search, element distinctness etc.). Grover is the special, complete-graph case of these frameworks.</li><li><strong>Practicality</strong>: Oracle cost, gate overhead, and error rates matter. In cryptography, Grover forces a re-evaluation of key sizes and motivates post-quantum-safe symmetric choices.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ecfed53f3b08" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 16 Qucode Cohort 3]]></title>
            <link>https://medium.com/@andreabenassi02/day-16-qucode-cohort-3-947262940688?source=rss-ca66d3ee83a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/947262940688</guid>
            <category><![CDATA[quantum-computing]]></category>
            <category><![CDATA[quantum-cryptography]]></category>
            <category><![CDATA[qucode]]></category>
            <category><![CDATA[cohort-3]]></category>
            <category><![CDATA[quantum-learning]]></category>
            <dc:creator><![CDATA[Andreabenassi]]></dc:creator>
            <pubDate>Wed, 17 Sep 2025 10:08:59 GMT</pubDate>
            <atom:updated>2025-09-17T10:08:59.302Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Topic: Shor’s Algorithm &amp; Quantum Cryptography, Breaking RSA, Post-quantum security</strong></p><p>Cryptography underpins the digital world: from online banking to secure messaging, modern society relies on mathematical guarantees of security. At the heart of today’s cryptographic infrastructure lies RSA, a scheme whose security rests on the difficulty of factoring large integers.</p><p>Yet, in 1994, Peter Shor proposed a quantum algorithm capable of factoring integers exponentially faster than any known classical algorithm. The implications are profound: RSA and related schemes collapse in the presence of large-scale quantum computers.</p><p>This article explores the mathematics of RSA, the workings of Shor’s algorithm, its cryptographic consequences, and the emerging landscape of post-quantum cryptography (PQC), including the NIST-selected algorithms poised to secure our future.</p><h4><strong>1. RSA</strong></h4><p>RSA’s security is based on the difficulty of factoring large semiprimes N=pq, where p and q are very large prime numbers.</p><p><strong>Key Generation</strong></p><ol><li>Select large primes p,q.</li><li>Compute N=pq</li><li>Compute Euler’s totient ϕ(N)=(p-1)(q-1)</li><li>Choose a <strong>public</strong> exponent e coprime with ϕ(N)</li><li>Compute <strong>private</strong> exponent d as the modular inverse:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/252/1*BO2qqIoWpPolTn3WEGiSfg.png" /></figure><p><strong>Encryption &amp; Decryption</strong></p><p>public key is (N, e) and private key is (N, d), for any message M:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*2l6DsqZtEwzx7-JDL0Q8yw.png" /></figure><p>For decrypt the encrypted message C we need …</p><h4>2. Shor’s Algorithm</h4><p>Shor’s breakthrough showed that factoring can be reduced to a period-finding problem, which quantum computers can solve efficiently.</p><p>Given an integer N, choose a random a&lt;N. If GCD(a,N)≠1, we have found a factor. Otherwise, define the order r as the smallest integer such that:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/226/1*VB_n_Qqv95bu9EQHPfmxoA.png" /></figure><p>If r is even and a^(r/2) is not equal to -1(mod N), then:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*IXHBSLHA3tgiMio93xYKcg.png" /></figure><p>yield nontrivial factors of N.</p><p><strong>Quantum Period-Finding</strong></p><p>The core quantum step is to find the period r of the function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*byIOQfnBNkPehP1oV3cPOg.png" /></figure><p>This is achieved by:</p><ol><li>Create Superposition in the input register</li><li>Compute f(x)</li><li>Compute QFT and reveals periodicity in the amplitudes</li><li>Measurement collapsing state to information about rrr</li></ol><p>This is exponentially faster than the best classical algorithms, rendering RSA insecure once scalable quantum hardware exists.</p><h4>3. Demonstrating Shor in Qiskit</h4><p>For pedagogical purposes, Qiskit provides a Shor implementation that can factor small integers like N=15.</p><pre>from qiskit.algorithms import Shor<br><br>shor = Shor()<br>result = shor.factorize(N=15)<br>print(result.factors)  # Example output: [[3, 5]]</pre><p>Though current quantum devices cannot handle RSA-scale keys, the principle is established: <strong>the asymptotic security of RSA collapses in the quantum era</strong>.</p><h4>4. Harvest Now, Decrypt Later</h4><p>A major risk is that encrypted data can be “harvested today and decrypted later”, so save information accessible via public RSA keys now in order to decrypt it once quantum computers are more mature. Sensitive information (e.g., medical, financial, governmental) often remains valuable for decades.</p><p>This is why transitioning to post-quantum secure algorithms is urgent, even before quantum computers capable of breaking RSA exist.</p><h4>5. Post-Quantum Cryptography (PQC)</h4><p>Recognizing the quantum threat, NIST began a standardization process in 2016. In July 2022, it announced the first four algorithms selected from among the 80 submitted for standardization.</p><p><strong>Lattice-Based Cryptography</strong></p><p>Three of the four chosen algorithms are lattice-based, exploiting the hardness of problems like Learning With Errors (LWE) and Module-LWE, which remain secure against both classical and quantum attacks.</p><ol><li><strong>ML-KEM (CRYSTALS-Kyber)</strong> — Key Encapsulation</li><li><strong>ML-DSA (CRYSTALS-Dilithium)</strong> — Digital Signatures</li><li><strong>Falcon</strong> — Digital Signatures</li></ol><p><strong>Hash-Based Cryptography</strong></p><p>4.<strong> SPHINCS+</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=947262940688" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 15 Qucode Cohort 3]]></title>
            <link>https://medium.com/@andreabenassi02/day-15-qucode-cohort-3-258e82934e9b?source=rss-ca66d3ee83a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/258e82934e9b</guid>
            <category><![CDATA[quantum]]></category>
            <category><![CDATA[quantum-computing]]></category>
            <category><![CDATA[quantum-learning]]></category>
            <category><![CDATA[qucode]]></category>
            <category><![CDATA[cohort-3]]></category>
            <dc:creator><![CDATA[Andreabenassi]]></dc:creator>
            <pubDate>Tue, 16 Sep 2025 17:56:48 GMT</pubDate>
            <atom:updated>2025-09-16T19:19:27.743Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Topic: Quantum Phase Estimation and Quantum Fourier Transform</strong></p><p>Quantum algorithms are reshaping the landscape of computation by tackling problems that classical computers find intractable. Two cornerstones in this domain are the Quantum Fourier Transform (QFT) and Quantum Phase Estimation (QPE). These two ideas are deeply interconnected: the QFT provides the mathematical backbone, while QPE builds on it to extract eigenvalue information from unitary operators, a central process to quantum algorithms like Shor’s factoring.</p><h4>1. Why Phases Matter</h4><p>Quantum mechanics encodes information not only in amplitudes but also in phases. When we apply a unitary operator U to a state, its eigenstates satisfy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/208/1*fe6iPGGizhcU0sOUgCaH0g.png" /></figure><p>Here, θ (a number between 0 and 1) represents the phase associated with the eigenvalue. Extracting this hidden phase is crucial: it encodes periodicity, symmetries, and structural insights into the problem at hand. But there’s a challenge, quantum mechanics doesn’t let us directly “read off” the phase, that’s where QPE comes in, leveraging the QFT to efficiently estimate θ.</p><p><strong>2. Quantum Fourier Transform (QFT)</strong></p><p>The QFT is the quantum analogue of the discrete Fourier transform (DFT).</p><p>For an n-qubit system, QFT maps the computational basis state |x⟩ into:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/1*-vacQatXVUhp1nmsfuvHpg.png" /></figure><ol><li>It translates information into the frequency domain.</li><li>Unlike the classical FFT, which takes O(Nlog⁡N), QFT runs in O(n²) gate complexity for n-qubits, where n is the number of bit and N=2^n</li></ol><p><strong>Circuit Structure</strong></p><p>The circuit for QFT on n-qubits involves:</p><ol><li><strong>Hadamard gates</strong> to create superpositions.</li><li><strong>Controlled phase rotations</strong> (with angles decreasing exponentially).</li><li><strong>Swap gates</strong> to reverse qubit order at the end.</li></ol><p>For example for 3 qubits the QFT circuit can be:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*ALggsq_EUSAa8jAyRBOrvw.png" /></figure><p>This structured layering is what allows the QFT to reveal hidden periodicities in quantum states.</p><h4>3. From Phase Kickback to Phase Estimation</h4><p>Before diving into full QPE, it helps to see “phase kickback”, a simple trick where a control qubit, when entangled with a unitary operation U, picks up the eigenphase. <br>For example:<br>Start with ∣+⟩ on the control qubit and ∣ψ⟩ as the eigenstate and apply a controlled-U, since the CU gate change the phase only if the first qubit is 1 the control qubit evolves as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*LTDj8HKSMsfHsmcYXpZ2-w.png" /></figure><p>This shows the phase “kicks back” to the control qubit. QPE generalizes this by using multiple control qubits to extract the binary expansion of 𝜃.</p><h4>4. Quantum Phase Estimation (QPE)</h4><p>The QPE algorithm estimates the eigenphase θ of a unitary operator U given access to: a controlled applications of U; an eigenstate |ψ⟩.</p><p><strong>Steps</strong></p><ol><li><strong>Initialize registers:</strong> first t-qubits register in |0⟩ and the sencond in |ψ⟩</li><li><strong>Create Superposition:</strong> Apply H to the first register to get an equal superposition of all computational basis states.</li></ol><p>3<strong>. Apply Controlled Unitaries: </strong>Each control qubit applies U^(2^k)</p><p>4. <strong>Inverse QFT: </strong>Apply the inverse QFT on the first register to “decode” the phase information.</p><p>5. <strong>Measurement: </strong>Measuring the first register yields a binary estimate of θ.</p><h4><strong>5. Applications of QPE</strong></h4><p>The importance of QPE cannot be overstated, it is the engine behind some of the most celebrated quantum algorithms.</p><ol><li><strong>Order-Finding Problem</strong></li></ol><p>Central to Shor’s factoring algorithm<strong>, </strong>QPE is used to find the order of an integer modulo N, which directly leads to factoring N.</p><p>2.<strong> Hamiltonian Simulation</strong></p><p>Eigenvalues of a Hamiltonian correspond to energy levels of a system, QPE allows quantum computers to estimate these eigenvalues efficiently, a game-changer for quantum chemistry and materials science.</p><p>3.<strong> Eigenvalue Problems</strong></p><p>Beyond physics, eigenvalues and eigenvectors are ubiquitous in applied math, data science, and optimization, QPE provides a direct quantum pathway to these solutions.</p><h4>6. Implementation in Qiskit</h4><p>Qiskit provides ready-to-use primitives for both QFT and QPE.</p><pre>from qiskit.circuit.library import QFT<br>from qiskit.algorithms import PhaseEstimation<br>from qiskit import Aer, execute<br><br># Example: QFT on 3 qubits<br>qft3 = QFT(3)<br>qft3.decompose().draw(&#39;mpl&#39;)<br><br># Phase Estimation<br>from qiskit.circuit.library import ZGate<br><br>unitary = ZGate()  # simple unitary with eigenvalue -1 (phase π)<br>qpe = PhaseEstimation(num_evaluation_qubits=3, unitary=unitary)</pre><p>Qiskit also provides simulation backends and access to real quantum hardware, making it possible to experiment with QPE at <strong>SMALL</strong> scales today.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=258e82934e9b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 14 Qucode Cohort 3]]></title>
            <link>https://medium.com/@andreabenassi02/day-14-qucode-cohort-3-cd6327d88dc2?source=rss-ca66d3ee83a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd6327d88dc2</guid>
            <category><![CDATA[cohort-3]]></category>
            <category><![CDATA[quantum-computing]]></category>
            <category><![CDATA[qucode]]></category>
            <category><![CDATA[quantum-learning]]></category>
            <category><![CDATA[quantum]]></category>
            <dc:creator><![CDATA[Andreabenassi]]></dc:creator>
            <pubDate>Mon, 15 Sep 2025 15:54:49 GMT</pubDate>
            <atom:updated>2025-09-15T15:54:49.981Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Topic: Qiskit introduction, Writing first quantum circuit</strong></p><p>Quantum computing is no longer purely theoretical. With frameworks like Qiskit, developers and researchers can design, simulate, and execute quantum circuits on real hardware from IBM Quantum.</p><h4>1. Overview of Qiskit</h4><p>Qiskit is an open-source Python framework for quantum computing, developed by IBM. It is modular, with a layered architecture that separates concerns from high-level circuit design to low-level hardware execution.</p><p><strong>Main Components</strong></p><p><strong>Qiskit Terra</strong></p><ol><li>Core foundation of Qiskit.</li><li>Provides classes to build, manipulate, and optimize quantum circuits.</li><li>Handles circuit compilation and transformations to map high-level circuits to hardware constraints.</li></ol><p><strong>Qiskit Aer</strong></p><ol><li>Simulation backend for quantum circuits.</li><li>Offers high-performance classical simulation for testing and debugging circuits before running them on real quantum hardware.</li><li>Supports statevector simulation, unitary simulation, and noise models.</li></ol><p><strong>Qiskit Ignis</strong> (deprecated)</p><ol><li>Focused on quantum error correction and characterization.</li><li>Provides tools for noise analysis, benchmarking, and error mitigation.</li></ol><p><strong>Qiskit Aqua</strong> (now replaced by Qiskit Machine Learning, Nature, Optimization, and Finance)</p><ol><li>Domain-specific algorithms for quantum chemistry, optimization, and machine learning.</li><li>Provides pre-built algorithms that integrate with Terra for execution.</li></ol><p><strong>Qiskit Providers</strong></p><ol><li>Interfaces with quantum hardware (IBM Quantum backends) or third-party simulators.</li><li>The provider manages backend selection, job submission, and result retrieval.</li></ol><h4>2. Core Classes and Concepts in Qiskit</h4><p>Understanding Qiskit’s main classes is key to writing and executing quantum programs:</p><h3>QuantumRegister &amp; ClassicalRegister</h3><ul><li>QuantumRegister(n): group of n qubits.</li><li>ClassicalRegister(n): group of n classical bits for measurement results.</li></ul><h3>QuantumCircuit</h3><p>Fundamental object for creating quantum circuits, they combine quantum registers, classical registers, and a sequence of gates.</p><p>Example gates: H (Hadamard), X(Pauli-X), CX (CNOT), Measure and so on...</p><h3>Backend</h3><p>It is an abstract representation of a quantum device or simulator, some example are “aer_simulator” for classical simulation and “ibm_torino” for real IBM hardware</p><h3>Transpiler</h3><p>Optimize circuits for specific backends. In most real quantum computers, the gates implemented as hardware are very limited. For example, the H gate is usually not implemented directly, but is achieved by combining multiple rotational gates, so the process of converting the H gate into multiple rotational gates, taking into account gate constraints, is performed in transpilation.<br>But transpilation is also the process in which abstract circuits are mapped onto physical qubits, taking into account connectivity constraints.</p><p>Functions: transpile(circuit, backend).</p><h3>Job</h3><p>Represents a submitted circuit execution, It handles asynchronous execution, job status, and result retrieval.</p><p>execute(circuit, backend) returns a Job object.</p><h3>Result</h3><p>Stores the measurement outcomes of a circuit execution.</p><p>Accessible via job.result() and supports counting occurrences of each output state.</p><h4>3. A simple Quantum Circuit</h4><pre>from qiskit import QuantumCircuit, Aer, execute, transpile<br><br># 1. Create a quantum circuit with 2 qubits and 2 classical bits<br>qc = QuantumCircuit(2, 2)<br><br># 2. Apply Hadamard gate to the first qubit<br>qc.h(0)<br><br># 3. Apply CNOT gate with qubit 0 as control and qubit 1 as target<br>qc.cx(0, 1)<br><br># 4. Measure both qubits<br>qc.measure([0, 1], [0, 1])<br><br># 5. Visualize the circuit<br>print(qc.draw())</pre><p>This circuit generates a maximally entangled state, where measuring one qubit instantly determines the state of the other.</p><p>After create the circuit we can simulate it before running on real hardware, using Qiskit Aer.</p><pre># Use the Aer simulator backend<br>simulator = Aer.get_backend(&#39;aer_simulator&#39;)<br><br># Transpile circuit for the simulator<br>compiled_circuit = transpile(qc, simulator)<br><br># Execute the circuit<br>job = execute(compiled_circuit, simulator, shots=1024)<br>result = job.result()<br><br># Get counts (measurement statistics)<br>counts = result.get_counts(qc)<br>print(&quot;Measurement results:&quot;, counts)</pre><p>This shows the probabilistic nature of quantum measurement, with equal probability of outcomes 00 and 11, in a simulation without noise we should be able to seen a result similar to Measurement results: {‘00’: ~512, ‘11’: ~512}</p><p>Now we can execute the circuit in a real IBM hardware but we need first create a token on IBMQ platform: <a href="https://quantum.cloud.ibm.com/">https://quantum.cloud.ibm.com/</a> for free we have 10 minute of execution</p><pre>from qiskit import IBMQ<br><br># Load your IBM Quantum account<br>IBMQ.load_account()<br>provider = IBMQ.get_provider(hub=&#39;ibm-q&#39;)<br><br># Select a backend (real device)<br>backend = provider.get_backend(&#39;ibmq_torino&#39;) #verify your availabilty<br><br># Transpile circuit for the backend<br>compiled_circuit = transpile(qc, backend)<br><br># Execute on real hardware<br>job = execute(compiled_circuit, backend, shots=1024)<br>result = job.result()<br>counts = result.get_counts(qc)<br>print(&quot;Hardware measurement results:&quot;, counts)</pre><p>Unlike simulation, real hardware results include noise and might slightly deviate from ideal statistics. Qiskit allows incorporating error mitigation techniques to improve accuracy.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd6327d88dc2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 13 Qucode Cohort 3]]></title>
            <link>https://medium.com/@andreabenassi02/day-13-qucode-cohort-3-9c464bbd7029?source=rss-ca66d3ee83a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c464bbd7029</guid>
            <category><![CDATA[quantum]]></category>
            <category><![CDATA[cohort-3]]></category>
            <category><![CDATA[quantum-computing]]></category>
            <category><![CDATA[quantum-learning]]></category>
            <category><![CDATA[qucode]]></category>
            <dc:creator><![CDATA[Andreabenassi]]></dc:creator>
            <pubDate>Sun, 14 Sep 2025 16:42:54 GMT</pubDate>
            <atom:updated>2025-09-14T16:51:29.202Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Topic: Circuit model, Adiabatic QC, Measurement-based QC</strong></p><p>Quantum computing is rapidly evolving from theoretical constructs into practical frameworks for computation. While most popular discussions focus on algorithms like Shor’s or Grover’s, it is crucial to understand the foundational paradigms that underpin quantum computation. In this article, we dive deep into three fundamental models: the Circuit Model, Adiabatic Quantum Computing (AQC), and Measurement-Based Quantum Computing (MBQC).</p><h4>1. The Circuit Model of Quantum Computation</h4><p>The circuit model is arguably the most familiar paradigm, closely mirroring classical digital circuits but operating on quantum bits (qubits) instead of classical bits. The basic idea is to represent quantum algorithms as sequences of unitary operations (quantum gates) applied to qubits, followed by measurements to extract classical results.</p><p><strong>Universal Gate Set</strong></p><p>Any quantum circuit can, in principle, be decomposed into a small universal set of gates:</p><ol><li><strong>Single-qubit gates:</strong> The Hadamard (H) and T gates are sufficient to implement any single-qubit unitary transformation.</li><li><strong>Two-qubit gate:</strong> The Controlled-NOT (CNOT) gate is enough to entangle qubits.</li></ol><p>Remarkably, this minimal set of gates suffices to construct <strong>arbitrary quantum circuits</strong>, meaning any unitary transformation on a system of qubits can be realized by combining these elementary operations.</p><p><strong>Measurement at the End</strong></p><p>Once the quantum computation completes, we perform measurements on the qubits to obtain classical information. These measurements collapse the quantum state into one of the basis states, giving probabilistic outcomes that reflect the amplitudes of the superposed states.</p><p>The circuit model provides a concrete, step-by-step approach to quantum computation and forms the backbone of most quantum algorithm implementations on hardware such as IBM Q, Rigetti, or IonQ.</p><h4>2. Adiabatic Quantum Computing (AQC)</h4><p>Adiabatic Quantum Computing offers a radically different perspective. Instead of manipulating qubits through discrete gates, AQC leverages continuous evolution of a quantum system under a slowly changing Hamiltonian.</p><p><strong>The Core Idea</strong></p><ul><li>Begin with a system in the ground state of an initial, easily-preparable Hamiltonian H0H_0H0​.</li><li>Slowly evolve the system toward a problem Hamiltonian HP​, whose ground state encodes the solution to a computational problem.</li><li>If the evolution is slow enough (adiabatic), the system remains in its ground state throughout, and the final measurement yields the solution with high probability.</li></ul><p>Mathematically, the adiabatic theorem guarantees that a system evolving under a time-dependent Hamiltonian H(t)=(1−s(t))H0+s(t)H​, with s(0)=0 and s(T)=1, will remain in the instantaneous ground state if T is sufficiently large compared to the inverse of the minimum energy gap between the ground and first excited states.</p><p><strong>Advantages and Challenges</strong></p><ul><li>AQC is particularly suited for <strong>optimization problems</strong>.</li><li>Physical implementations include <strong>quantum annealers</strong> like D-Wave.</li><li>The main challenge lies in maintaining adiabaticity and avoiding transitions to excited states in real hardware.</li></ul><p>AQC illustrates the power of quantum mechanics to solve certain problems <strong>continuously</strong>, rather than through discrete gate sequences.</p><h4>3. Measurement-Based Quantum Computing (MBQC)</h4><p>Measurement-Based Quantum Computing (also called the one-way quantum computer) is a striking paradigm in which measurements, rather than unitary gates, drive computation.</p><p><strong>The Basic Mechanism</strong></p><ul><li>Start with a highly entangled cluster state across multiple qubits.</li><li>Perform sequential measurements on qubits in specific bases</li><li>Each measurement probabilistically projects the system into a new state, effectively implementing quantum gates on the remaining unmeasured qubits.</li></ul><p><strong>Example: Single-Qubit Transformation via Measurements</strong></p><p>Consider a qubit in an arbitrary state ∣ψ⟩ and an auxiliary qubit initialized in ∣0⟩. The goal is to apply an arbitrary unitary U to ∣ψ⟩ using only measurements:</p><ol><li>Measure a two-qubit observable B, carefully constructed so that it has eigenvalues ±1 and acts on both qubits.</li><li>Depending on the outcome, the system is projected onto one of the eigenstates of B.</li><li>Perform a second measurement on the auxiliary qubit in the standard basis.</li><li>Repeat the process probabilistically until the second qubit achieves the transformed state U∣ψ⟩.</li></ol><p>This approach is probabilistic: the expected number of iterations for success is 2 in the simplest case, but the method can be extended to multi-qubit operations, demonstrating universality comparable to the circuit model.</p><h3>Key Properties</h3><ul><li>Universality: MBQC can implement arbitrary single- and multi-qubit gates using only measurements.</li><li>Probabilistic algorithm: The computation is not deterministic per run but converges with repeated measurements.</li><li>Decoupling of entanglement and computation: All entanglement is prepared upfront, and computation proceeds through local operations (measurements).</li></ul><p>MBQC reveals the profound difference between classical and quantum computation: measurement, a fundamentally probabilistic process, can itself serve as the engine of computation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c464bbd7029" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 12 Qucode Cohort 3]]></title>
            <link>https://medium.com/@andreabenassi02/day-12-qucode-cohort-3-b2f6117a665a?source=rss-ca66d3ee83a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2f6117a665a</guid>
            <category><![CDATA[cohort-3]]></category>
            <category><![CDATA[quantum-learning]]></category>
            <category><![CDATA[qucode]]></category>
            <category><![CDATA[quantum-computing]]></category>
            <category><![CDATA[quantum]]></category>
            <dc:creator><![CDATA[Andreabenassi]]></dc:creator>
            <pubDate>Sat, 13 Sep 2025 17:16:53 GMT</pubDate>
            <atom:updated>2025-09-13T17:16:53.075Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Topic: Quantum Measurement &amp; No-Cloning Theorem; Projective measurement, Collapse of the wavefunction</strong></p><p>In classical physics, measurement feels straightforward. If we measure the position of a ball, we simply find out where it is. The act of measurement does not fundamentally alter the ball’s reality, it only updates our knowledge. Quantum mechanics, however, radically challenges this intuition. <strong>Measurement does not just reveal properties of a system, in a deep sense, it defines them.</strong></p><p>Understanding quantum measurement is essential for both the conceptual foundations of quantum mechanics and its applications in quantum information science. In this article, we’ll explore:</p><ol><li>Projective measurement and the mathematics behind it</li><li>The notion of wavefunction collapse and its interpretation</li><li>The no-cloning theorem, which sets fundamental limits on information in the quantum world</li></ol><h4>1. Quantum Measurement: The Basics</h4><p>At the heart of quantum mechanics lies the principle that systems are described by a wavefunction |ψ⟩, a complex vector in Hilbert space. Observables (like spin, position, or energy) are represented by Hermitian operators, when we measure an observable, the theory prescribes two essential rules:</p><ol><li><strong>Outcome probabilities:</strong> The probability of obtaining a specific outcome (oi)​, associated with an eigenstate (|oi<strong>⟩</strong>), is given by:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/238/1*Ac5Y6ysWasNs8BVPMJqRGw.png" /><figcaption>equivalent to P(oi)=⟨ψ|Pi|ψ⟩</figcaption></figure><p>2.<strong> Post-measurement state:</strong> After observing outcome oi, the system’s wavefunction collapses to that eigenstate:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/152/1*fEtmI7hGS2t1xJpQKOYgWw.png" /></figure><p>This is very different from classical probability, the act of measurement is not just revealing a preexisting value, it reshapes the state itself.</p><h4>2. Projective Measurement</h4><p>In quantum information, the most common type of measurement is the projective measuremen<strong>t</strong>, also known as a von Neumann measurement.</p><ul><li>Each measurement is defined by a set of projection operators Pi=|oi⟩⟨oi|, which are orthogonal projectors onto eigenstates of the observable.</li><li>The measurement outcome is random, following the Born rule P(oi)=⟨ψ|Pi|ψ⟩.</li><li>After the measurement, the system’s state updates according to:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/232/1*8Wwf10BTTERTdZguhdI5Ug.png" /></figure><p>This rule formalizes what physicists call the <strong>collapse of the wavefunction</strong>: measurement reduces the coherent superposition to a single outcome.</p><p>For example, suppose a qubit is in the state:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/190/1*f0Wery5zlzYzEY6NZYfdHg.png" /></figure><p>A projective measurement in the computational basis {∣0⟩,∣1⟩} yields outcome “0” with 50% probability (collapsing the state to |0⟩) and outcome “1” with 50% probability (collapsing to |1⟩). Before measurement, the qubit was in a superposition; after, it is in a definite state.</p><h4>3. Collapse of the Wavefunction: Physics or Epistemology</h4><p>The <strong>collapse postulate</strong> has sparked debate since the birth of quantum theory. Is collapse a real, physical process, or is it simply a mathematical update to our knowledge?</p><ul><li><strong>Copenhagen interpretation:</strong> Collapse is real in the sense that quantum states only gain definite properties upon measurement.</li><li><strong>Many-worlds interpretation:</strong> No collapse occurs; instead, the universe branches into parallel worlds, each realizing a possible outcome.</li><li><strong>Objective collapse models (GRW, Penrose):</strong> Collapse is an actual physical phenomenon, potentially tied to gravity or new dynamics.</li></ul><p>The experimental predictions of these interpretations are almost identical for laboratory physics, but conceptually they differ drastically. This is why wavefunction collapse remains one of the deepest puzzles in quantum theory.</p><p><strong>4. The No-Cloning Theorem: Why Quantum Information Cannot Be Copied</strong></p><p>In classical computing, copying information is trivial. We can duplicate a file or replicate a string of bits endlessly. In quantum mechanics, however, there is a strict prohibition: <strong>unknown quantum states cannot be cloned.</strong></p><p>Suppose there were an operator capable of copy a quantum state U, so this operator can takes an unknown state |ψ⟩ and a blank state |0⟩, and outputs two copies:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/248/1*UdxSetmlBP2ptkNVfXFnxw.png" /></figure><p>If this worked for all states, it would be linear. But consider two states |ψ⟩ and |ϕ⟩ and their superposition 1/√2 (|ψ⟩ + |ϕ⟩), in this case we can write:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*zXyBEb9DfA-OuiE1pWyJmw.png" /></figure><p>but, for lienarity, we can also write that:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*Fm-MGbefZ9WuwDkiazNQig.png" /></figure><p>Since both statements must be true we should need dimonstrate that the following equation should be true for each couple of |ψ⟩ and|ϕ⟩:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*5VhOqC_iBxLTP86TN8A_CA.png" /></figure><p>but we can easily see that the equation is true only if |ψ⟩=|ϕ⟩, so we have demonstrated that an operator U capable of copying arbitrary states is not feasible.</p><h3>Implications</h3><ul><li><strong>Security in quantum cryptography:</strong> The no-cloning theorem guarantees the security of protocols like <strong>quantum key distribution (QKD)</strong>: an eavesdropper cannot copy transmitted qubits without disturbing them.</li><li><strong>Fundamental limit:</strong> It highlights a deep difference between classical and quantum information. While classical data can be freely duplicated, quantum data is unique, fragile, and inseparable from its physical medium.</li></ul><h4>5. Measurement, Collapse, and No-Cloning: The Common Thread</h4><p>Both <strong>collapse</strong> and <strong>no-cloning</strong> emphasize the <em>irreversibility</em> of quantum measurement. Measurement destroys coherence, leaving a definite outcome that cannot be undone. Similarly, no-cloning prevents us from making perfect backups of unknown states.</p><p>Together, these principles explain why quantum systems are simultaneously powerful (enabling quantum computing and communication) and delicate (fragile to observation and noise). They also explain why quantum information protocols must be designed carefully to extract useful results without destroying the underlying quantum resources.</p><h4>Conclusion</h4><p>Quantum measurement forces us to rethink the very act of observation. Unlike classical systems, where measurement reveals a preexisting truth, quantum systems exist in superposition until measured. Projective measurement formalizes this with the Born rule and wavefunction collapse, while the no-cloning theorem ensures that quantum information cannot be duplicated.</p><p>These ideas, once seen as philosophical curiosities, now define the architecture of quantum technologies. Every quantum computer, quantum cryptographic scheme, and quantum communication protocol depends on the interplay between <strong>what can be measured, what cannot be copied, and how reality itself responds when we look at it.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2f6117a665a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 11 Qucode Cohort 3]]></title>
            <link>https://medium.com/@andreabenassi02/day-11-qucode-cohort-3-8767fade4a60?source=rss-ca66d3ee83a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/8767fade4a60</guid>
            <category><![CDATA[quantum-physics]]></category>
            <category><![CDATA[qucode]]></category>
            <category><![CDATA[quantum-computing]]></category>
            <category><![CDATA[quantum]]></category>
            <category><![CDATA[quantum-learning]]></category>
            <dc:creator><![CDATA[Andreabenassi]]></dc:creator>
            <pubDate>Thu, 11 Sep 2025 20:23:44 GMT</pubDate>
            <atom:updated>2025-09-11T20:23:44.330Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Topic: Bell states, EPR paradox, Non-locality</strong></p><p>Quantum entanglement is one of the most striking and conceptually important predictions of quantum theory. It produces correlations so strong that, once carefully formalized, they force us to re-examine deep assumptions about the world: locality, realism, and the nature of physical explanation.</p><h4>1. Bell states — the simplest maximally entangled pairs</h4><p>Bell states are four special two-qubit states that form a maximally entangled orthonormal basis for the 2-qubit Hilbert space. They are compact examples of perfect quantum correlations:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/326/1*5URJXHnq_e3HXj2Ljw0gaw.png" /></figure><p>If two parties (commonly called Alice and Bob) share |Φ+⟩, then measurements of their qubits in the same computational basis always produce the same outcome: both 0 or both 1, with equal probability 1/2. Locally each outcome is random, but jointly the results are perfectly correlated. These states are the canonical examples used to illustrate entanglement and its paradoxical features.</p><h4>2. The EPR paradox</h4><p>In 1935 Einstein, Podolsky and Rosen (EPR) posed a thought experiment intended to show that the quantum description of physical reality could not be complete. Their argument rests on two intuitive assumptions:</p><ol><li><strong>Reality:</strong> If we can predict with certainty (probability 1) the value of a physical quantity without disturbing the system, then that quantity corresponds to an “element of physical reality.”</li><li><strong>Locality (separability):</strong> A choice of measurement performed at one location cannot instantaneously change the real physical properties of a distant, non-interacting system.</li></ol><p>EPR showed that, for certain entangled states, measurement on system A allows one to predict with certainty the result of measuring some observable on system B, without disturbing B. Invoking the “reality” criterion, EPR concluded that the outcome-values for different, incompatible observables on B must be predetermined (hidden variables), and therefore that the standard quantum description (which assigns only a wave function) is incomplete. Their paper posed a challenge: either quantum mechanics is incomplete, or one of the EPR assumptions must fail.</p><h4>3. Bell’s theorem</h4><p>EPR left a choice: supplement quantum mechanics with extra (hidden) variables that restore locality and realism, or accept some radical revision of our intuitions. In 1964 John Bell provided a precise, testable answer. He showed that any theory based on local hidden variables (i.e., that respects locality and assigns preexisting values to measurement outcomes) must satisfy certain inequalities, the Bell inequalities, that constrain the statistics of measurement outcomes. Quantum mechanics predicts violations of these inequalities for suitable entangled states and measurement settings. Thus, Bell turned an interpretive discussion into an experimental question: perform the Bell test and see whether nature obeys the inequality (local realism) or the quantum prediction (violation)</p><p>A commonly used, experimentally friendly version is the CHSH inequality. Denote by E(a,b) the expectation of the product of Alice’s and Bob’s ±1 measurement outcomes when they measure along settings a and b. <strong>Local realistic theories</strong> must satisfy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*6FkIGbzzHh51Mtiui0bW0g.png" /></figure><p>The empirical violation of such a bound is the smoking gun that rules out all local hidden-variable explanations. (The derivation of the inequality is simple algebra once you assume preexisting results independent of distant choices; Bell’s insight was to translate the conceptual EPR debate into this crisp statistical test). Whereas quantum mechanics for an optimally chosen pair of measurements on a maximally entangled state can reach the Tsirelson bound:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/162/1*-7tI1gQDwuP5M18mISmk_A.png" /></figure><h4>4. Experiments — from Clauser to Aspect to loophole-free tests</h4><p>Bell’s theorem motivated decades of experiments. Initial tests in the 1970s (Clauser and Freedman, Clauser et al.) showed agreement with quantum predictions but left experimental loopholes that, in principle, could be exploited by local realist models (detection inefficiencies, setting-choice correlations, etc.). The experiments of Alain Aspect and collaborators in the early 1980s were pivotal; Aspect implemented fast, time-varying analyzers so that measurement settings were changed while entangled photons were in flight, thus addressing the issue of “locality”, and reported violations consistent with quantum mechanics, strengthening the case against local hidden variables.</p><p>More recently, beginning in 2015, several experiments closed the major remaining loopholes simultaneously (so-called “loophole-free” Bell tests). A notable example is Hensen et al. (2015), which used distant electron-spin qubits and event-ready entanglement to close both locality and detection loopholes; their results are inconsistent with local realism without additional assumptions. Since then multiple platforms (photonic, ionic, solid-state) have produced loophole-free violations, consolidating the empirical case.</p><h4>5. What “non-locality” actually means</h4><ol><li><strong>Non-local correlations</strong>: The observed violations of Bell inequalities imply that the joint statistics of outcomes on entangled systems cannot be reproduced by any model that both (i) assigns local preexisting values to measurement outcomes and (ii) forbids influences that propagate faster than light between measurements. In that technical sense, nature is incompatible with local realism.</li><li>No faster-than-light signalling: Crucially, quantum non-locality does not allow controllable faster-than-light communication. Although outcomes are correlated in ways that cannot be explained by local hidden variables, the marginal probabilities for outcomes at Alice’s side alone are independent of which measurement Bob chooses to perform. This is the content of the no-signalling theorem: entanglement produces correlations, not causal signalling. So special relativity’s prohibition on superluminal signalling remains safe. (Bell-type violations force a reassessment of certain classical intuitions about causation and reality, but they do not automatically give a practical method to send messages faster than light).</li><li>Which intuition must go? Different interpretations drop different assumptions: hidden-variable programs (like Bohmian mechanics) retain realism but accept non-local dynamics; orthodox Copenhagen–type readings abandon realism about preexisting measurement values; Everett (many-worlds) reshapes the notion of single outcomes. Bell’s theorem does not single out one interpretation as uniquely correct; it rather narrows the logical space of consistent alternatives. The experimental violations simply remove local hidden variables from that space.</li></ol><h4>6. Why Bell matters (practical and conceptual consequences)</h4><ol><li><strong>Foundations:</strong> Bell converted a philosophical debate into an empirical science. It turned metaphysical questions (Are there hidden variables? Is the world locally causal?) into measurable inequalities.</li><li><strong>Quantum technologies:</strong> Entanglement and non-local correlations are not just philosophical curiosities — they are resources. Quantum cryptography, device-independent protocols, randomness certification, and teleportation all rely on entanglement and on the certifiable violation of Bell-type inequalities. Zeilinger’s and co-workers’ experimental developments in entanglement distribution and teleportation paved the way towards quantum communication and networks.</li><li><strong>Ongoing research:</strong> Experiments continually tighten loopholes, test higher-dimensional and multipartite Bell inequalities (GHZ and beyond), and investigate the interface between quantum theory and relativity. All of this deepens our empirical grasp of non-classical correlations.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8767fade4a60" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 10 Qucode Cohort 3]]></title>
            <link>https://medium.com/@andreabenassi02/day-10-qucode-cohort-3-f8a7f33d093c?source=rss-ca66d3ee83a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8a7f33d093c</guid>
            <category><![CDATA[quantum-computing]]></category>
            <category><![CDATA[quantum-learning]]></category>
            <category><![CDATA[qucode]]></category>
            <category><![CDATA[cohort-3]]></category>
            <category><![CDATA[quantum-physics]]></category>
            <dc:creator><![CDATA[Andreabenassi]]></dc:creator>
            <pubDate>Thu, 11 Sep 2025 09:28:03 GMT</pubDate>
            <atom:updated>2025-09-11T09:28:03.720Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Topic: Quantum parallelism, Interference in quantum states</strong></p><p>Quantum computing differs from classical computing in two key ways: quantum parallelism, which is the ability to “evaluate” a function with multiple inputs via superposition, and interference, which is the coherent sum of complex amplitudes that can amplify or cancel out results. They are not enough on their own. The measure limits the information obtained. However, when combined intelligently, as in the work of Deutsch, Bernstein-Vazirani, Grover, and Shor, they provide algorithmic advantages.</p><h4>Quantum parallelism</h4><p>Quantum parallelism is the phenomenon whereby a register in superposition of all possible inputs undergoes a reversible “classical” operation that simultaneously produces evaluations of the function on all those inputs in the form of amplitudes, rather than as independent measurable values.<br>Formally, for a Boolean function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/1*BZKuEpZnCfkd1CXP4CsJ_g.png" /></figure><p>and a reversible implementation (oracle):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/48/1*YGe8AvbqAVYRhL_WbtGDdA.png" /></figure><p>acting as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/316/1*8DCHORFWuT8ALaiVkNIEGQ.png" /></figure><p>Preparing the first register in superposition and the second in an appropriate state causes the oracle to produce a state incorporating all evaluations of f(x) in the amplitudes. However, if you measure immediately, you will only see the output for a single x. To obtain useful information about multiple values of f(x), the circuit must be designed so that the amplitudes interfere constructively or destructively to produce the desired result (e.g., “Is the function constant or balanced?”). This principle was exploited in early quantum algorithms.</p><h4>Deutsch’s problem</h4><p>The Deutsch problem is the simplest example showing that a single call to a quantum oracle can determine whether a function f:{0,1}→{0,1} is constant (has the same value for 0 and 1) or balanced (has different values). In classical terms, this requires at least two evaluations.</p><p>The step for the Deutsch’s problem are:</p><ol><li>First, we prepare the first qubit in 1 so that we can exploit phase applications and ensure that in different cases these phases cancel each other out or add up.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/368/1*Temltumn-_hbjWxAG_LusQ.png" /></figure><p>2. And after we put our input and output register in a linear superposition</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*ZIuZV_0_h_Q62KjlA9rpPg.png" /></figure><p>3. Once we have prepared the state we can exploit the quantum parallelism and apply the Uf operator</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*psrj77myOSQDiLh1FuDHLA.png" /></figure><p>4. Now we can see that if f is constant f(0)=f(1) otherwise f(0) is equal to the value of f(1) negated, so in the case f is constant we can collect f(0) with f(1) and the value negated too:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*aTNBNzc2SupFgqLVwYAKrg.png" /></figure><p>otherwise we can collect f(0) with the value of f(1) negated and f(1) with the value of f(0) negated:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*458PYUfM2Dt3_0Bqh3J4xA.png" /></figure><p>So, in this case, we can see that by applying another H gate to the input register, we will obtain 0 if the function is constant or 1 otherwise.</p><h4>Interference</h4><p>Interference is the rule for the sum of complex amplitudes. If you have two paths (or two wave components) with amplitudes a and b, the probability of the final event is</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*ZNRMiCDk0lN0X4yJ7wp9Tg.png" /></figure><p>Depending on the relative phase of a and b, the cross term 2Re(ab*) can be positive (constructive) or negative (destructive). Quantum algorithms exploit this property by engineering circuits that cause constructive interference between the amplitudes corresponding to the correct answers and destructive interference between those corresponding to the incorrect answers.</p><p>In Deutsch, Oracle + Hadamard is exactly that: the Oracle puts phases −1^f(x). The second Hadamard sums the amplitudes with weights of ±1, which cancel out the “wrong” cases and amplify the “right” ones.</p><h4>Entanglement e interference</h4><p>Now, on to the most subtle and important part: how interference and entanglement influence each other.</p><p><strong>Interference:</strong> is the phenomenon of the coherent summation of amplitudes, which can be observed with a single overlapping system (e.g., a double slit).</p><p><strong>Entanglement:</strong> is a composite state that cannot be factorized into a product of local states, and statistical correlations between parts of the system can exhibit non-classical behavior.</p><p>These are different yet related concepts. Entanglement creates multi-particle amplitudes, such as ∣00⟩ and ∣01⟩, and these amplitudes can interfere with each other during joint measurements.</p><p><strong>Effect of local phases e^iϕ:</strong></p><p>Consider Bell’s state (one of the best examples of entanglement):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/236/1*nClME4nrwSp__D7QsQ-vCw.png" /></figure><p>If you apply a local phase to the second qubit, i.e., the operator U=diag(1,eiϕ) (a rotation around local Z), the state becomes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/216/1*74hL3LAa8mHtP0G9kma51g.png" /></figure><p><strong>Note:</strong></p><ol><li>The reduced density of each qubit remains maximally mixed (i.e., there is no change in local statistics); therefore, local measurements on a single qubit fail to detect ϕ.</li><li>However, joint measurements (i.e., measurements that examine correlations) detect the change in ϕ. For example, when measuring both qubits in the basis {∣+⟩, ∣−⟩} (the eigenstates of X), the probabilities of joint outcomes depend explicitly on ϕ.</li></ol><p>The relative phase between entangled terms does not change local statistics, but modifies interference in joint measurements; in fact, it orients observable correlations. This is precisely why local phases do not change the amount of entanglement (local unitaries do not change entanglement), but they do change the appearance of interference in the chosen measurements.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8a7f33d093c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>