Quantum Computing for Data Scientists: Qubits, Quantum Algorithms, and Real World Applications (Part-2)
From concept to code - what a qubit actually looks like, and where it's already being put to work
Himanshu Manghnani
10/15/20266 min read


That last result is the actual, visible signature of entanglement: the two qubits are correlated so tightly that "half of each" never happens - only "both the same," every single time.
Real-World Applications: Back to the Portfolio
Part 1 used portfolio optimization as a running example, and it's worth returning to with real specifics, because finance is genuinely one of the furthest-along industries in moving this from theory to pilot. The typical approach reframes the problem as a QUBO (quadratic unconstrained binary optimization): each candidate holding becomes a binary buy/hold/sell decision variable, and the objective function balances expected return against a risk measure like Conditional Value at Risk, subject to sector and transaction: cost constraints. A QAOA circuit then searches for the lowest "energy" combination of those binary variables i.e. the quantum-mechanical equivalent of finding the best portfolio.
> Barclays has worked with IBM to demonstrate exactly this kind of QAOA and Variational Quantum Eigensolver approach for portfolio construction, adapted to handle transaction costs, regulatory constraints, and risk limits.
>JPMorgan Chase, working with Argonne National Laboratory and Quantinuum, demonstrated a measurable quantum speedup using QAOA on problems spanning finance, logistics, and materials science.
>NatWest, meanwhile, has explored a quantum-inspired classical approach using Fujitsu's Digital Annealer for asset allocation - a reminder that some of today's real value comes from algorithms borrowing quantum ideas without needing quantum hardware at all.
The realistic scale of these pilots matters too: a portfolio optimization spanning a thousand assets typically gets reduced to a 50-asset benchmark before running on real quantum hardware today, with results validated against a classical solver before anyone considers scaling further. That's not a limitation to be embarrassed about - it's exactly the disciplined, hybrid approach the Skeptic's Corner in Part 1 pointed toward.
Where Data Scientists stand today:
None of this is ready to replace a production ML pipeline, and treating it that way would be a mistake. But the gap between "interesting physics" and "usable subroutine inside a hybrid workflow" has narrowed substantially, and it keeps narrowing. IBM's own public roadmap draws a clear line between quantum advantage - targeted for this year, in narrow domains and full fault tolerance, which remains years out.
For a data scientist today, the actionable takeaway isn't "learn quantum computing instead of AI." It's "learn quantum computing alongside AI, for the specific class of problems - combinatorial optimization chief among them that classical and generative approaches were never built to solve exactly." Qiskit, a simulator, and an afternoon are enough to start building that literacy before it becomes a job requirement rather than a differentiator.


