Cette page n'a pas encore été traduite. Vous voyez la version originale en anglais.
Quantum teleportation
For this Qiskit in Classrooms module, students must have a working Python environment with the following packages installed:
qiskitv2.1.0 or newerqiskit-ibm-runtimev0.40.1 or newerqiskit-aerv0.17.0 or newerqiskit.visualizationnumpypylatexenc
To set up and install the packages above, see the Install Qiskit guide. In order to run jobs on real quantum computers, students will need to set up an account with IBM Quantum® by following the steps in the Set up your IBM Cloud account guide.
This module was tested and used 14 seconds of QPU time. This is an estimate only. Your actual usage may vary.
# Uncomment and modify this line as needed to install dependencies
#!pip install 'qiskit>=2.1.0' 'qiskit-ibm-runtime>=0.40.1' 'qiskit-aer>=0.17.0' 'numpy' 'pylatexenc'
Watch the module walkthrough by Dr. Katie McCormick below, or click here to watch it on YouTube.
Introduction and background
Quantum teleportation is a technique in quantum physics that allows the transfer of quantum information from one location to another without physically moving particles. Unlike the sci-fi concept of teleportation, this process doesn't involve transporting matter. Instead, it relies on the principle of quantum entanglement, where two particles become linked regardless of distance. Through a series of precise measurements and classical communication, the quantum state of one particle can be recreated in another particle at a distant location, effectively "teleporting" the quantum information. In this module, we'll see how this works mathematically, and then we will implement quantum teleportation on a real quantum computer. The introduction here will be brief; for more background on quantum information, and more explanation about teleportation, we recommend John Watrous's course on the Basics of quantum information, and in particular the section on Teleportation.
Classical bits can be in states 0 or 1. Quantum bits (qubits) can be in quantum states denoted and and also linear combinations of these states, called "superpositions", such as , with and Although the states can exist in this superposition, a measurement of the state will "collapse" it into either the or states. The parameters and are related to the probability of each measurement outcome according to
Hence the constraint that
Another key feature is that quantum bits can be "entangled", which means that the measurement of one qubit can affect the outcome of the measurement of another, entangled qubit. Understanding how entanglement is different from simple classical correlations is a bit tricky. Let's first explain our notation. Call two qubits belonging to friend 0 (Alice) and friend 1 (Bob), and each in the state
or
sometimes shortened to simply
Note that the lowest-numbered (or lettered) qubit is furthest to the right. This is a convention called "little-endian" notation, used throughout Qiskit. If the two-qubit state of the friends is and they measure the state of their respective qubits, they will each find a 0. Similarly if the qubits were in the state each of their measurements would yield a 1. That is no different from the classical case. However, in quantum computing, we can combine this with superposition to obtain states like
In a state like this, whether Alice and Bob have qubits in the state 0 or 1 is not yet known, not even yet determined by nature, and yet we know they will measure the same state for their qubit. For example, if Bob measures his qubit to be in the state the only way for that to happen is if the measurement has collapsed the two-qubit state to one of the two possible states, specifically to That leaves Alice's qubit also in the state.
The entangled of qubits in this way does not require that the qubits remain physically close to one another. In other words, we could entangle qubits, then separate them by a large distance, and use their entanglement to send information. An entangled state like the one above is a basic unit of entanglement, and is sometimes referred to as an "e-bit", a single bit of entanglement. These e-bits can be thought of as resources in quantum communication, since each e-bit shared between distant partners can be used, as we outline here, to move information from one location to another.
The first thought for many people learning about this for the first time is about violating relativity: can we use this to send information faster than light? By all means, keep questioning and probing scientific rules, but unfortunately this won't allow us to send information faster than light, for reasons that will become clear through the course of this module. Spoiler: amazingly it is NOT due to the speed at which this collapse propagates, which does appear to happen faster than light [1]. We start with two collaborators Alice and Bob, who are initially in the same location and can work together on the same qubits. These collaborators will entangle their qubits. Then they will move apart to two different geographic locations, bringing their respective qubits with them. Alice will then obtain quantum information on a new qubit Q. We make no assumptions about the information on Q. The state of Q could be a secret unknown to Alice; it could be unknown to all people. But Alice is given the task of transferring the information on Q to Bob. She will do this using quantum teleportation.
To accomplish this, we will need to know some quantum operations or "gates".
Quantum operators (gates)
Feel free to skip this section if you are already familiar with quantum gates. If you want to understand these gates better, check out Basics of quantum information, especially the first two lessons, on IBM Quantum Learning.
For this teleportation protocol we will primarily use two types of quantum gates: the Hadamard gate, the CNOT gate. A few others will play a lesser role: the gate, gate, and the SWAP gate.
This module can be completed with very limited linear algebra background, but sometimes visualizing quantum mechanical gates using matrices and vectors can be helpful. So we present here the matrix/vector forms of quantum gates/states, as well.
The states we have already presented are chosen (partly by convention and partly by constraints) to have vector forms:
In this way, an arbitrary state can be written as
There is some choice in how to extend the notation to multiple-qubit states, but the choice below is quite standard:
With this choice of vector notation in mind, we can introduce our needed quantum gates, their effects on quantum states, and their matrix forms.
H Hadamard Gate: Creates a superposition state. Single-qubit gate.
A circuit with a Hadamard gate is made as follows:
from qiskit import QuantumCircuit
qc = QuantumCircuit(1)
qc.h(0)
qc.draw("mpl")
CNOT Controlled-NOT Gate: This gate uses two qubits: a control and a target. Checks the state of a control qubit which is not changed. But if the control qubit is in the state , the gate changes the state of the target qubit; if the state of the control qubit is no change is made at all. In the notation below, assume the qubit (right-most qubit) is the control, and qubit (the left-most qubit) is the target. Below, the notation used is
You may sometimes see CNOT written with the order of the control and target simply implied. But there is no such ambiguity in code or in circuit diagrams.
A CNOT gate looks a bit different in a circuit, since it requires two qubits. This is how it is implemented:
qc = QuantumCircuit(2)
qc.cx(0, 1)
qc.draw("mpl")
Check your understanding
Read the question below, think about your answer, then click the triangle to reveal the solution.
Most gates have the same matrix form in Qiskit as everywhere else. But the CNOT gate acts on two qubits, and so suddenly ordering conventions of qubits becomes an issue. Texts that order qubits will show a different matrix form for their CNOT gates. Verify by explicit matrix multiplication that the CNOT matrix above has the correct action on the state
Answer:
Gate: Equivalent to a NOT operation. Single-qubit gate.
In Qiskit, creating a circuit with an gate looks like this:
qc = QuantumCircuit(1)
qc.x(0)
qc.draw("mpl")
Gate: Adds a "phase" to a state (a prefactor, which in the cases of the Z eigenstates and either a 1, or -1, respectively). Single-qubit gate.
In Qiskit, creating a circuit with an gate looks like this:
qc = QuantumCircuit(1)
qc.z(0)
qc.draw("mpl")
Theory
Let's lay out the protocol for quantum teleportation using math. Then, in the next section, we'll realize this setup using a quantum computer.
Alice and Bob entangle their qubits: Initially, Alice's qubit and Bob's qubit are each, separately in the state (a fine assumption and also the correct initialization for IBM® quantum computers). We can write this as or simply as . Let's calculate what happens when Alice and Bob act with the Hadamard gate on Alice's qubit, and then a CNOT gate with Alice's qubit as the control and Bob's as the target: