Update cookies preferences

Saturday, June 6, 2026

The "Light Switch" is Dead. Long Live the Spinning Coin[Quantum Computing]

 

The "Light Switch" is Dead. Long Live the Spinning Coin.


Been playing around with a bit of Quantum Computing this week. Found a few core concepts 

Quantum computing sounds like science fiction, but it is just linear algebra and physics

working in perfect harmony. If you want to understand how a quantum computer actually works,

you need to build the machine in your mind—piece by piece.

Here is the exact 5-step engineering pipeline of a quantum program, from a single particle to working code:

Block 1: Qubits & Superposition (The Raw Material) 

Block 2: Quantum Gates (The Steering Wheel) 

Block 3: Entanglement (The Cosmic Sync) 

Block 4: Quantum Circuits (The Blueprint) 

Block 5: Turn Theory into Code (Qiskit / Cirq) 

qubits → superposition → gates → entanglement→ circuits->Working Qiskit/Cirq code


🧱 Block 1: Qubits & Superposition (The Raw Material) 

What to understand”

A classical bit is a light switch: always 0 or 1.

A qubit is a spinning coin in mid-air: a blend of both possibilities at the same time. 

  • A qubit is a 2‑dimensional complex vector
    |0⟩=[1,0],|1⟩=[0,1]

Read as ‘ket zero state is represented by the vector one-zero, and |1⟩=[0,1] is read as the ket one state is represented by the vector zero-one. ’

  • Superposition is a linear combination

Above is read as ‘Ket psi equals alpha ket zero plus beta ket one.’ This formula

simply means the qubit holds a combination of both states. Instead of being

just ‘0’ or just ‘1’, it is a combination of both.

from qiskit import QuantumCircuit


qc=QuantumCircuit(2)

qc.h(0)

     ┌───┐

q_0: ┤ H ├

     └───┘

q_1: ─────



  • The Catch (Collapse): You can manipulate a superposition, but you can never

  • observe it directly. The exact millisecond you measure a qubit, the spinning coin

  • lands. The state irreversibly collapses into a definite 0 or 1. Measurement collapses

  • the state and the superposition disappears

Before measurement, a qubit can be in a superposition:

This means:

  • It is not 0

  • It is not 1

  • It is a blend of both at the same time

  • With probabilities |alpha |^2 and |beta |^2

Before measurement:

A qubit is like a spinning coin in the air — not heads, not tails, but both possibilities.

After measurement:

You catch the coin — now it is definitely heads or tails.

The act of catching (measuring) forces the coin to choose.

⭐ Why does collapse happen?

Because quantum mechanics says:

  • You can prepare a superposition

  • You can manipulate a superposition

  • But you can never observe a superposition directly

Observation forces the system into one definite classical outcome.

⭐ A simple example

Suppose a qubit is in:

This means:

  • 50% chance to get 0

  • 50% chance to get 1

When you measure it:

  • You get 0 → the state becomes 0⟩

  • You get 1 → the state becomes 1⟩

The original superposition no longer exists.

Output:


  • SpaceVector and Bloch sphere representation

Mental Model: A qubit is not a binary switch; it is a rotatable arrow pointing anywhere on a 3D globe called

the Bloch Sphere

This is the vector:

Which means:

  • 50% chance of 0⟩

  • 50% chance of 1⟩

  • Equal superposition


Bloch sphere representation(Draws a picture of a qubit on the Bloch sphere)]


🕹️ Block 2: Quantum Gates (The Steering Wheel) 

What to understand

In classical coding, gates are logical operations (AND, OR, NOT). In quantum computing, gates

are geometric rotations

The Math: Gates are unitary matrices that multiply our statevector, rotating our qubit's arrow around the Bloch Sphere. 

Key gates:

  • X gate → flips 0⟩ ↔ 1⟩

  • H (Hadamard) Gate The magic gate. It kicks a stable |0> into a perfect 50/50

  • superposition. H gate → creates superposition

  • Z gate → phase flip

  • S, T gates → phase rotations

  • RX, RY, RZ → Continuous rotations.Precise degree-by-degree rotations. 

Mental model

Gates are rotations, not logic operations.

Qiskit practice



CNOT gate

from qiskit import QuantumCircuit


qc=QuantumCircuit(2)

qc.h(0)

qc.cx(0,1)

print(qc)





     ┌───┐     

q_0: ┤ H ├──■──

     └───┘┌─┴─┐

q_1: ─────┤ X ├

          └───┘





🔗 Block 3: Entanglement (The Cosmic Sync) 

What to understand

Entanglement is when the state of one qubit depends on another, even if separated.

Entanglement is a quantum phenomenon where two qubits share a single combined state, such that measuring one instantly determines the state of the other — even if they are far apart.

Mathematically, an entangled state cannot be factored into separate qubit states.

This is the Bell State, the simplest entangled state.

🧠 Mental Model

Imagine flipping two coins—one in London, one in Tokyo. If they are entangled, the exact instant the

London coin lands on Heads, the Tokyo coin instantly forces itself to land on Heads too. They aren't communicating across space; they are two parts of the

exact same system. 

🧪 Qiskit Practice: Create an Entangled Bell State


🗺️ Block 4: Quantum Circuits (The Blueprint) 

🎯 What you need to understand

A quantum circuit is:

  • A set of qubits

  • A sequence of quantum gates

  • A final measurement

  • Executed on a simulator or quantum hardware

Quantum circuits are the “programs” of quantum computing.

🧠 Mental Model

A quantum circuit is like a pipeline where each gate transforms the quantum state.

initialized qubits sequential gate transformations final hardware measurement.

Each gate step is simply a matrix multiplication changing the final probability

amplitudes before the system collapses into a classical answer.

🧪 Qiskit Practice: Build a Full Circuit



Output:


💻 Block 5: Turn Theory into Code (Qiskit / Cirq) 

🎯 What to install

Run:

pip install qiskit

pip install qiskit[visualization]


You don't need a multi-million dollar lab to run this. You can build a full 2-qubit

entangled Bell State circuit right now in Python using Qiskit or Cirq.

Here is how to initialize a circuit, apply a Hadamard gate to create a superposition,

use a Controlled-NOT (CNOT) gate to entangle the two qubits, and extract the statevector:

🧪 Qiskit Starter Template

Output:

Hope you are also learning with me, let me know if you have any suggestions.


The "Light Switch" is Dead. Long Live the Spinning Coin[Quantum Computing]

  The "Light Switch" is Dead. Long Live the Spinning Coin. Been playing around with a bit of Quantum Computing this week. Found a ...