Home Algorithms Commercialization Data Science Information Theories Quantum Theories Lab Linear Algebra
<< Quantum Teleportation PDF Rotation - Bloch Sphere >>

$\require{cancel} \newcommand{\Ket}[1]{\left|{#1}\right\rangle} \newcommand{\Bra}[1]{\left\langle{#1}\right|} \newcommand{\Braket}[1]{\left\langle{#1}\right\rangle} \newcommand{\Rsr}[1]{\frac{1}{\sqrt{#1}}} \newcommand{\RSR}[1]{1/\sqrt{#1}} \newcommand{\Verti}{\rvert} \newcommand{\HAT}[1]{\hat{\,#1~}} \DeclareMathOperator{\Tr}{Tr}$

Quantum Teleportation Using CReg

First created in June 2018

This is experimental.

The Basics

Alice has $\Ket{\psi}=a\Ket0+b\Ket1$ and the first qubit of an entangled pair $\Ket{\Phi^+}=\frac{1}{\sqrt{2}}(\Ket{00}+\Ket{11})$. Bob has the second qubit (LSD).

$\Ket{\psi}\otimes\Ket{\Phi^+} =\frac{1}{\sqrt{2}}(a\Ket0+b\Ket1)\otimes(\Ket{00}+\Ket{11}) =\frac{1}{\sqrt{2}}(a\Ket{000}+a\Ket{011}+b\Ket{100}+b\Ket{111}) \quad\ldots(0).$

Alice can only act on the first two qubits, so she does a $cX$ followed by an $H$.

$(H\otimes I\otimes I)(cX\otimes I)(\Ket{\psi}\otimes\Ket{\Phi^+}\\ =(H\otimes I\otimes I)\frac{1}{\sqrt{2}}(a\Ket{000}+a\Ket{011}+b\Ket{110}+b\Ket{101})\quad\ldots(1)\\ =(H\otimes I\otimes I)\frac{1}{\sqrt{2}}(a\Ket0(\Ket{00}+\Ket{11})+b\Ket1(\Ket{10}+\Ket{01}))\\ =\frac{1}{2}(a(\Ket0+\Ket1)(\Ket{00}+\Ket{11})+b(\Ket0-\Ket1)(\Ket{10}+\Ket{01}))\quad\ldots(2)\\ =\frac{1}{2}(a\Ket{000}+a\Ket{011}+a\Ket{100}+a\Ket{111}+b\Ket{010}+b\Ket{001}-b\Ket{110}-b\Ket{101})\\ =\frac{1}{2}(a\Ket{000}+b\Ket{001}+a\Ket{011}+b\Ket{010}+a\Ket{100}-b\Ket{101}+a\Ket{111}-b\Ket{110})\quad\ldots(3)\\ =\frac{1}{2}\big(\Ket{00}(a\Ket0+b\Ket1)~+~\Ket{01}(a\Ket1+b\Ket0)~+~\Ket{10}(a\Ket0-b\Ket1)~+~\Ket{11}(a\Ket1-b\Ket0)\big).$

Now all Alice needs to do is to measure her two qubits and send the result as two classical bits to Bob, who would apply $I, X, Z,$ or $Y'=ZX$ to his qubit depending on Alice's information and obtain $\Ket{\psi}$.

That is to apply $X$ to the last qubit if the middle qubit is 1, and $Z$ if the first qubit is 1.


Analysis

So, how can this be possible? What is the trick? How did Bob's qubit got affected by Alice's activities "instantaneously".

The net effect of steps (1) and (2) is to distribute the eight standard basis states in the right superposition, so as to leave Bob's qubit having a unique pattern, as becoming apparent in (3). In fact, you can start from (3) working backward.

Even in the fuzzy quantum world, $a$ and $b$ are fixed (but cannot be known) and can have infinitely many possible values. When did the quantity of $a$ and $b$ got "teleported" from Alice to Bob?

It is at the moment of Alice's measurement that she has obtained one of the four standard basis. The probably of each is a quarter (as $\sqrt{a^2+b^2}=1$), but after the measurement, it becomes reality with certainty. While Alice's qubit went from unknown to known, Bob's went from known to unknown (but not a superposition -- it is one of the four).

So you might say that the probability "remanent" has been transferred from Alice to Bob. It is only a complete measurement on the whole 3-qubit system that will eliminate any uncertainty.

But Bob's qubit is now potentially "disoriented" with a quarter of chance (classically) to be right. This is why Bob needs the two classical bit of information from Alice to "re-orient" the entangled partner to what $\Ket{\psi}$ was.

Illustration

Three stages

  1. BELL - Preparation of the Bell State
  2. ALICE - Alice's side (cX then Hadamard)
  3. BOB - Bob's side (X and Z conditionally)

Three qubits

  1. $\psi$ - The arbitrary qubit Alice is sending
  2. $\alpha$ - The entangled qubit Alice has
  3. $\beta$ - The entangled qubit Bob has

In the code, $\{q_2,q_1,q_0\}=\{\psi,\alpha,\beta\}$

Please note thhat we cannot measure in between steps without destroying the states. If you want to measure an intermediate state, you must re-start from the beginning.

In the following illustration, the inter-stage measurementand and re-initialisation are commented out. Uncommenting them will give you stage by stage measurement if you are interested.

Preamble Codes

In [1]:
# Preamble
import time, datetime

from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, QISKitError
from qiskit import available_backends, execute, register, get_backend

# import state tomography functions
from qiskit.tools.visualization import plot_histogram, plot_state, circuit_drawer

def run_job(qc, backend, shots=1024):
    # Run circuit qc on backend bknd
    print('Job started at ' + time.strftime('%H:%M:%S, %d %b, %Y'))
    print('Doing ' + str(shots) + ' shot(s) on backend ' + backend)

    job = execute(qc, backend=backend, shots=shots, max_credits=3)

    ts0 = datetime.datetime.now().replace(microsecond=0)

    lapse = 0
    interval = 3
    while not job.done:
        #print('Status @ {} seconds'.format(interval * lapse))
        ts1 = datetime.datetime.now().replace(microsecond=0)
        print('Lapse #' + str(lapse) + ' ' + str(ts1 - ts0) + ' so far')
        print(job.status)
        time.sleep(interval)
        lapse += 1
    print(job.status)

    print('Job stopped at ' + time.strftime('%H:%M:%S, %d %b, %Y'))
    
    return job
In [2]:
# u3(p1, p2, p3) defines psi, the qubit to send

p1 = 1.4
p2 = 2.2
p3 = 3.0
In [3]:
def bell_stage(qc, q, c):
    # Preparing the Bell State
    qc.h(q[1])
    qc.cx(q[1], q[0])
    return qc

def alice_stage(qc, q, c):
    # Alice has a little qubit psi of cos(pi/3)|0>+sin(pi/3)|1>=0.5|0>+0.866|1>
    qc.u3(p1, p2, p3, q[2])
    # Alice cx(psi, qa)
    qc.cx(q[2], q[1])
    qc.h(q[2])
    return qc

def alice_measure(qc, q, c):
    # Alice measures psi (q[2]->c[2])) and alpha (q[1]->c[1])
    qc.measure(q[2], c[2])
    qc.measure(q[1], c[1])
    return qc

def bob_stage(qc, q, c):
    # Alice sends the first two bits of the above result to Bob
    # Bob applies X to q[0] if q[1] is 1
    # Bob applies Z to q[0] if q[2] is 1
    #qc.cx(q[1], q[0])
    #qc.cz(q[2], q[0])
    if c[1] == 1:
        qc.x(q[0])
    if c[2] == 1:
        qc.z(q[0])
    return qc

The Sample $\Ket\psi$

In [4]:
# Let's see how psi looks like
q_psi = QuantumRegister(1)
c_psi = ClassicalRegister(1)

qc_psi = QuantumCircuit(q_psi, c_psi)
qc_psi.u3(p1, p2, p3, q_psi[0])
Out[4]:
<qiskit.extensions.standard.u3.U3Gate at 0x7fc1f84ed5f8>
In [5]:
job = execute(qc_psi, backend='local_statevector_simulator')
job.result().get_statevector(qc_psi)
Out[5]:
array([ 0.76484219+0.j        , -0.37912283+0.52084768j])

$a=+0.76+i~0.00,$

$b=-0.38+i~0.52.$

$\psi=a\Ket0+b\Ket1.$

In [6]:
qc_psi.measure(q_psi, c_psi)
job = run_job(qc_psi, 'local_qasm_simulator')
plot_histogram(job.result().get_counts(qc_psi))
Job started at 23:01:26, 27 Jun, 2018
Doing 1024 shot(s) on backend local_qasm_simulator
Lapse #0 0:00:00 so far
{'status': <JobStatus.RUNNING: 'job is actively running'>, 'status_msg': None}
{'status': <JobStatus.DONE: 'job has successfully run'>, 'status_msg': None}
Job stopped at 23:01:29, 27 Jun, 2018

Bell Stage

In [7]:
q = QuantumRegister(3)
c = ClassicalRegister(3)
qc = QuantumCircuit(q, c)

bell_stage(qc, q, c)

# Now q1-q0 is in Bell State
circuit_drawer(qc)
Out[7]:
In [8]:
job = execute(qc, backend='local_statevector_simulator')
job.result().get_statevector(qc)
Out[8]:
array([0.70710678+0.j, 0.        +0.j, 0.        +0.j, 0.70710678+0.j,
       0.        +0.j, 0.        +0.j, 0.        +0.j, 0.        +0.j])
In [9]:
#qc.measure(q, c)
#job = run_job(qc, 'local_qasm_simulator')
#plot_histogram(job.result().get_counts(qc))

Alice Stage

In [10]:
#qc = QuantumCircuit(q, c)

#bell_stage(qc, q, c)
alice_stage(qc, q, c)

# Now psi and alpha are entangled
circuit_drawer(qc)
Out[10]:
In [11]:
job = execute(qc, backend='local_statevector_simulator')
job.result().get_statevector(qc)
Out[11]:
array([ 0.38242109+0.j        , -0.18956141+0.26042384j,
       -0.18956141+0.26042384j,  0.38242109+0.j        ,
        0.38242109+0.j        ,  0.18956141-0.26042384j,
        0.18956141-0.26042384j,  0.38242109+0.j        ])

$a'=+0.38+i~0.00,$

$b'=-0.19+i~0.26.$

$\phi =a'\Ket{000}+b'\Ket{001}+b'\Ket{010}+a'\Ket{011}+a'\Ket{100}-b'\Ket{101}-b'\Ket{110}+a'\Ket{111}$.

In [12]:
alice_measure(qc, q, c)
circuit_drawer(qc)
Out[12]:
In [13]:
#qc.measure(q[2], c[2])
#job = run_job(qc, 'local_qasm_simulator')
#plot_histogram(job.result().get_counts(qc))

Bob Stage

In [14]:
#qc = QuantumCircuit(q, c)

#bell_stage(qc, q, c)
#alice_stage(qc, q, c)
bob_stage(qc, q, c)

# Now Bob has obtained and measurement and decoded it
circuit_drawer(qc)
Out[14]:
In [15]:
#job = execute(qc, backend='local_statevector_simulator')
#job.result().get_statevector(qc)

$a'=+0.38+i~0.00,$

$b'=-0.19+i~0.26.$

$\phi =a'\Ket{000}+b'\Ket{001}+a'\Ket{010}+b'\Ket{011}+a'\Ket{100}+b'\Ket{101}+a'\Ket{110}+b'\Ket{111} =(\Ket{00}+\Ket{01}+\Ket{10}+\Ket{11})~(a'\Ket0+b'\Ket1).$

To separate the two factors, they both need to be of unit length:

$\phi=(\frac{1}{2}\Ket{00}+\frac{1}{2}\Ket{01}+\frac{1}{2}\Ket{10}+\frac{1}{2}\Ket{11})~(2a'\Ket0+2b'\Ket1).$

So we are expecting $a=2a'=+0.76+i~0.00$ and $b=2b'=-0.38+i~0.52$, and this is true.

In [16]:
qc.measure(q[0], c[0])
job = run_job(qc, 'local_qasm_simulator')
plot_histogram(job.result().get_counts(qc))
Job started at 23:01:32, 27 Jun, 2018
Doing 1024 shot(s) on backend local_qasm_simulator
Lapse #0 0:00:00 so far
{'status': <JobStatus.RUNNING: 'job is actively running'>, 'status_msg': None}
{'status': <JobStatus.DONE: 'job has successfully run'>, 'status_msg': None}
Job stopped at 23:01:35, 27 Jun, 2018

Give it a go

In [17]:
q = QuantumRegister(3)
c = ClassicalRegister(3)
qc = QuantumCircuit(q, c)

useCReg = False;

# Preparing the Bell State
qc.h(q[1])
qc.cx(q[1], q[0])

# Alice has a little qubit psi of cos(pi/3)|0>+sin(pi/3)|1>=0.5|0>+0.866|1>
qc.u3(p1, p2, p3, q[2])
# Alice cx(psi, qa)
qc.cx(q[2], q[1])
qc.h(q[2])

# Alice measures psi (q[2]->c[2])) and alpha (q[1]->c[1])
if useCReg:
    qc.measure(q[2], c[2])
    qc.measure(q[1], c[1])

# Alice sends the first two bits of the above result to Bob
# Bob applies X to q[0] if q[1] is 1
# Bob applies Z to q[0] if q[2] is 1
if useCReg:
    if c[1] == 1:
        qc.x(q[0])
    if c[2] == 1:
        qc.z(q[0])
else:
    qc.cx(q[1], q[0])
    qc.cz(q[2], q[0])

qc.measure(q[0], c[0])

circuit_drawer(qc)
Out[17]:
In [18]:
job = run_job(qc, 'local_qasm_simulator')
plot_histogram(job.result().get_counts(qc))
Job started at 23:01:36, 27 Jun, 2018
Doing 1024 shot(s) on backend local_qasm_simulator
Lapse #0 0:00:00 so far
{'status': <JobStatus.RUNNING: 'job is actively running'>, 'status_msg': None}
{'status': <JobStatus.DONE: 'job has successfully run'>, 'status_msg': None}
Job stopped at 23:01:39, 27 Jun, 2018

Result

Comparing the above histogram with the original one of $\psi$, you will find that they are the same within random error.

By increasing the number of shots, you will get the two closer and closer.


Puzzles

We simply follow the mathematics here to arrive at the quantum teleportation machenism (and experimentally verified). That means it is a consequence of the mathematics simply allowing entangled representation of the Bell State. ($cX$ is like the classical XOR, but $H$ has no classical counterpart.)

By this premise, we can experiment on its mathematics to resolve puzzles and gain more indepth understanding.


What if Alice does not measure her qubit, can Bob tell the difference as a way of communication?

The idea is that by not measuring the qubit, Alice does not affect Bob's qubit, and if Bob can tell the difference then it is effectively a communication from Alice.

Bob can only obtain information by measuring his qubit, and if he uses the standard basis, the result is 50-50. No message is received from Alice.

To take this further, Alice sends Bob a "faked" number from 1 to 4. Since Alice does not measure her qubit, the system only contains the entangled pair, and we will have these four cases:

0: $(I\otimes I)\Ket{\Phi^+}=\frac{1}{\sqrt{2}}(\Ket{00}+\Ket{11})=\Ket{\Phi^+}$
1: $(I\otimes X)\Ket{\Phi^+}=\frac{1}{\sqrt{2}}(\Ket{01}+\Ket{10})=\Ket{\Psi^+}$
2: $(I\otimes Z)\Ket{\Phi^+}=\frac{1}{\sqrt{2}}(\Ket{00}-\Ket{11})=\Ket{\Phi^-}$
3: $(I\otimes Y')\Ket{\Phi^+}=\frac{1}{\sqrt{2}}(\Ket{01}-\Ket{10})=\Ket{\Psi^-}$

The two qubits are still entangled but in a different Bell states. By measuring his qubit, Bob will still get a 50-50 chance to obtain $\Ket0$ or $\Ket1$. Bob cannot tell if Alice's information is "faked" or not.


What if after measuring her qubits, Alice did not send Bob the information but he measures his qubit anyway?

$(H\otimes I\otimes I)(cX)(\Ket{\psi}\otimes\Ket{\Phi^+} =\frac{1}{2}\big(\Ket{00}(a\Ket0+b\Ket1)~+~\Ket{01}(a\Ket1+b\Ket0)~+~\Ket{10}(a\Ket0-b\Ket1)~+~\Ket{11}(a\Ket1-b\Ket0)\big)$.

Bob's qubit is in one of the four definite states, not the superposition of the four (but each can be a superposition itself with amplitude $a$ and $b$). This becomes classical: performing one of the four operation gives him 25% chance of getting it right.

Well, 25% is a much better chance than guessing the value of $a$ and $b$ in the continuous range between 0 and 1. Let us see if we can use this better-than-random chance to send a message "instantaneously".

To measure probability, we repeat the process $n$ times (using $n$ pre-shared entangled pairs). Each time Alice prepared $\Ket{\psi}=\frac{3}{5}\Ket0+\frac{4}{5}\Ket1$, e.g. by measuring a photon's polarisation at a specific angle. This does not violate the no-cloning principle as it is an initialisation, not copying.

Given sufficient consistent sampling, Bob may get a hint of the imbalance chance of $a\Ket0$ and. $b\Ket1$, even without Alice's information. Let us take a closer look.

After Alice's measurement, Bob's qubit is in one of the four states with some co-efficients of $\frac{3}{5}$ and $\frac{4}{5}$, or 36% and 64% chance respectively. The association of these two probability values with $\Ket0$ and $\Ket1$ cannot be determined, so half of the times Bob will measure 36% from $a\Ket0$ and 64% from $b\Ket1$, and the other times the other way (for $b\Ket0$ and $a\Ket1$).

The expected value for $\Ket0$ is $\frac{1}{2}(a^2+b^2)$=50%, and same for $\Ket1$, regardless of the value of $a$ and $b$.

As a result, there is no information Bob can extract from his qubit without Alice's two bit information.


Can Alice "squeeze" the uncertainty so that Bob's qubit will "collapse so hard" that it becomes $\Ket{\psi}$ by itself.?

By "squeezing" we mean more operations from Alice's end to "collapse" the four states at Bob's end into one, without Bob's effort and the need for Alice to send any information.

The short answer is no (although the explanation provided here is not very convincing).

In order to make the "chosen" state a certainty, we must "collapse" the other three, which is effectively a projection to the "chosen" state.

There is no known unitary operation to project to a subspace from an arbitrary state. In other words, you always measure with a probability. Although such probability can be unity given the right $a$ or $b$, Alice cannot be sure of that as $a$ and $b$ are unknown to Alice.

There are always more than one measuring results at Alice's end and uncertainty remains with her, so Bob always have multiple possible states to be determined by Alice's information.


What if Alice and Bob both have a qubit and do the same thing "at the same time"?


If Alice and Bob measure their entangled qubit "together", as time is relative, whose measurement will affect the other's?

 

<< Quantum Teleportation Top Rotation - Bloch Sphere >>