Wednesday, November 26, 2025

thumbnail

A Beginner’s Guide to Quantum Teleportation Code

 What Is Quantum Teleportation (In Simple Words)


Quantum teleportation is a process that lets you send the state of a qubit from one place (Alice) to another (Bob) without physically moving the qubit.


It does not teleport matter — only information.


It uses:


Entanglement


Classical communication


Local quantum operations


🧠 Key Idea (Beginner Explanation)


Imagine:


Alice has a qubit containing some quantum information = |ψ⟩


Alice and Bob share an entangled pair


Alice performs special measurements


She sends Bob 2 classical bits (normal information)


Bob uses those bits to recover Alice’s original quantum state


The result:


➡️ Bob’s qubit becomes the original state |ψ⟩

➡️ Alice’s qubit loses that state (no cloning)


⭐ Quantum Teleportation Circuit (Simple Diagram)

 Alice's Qubit (|ψ⟩) ----●-------H------M--- classical bit c0

                        |

 Entangled Qubit A -----X-------------M--- classical bit c1 (still with Alice)


 Bob’s Qubit ------------(entangled)--------- X / Z corrections → becomes |ψ⟩



Where:


H = Hadamard gate


X, Z = Pauli correction gates


M = measurement


🚀 Full Working Example: Quantum Teleportation in Qiskit


You can run this on:


✔ Jupyter Notebook

✔ Google Colab

✔ IBM Quantum Lab


✅ Step 1: Install Qiskit

pip install qiskit


✅ Step 2: Teleportation Code

from qiskit import QuantumCircuit, Aer, execute


# Create a circuit with 3 qubits and 2 classical bits

# q0 = Alice's qubit (state to teleport)

# q1 = Alice's entangled qubit

# q2 = Bob's entangled qubit

qc = QuantumCircuit(3, 2)


# Step 1: Prepare the unknown state (|ψ⟩)

qc.h(0)  # Example: create a superposition state, can be anything


# Step 2: Create entangled pair between q1 (Alice) and q2 (Bob)

qc.h(1)

qc.cx(1, 2)


# Step 3: Bell measurement on Alice's two qubits (q0 and q1)

qc.cx(0, 1)

qc.h(0)

qc.measure([0,1], [0,1])


# Step 4: Bob applies corrections based on Alice's bits

qc.cx(1, 2)

qc.cz(0, 2)


# Visualize circuit

print(qc.draw())


# Step 5: Run simulation

simulator = Aer.get_backend("statevector_simulator")

result = execute(qc, simulator).result()

state = result.get_statevector()


print("\nFinal teleported state on Bob's qubit:")

print(state)


🎯 What You Should Expect


The state originally prepared on qubit 0 (Alice’s) will appear on qubit 2 (Bob’s).


Alice’s qubit will no longer hold the state (no cloning theorem).


⭐ Modify the State to Teleport


You can change the state |ψ⟩ easily:


qc.x(0)     # Teleport |1⟩

qc.h(0)     # Teleport superposition

qc.rx(0.5, 0)

qc.ry(1, 0)


🧩 Why Quantum Teleportation Works


Teleportation uses 3 components:


1️⃣ Entanglement


Bob and Alice share a strong quantum connection.


2️⃣ Bell-State Measurement


Alice “entangles” her qubit with her share of the pair.


3️⃣ Classical Communication


Alice sends Bob two classical bits (00, 01, 10, or 11).


Bob uses these bits to apply:


Alice’s Bits Bob Applies

00 Do nothing

01 X gate

10 Z gate

11 X + Z


This recovers the exact original quantum state.


🌈 Summary (Beginner Friendly)


Quantum teleportation moves quantum information, not matter.


Requires entanglement + measurements + classical bits.


Bob’s qubit becomes exactly the original qubit.


Qiskit makes it easy to simulate the whole process.

Learn Quantum Computing Training in Hyderabad

Read More

Building a Quantum Random Number Generator

How to Simulate Quantum Circuits Using Qiskit

Step-by-Step Tutorial: Implementing Grover’s Algorithm

Bonus: Deep Dives & Tutorials

Visit Our Quality Thought Training Institute 

Get Directions

Subscribe by Email

Follow Updates Articles from This Blog via Email

No Comments

About

Search This Blog

Powered by Blogger.

Blog Archive