From concept to code - what a qubit actually looks like, and where it's already being put to work
Part 1 covered the what and why of quantum computing: superposition, entanglement, and interference as three ideas that combine into a fundamentally different kind of machine, useful for a narrow but important class of problems classical computers structurally struggle with. This piece covers the how - the actual mechanics of qubits and circuits, the two algorithms every quantum computing conversation eventually reaches, where quantum machine learning realistically stands today, and a working example in IBM's Qiskit framework.
From Bit to Qubit: The Building blocks, Precisely:
If you've watched Apple TV+'s Dark Matter, you've already heard "superposition" thrown around, the show uses it to describe a man existing across countless parallel versions of his own life, until a choice "collapses" him into just one. It's a vivid image, but it's actually dramatizing the "many - worlds" interpretation of quantum mechanics - a far more speculative idea than anything that follows here.
A qubit's superposition isn't a doorway into parallel universes; it's a precise, measurable property of one single system, fully described by two numbers.
A classical bit is either 0 or 1. A qubit's state is described by two numbers - call them α and β - that represent the probability of measuring 0 or 1 respectively. Physicists write this as:
|ψ⟩ = α|0⟩ + β|1⟩
Squaring α and β gives the actual probabilities of each outcome, and those probabilities must add up to 1. Before measurement, the qubit genuinely holds both possibilities - the spinning coin from Part 1. The instant you measure it, that superposition collapses to a single definite value, and the "spin" is gone for good.
Entanglement extends this to multiple qubits. Two entangled qubits can't be described independently - their combined state only makes sense as a single joint description, which is why measuring one instantly tells you something certain about the other, regardless of distance. This is also the mechanism behind the exponential scaling from Part 1: n qubits can represent 2ⁿ simultaneous states specifically because of entanglement between them, not superposition alone.
Interference is what a quantum algorithm actually does with this raw material - it's a sequence of operations engineered so the probability amplitudes tied to correct answers reinforce each other while the amplitudes tied to wrong answers cancel out, shifting the odds before you ever measure anything.
Gates and Circuits: How you actually program a Qubit:
If bits are manipulated with logic gates (AND, OR, NOT), qubits are manipulated with quantum gates and a sequence of them, applied to a set of qubits, is a quantum circuit.
Two gates matter more than any others for a first understanding:
The Hadamard gate (H) takes a qubit sitting at a definite 0 and puts it into an even superposition of 0 and 1 - mathematically, it's the operation that starts the coin spinning.
The CNOT gate (controlled-NOT) takes two qubits and flips the second one only if the first is 1. Applied after a Hadamard gate, this is exactly how entanglement gets created in practice - it's the standard recipe for producing a Bell state, the simplest entangled pair possible.
A circuit is just these gates, applied to specific qubits in a specific order, followed by a measurement step that collapses everything into classical 0s and 1s you can actually read out. Everything below builds directly on just these two gates.
Grover's Algorithm: Searching Faster
Imagine searching an unsorted list of N items for one specific entry - with no structure to exploit, a classical computer has no better option than checking entries one at a time, taking roughly N steps in the worst case.
Grover's algorithm uses superposition to place a system into all N possibilities simultaneously, then uses interference (repeatedly applied) to amplify the amplitude of the correct answer while suppressing the rest. The result is a search that takes roughly √N steps instead of N - a quadratic speedup, and probably the best any algorithm, quantum or classical, can do for this specific problem.
Worth being honest about scope here: a quadratic speedup is real, but it isn't the exponential jump people sometimes assume "quantum" implies. And there's no such thing as a queryable "quantum database" today; Grover's algorithm is a foundational primitive that shows up inside other quantum algorithms far more often than it gets used standalone.
Shor's Algorithm and the Cryptography wake-up call:
Where Grover's gives a modest quadratic edge, Shor's algorithm gives something far more dramatic: an exponential speedup for factoring large numbers into their prime components. Classical computers, using the best known techniques, take time that grows sub-exponentially but still explosively as numbers get larger - enough that factoring a sufficiently large number is considered practically impossible. Shor's algorithm does it in polynomial time on a quantum computer.
That would be an interesting mathematical curiosity, except that the security of RSA, the encryption scheme protecting a huge share of the internet's public key infrastructure, depends entirely on factoring being hard. This is why "Q-Day," the date a cryptographically relevant quantum computer could break RSA-2048, has become a genuine planning concern rather than science fiction. Current estimates suggest factoring RSA-2048 with Shor's algorithm would require roughly 1,400 error corrected logical qubits - a scale not yet reached, but Google publicly estimated in early 2026 that such a machine could plausibly exist by 2029. NIST finalized its post-quantum cryptographic standards back in 2024, and 2026 has brought hard compliance deadlines for federal systems, yet by most industry estimates only a small fraction of organizations have actually migrated their infrastructure. For data scientists working with any long-lived encrypted data, this isn't abstract: data harvested and stored today could be decrypted retroactively once the hardware catches up: the so called "harvest now, decrypt later" threat.
Quantum Machine Learning: The Hybrid frontier:
This is the part of quantum computing most likely to get overhyped, so it's worth being precise. Quantum Machine Learning (QML) today almost always means a hybrid quantum-classical approach: a classical computer handles the bulk of the workflow, and a quantum processor is called in for one narrow, well-suited subroutine.
The two workhorses of this hybrid model are:
Variational Quantum Algorithms (VQAs), including the Quantum Approximate Optimization Algorithm (QAOA) - a quantum circuit with tunable parameters proposes candidate solutions, a classical optimizer scores and adjusts those parameters, and the loop repeats until it converges.
Quantum Neural Networks (QNNs) - structurally similar to classical neural networks, but with quantum circuits standing in for some of the layers.
The honest caveat: QNNs run into a real, currently unsolved obstacle called the barren plateau problem, where gradients used to train the network vanish almost entirely as circuits get larger - making training these networks in practice much harder than the classical analogy suggests. This is exactly why credible researchers push back on inflated QML speed-up claims; the theory is sound, but the training dynamics on real hardware are still an open research problem, not a solved one.
Hands - On: Your first Qiskit Circuit
Qiskit, IBM's open source quantum SDK, is the most common entry point for data scientists experimenting with this hands-on. Here's the entire journey from Part 1's coin analogy to actual code - superposition, then entanglement, run on a local simulator:
