Update 31 May 2019: added section at end on Entangled Qubits.
For background on quantum teleportation see Quantum Computation and Quantum Information, 10th Anniversary Edition, Michael A. Nielsen & Isaac L. Chuang, Cambridge University Press, 2010, pages 26-28.
State A = Q(2); int b = PRINT_BITS; double pi = 4*atan(1); SRAND(); // random qubit to transport: R = alpha|0> + beta|1> // double complex alpha = DRAND*exp(CMPLX(0,pi*(2*DRAND-1))); double complex beta = sqrt(1-abs2(alpha))*exp(CMPLX(0,pi*(2*DRAND-1))); State R = Q(1); R.a[0] = alpha; R.a[1] = beta;
Each possible measurement by Alice will be simulated separately. In each case the initial state is |A1,A0> = |00>:
// for each of Alice's possible measurements of q2,q1 // for( unsigned int m = 0; m < 4; ++m) { // initial state |00> // init( A, 0, 0); if( m == 0) print( "A", A, b); A: 00 1 (1,0) 01 0 (0,0) 10 0 (0,0) 11 0 (0,0)
Now qubits A1 and A0 are entangled by performing a Hadamard transformation on qubit A1, followed by a controlled-NOT on qubit A0 controlled by qubit A1:
// Alice and Bob jointly entangle A1,A0 // H( A, 1); if( m == 0) print( "H1", A, b); H1: 00 0.5 (0.707107,0) 01 0 (0,0) 10 0.5 (0.707107,0) 11 0 (0,0) CX( A, 1, 0); if( m == 0) print( "CX10", A, b); CX10: 00 0.5 (0.707107,0) 01 0 (0,0) 10 0 (0,0) 11 0.5 (0.707107,0)
At some point in the future Alice obtains qubit R which is in an unknown state α|0>+β|1>:
// q = combined state of R and A: |q2,q1,q0> = |R>|A1,A0> // State q = product( R, A); if( m == 0) { print( "R", R, b); print( "Q", q, b); } R: 0 0.4349 (-0.629227,0.197361) 1 0.5651 (0.750464,-0.0438817) Q: 000 0.2174 (-0.444931,0.139555) 001 0 (0,0) 010 0 (0,0) 011 0.2174 (-0.444931,0.139555) 100 0.2826 (0.530658,-0.0310291) 101 0 (0,0) 110 0 (0,0) 111 0.2826 (0.530658,-0.0310291)
// Alice entangles q2 with q1 // CX( q, 2, 1); if( m == 0) print( "CX21", q, b); CX21: 000 0.2174 (-0.444931,0.139555) 001 0 (0,0) 010 0 (0,0) 011 0.2174 (-0.444931,0.139555) 100 0 (0,0) 101 0.2826 (0.530658,-0.0310291) 110 0.2826 (0.530658,-0.0310291) 111 0 (0,0) H( q, 2); if( m == 0) print( "H2", q, b); H2: 000 0.1087 (-0.314614,0.0986805) 001 0.1413 (0.375232,-0.0219409) 010 0.1413 (0.375232,-0.0219409) 011 0.1087 (-0.314614,0.0986805) 100 0.1087 (-0.314614,0.0986805) 101 0.1413 (-0.375232,0.0219409) 110 0.1413 (-0.375232,0.0219409) 111 0.1087 (-0.314614,0.0986805)
// Alice measures, collapse state // collapse( q, 2, m >> 1); collapse( q, 1, m & 1); printb( m, 2); print( "", q, b);
If her measurement is 00
, the state is:
00: 000 0.4349 (-0.629227,0.197361) 001 0.5651 (0.750464,-0.0438817) 010 0 (0,0) 011 0 (0,0) 100 0 (0,0) 101 0 (0,0) 110 0 (0,0) 111 0 (0,0)
In general Bob performs transformations on q0 depending on the bits received:
// Bob transformations // if( m & 1) { X( q, 0); print( "X", q, b); } if( m >> 1) { Z( q, 0); print( "Z", q, b); } }
01
Bob performs a NOT transformation on q0:
01: 000 0 (0,0) 001 0 (0,0) 010 0.5651 (0.750464,-0.0438817) 011 0.4349 (-0.629227,0.197361) 100 0 (0,0) 101 0 (0,0) 110 0 (0,0) 111 0 (0,0) X: 000 0 (0,0) 001 0 (0,0) 010 0.4349 (-0.629227,0.197361) 011 0.5651 (0.750464,-0.0438817) 100 0 (0,0) 101 0 (0,0) 110 0 (0,0) 111 0 (0,0)
For 10
Bob performs a phase-flip on q0:
10: 000 0 (0,0) 001 0 (0,0) 010 0 (0,0) 011 0 (0,0) 100 0.4349 (-0.629227,0.197361) 101 0.5651 (-0.750464,0.0438817) 110 0 (0,0) 111 0 (0,0) Z: 000 0 (0,0) 001 0 (0,0) 010 0 (0,0) 011 0 (0,0) 100 0.4349 (-0.629227,0.197361) 101 0.5651 (0.750464,-0.0438817) 110 0 (0,0) 111 0 (0,0)
For 11
Bob performs a NOT transformation on q0,
followed by a phase-flip on q0:
11: 000 0 (0,0) 001 0 (0,0) 010 0 (0,0) 011 0 (0,0) 100 0 (0,0) 101 0 (0,0) 110 0.5651 (-0.750464,0.0438817) 111 0.4349 (-0.629227,0.197361) X: 000 0 (0,0) 001 0 (0,0) 010 0 (0,0) 011 0 (0,0) 100 0 (0,0) 101 0 (0,0) 110 0.4349 (-0.629227,0.197361) 111 0.5651 (-0.750464,0.0438817) Z: 000 0 (0,0) 001 0 (0,0) 010 0 (0,0) 011 0 (0,0) 100 0 (0,0) 101 0 (0,0) 110 0.4349 (-0.629227,0.197361) 111 0.5651 (0.750464,-0.0438817)
In each case, the state of Bob's qubit q0 is equal to the state of the original random qubit. Recall that α = (-0.629227,0.197361) and β = (0.750464,-0.0438817) in this example.
The transported qubit inherits any entanglement it had with other qubits.
Example transporting random R0 from two entangled qubits R1,R0
with measurement 00
(QT2.out):
R: 00 0.3834 (-0.113858,0.608675) 01 0.1166 (-0.280054,-0.195247) 10 0.1166 (-0.280054,-0.195247) 11 0.3834 (-0.113858,0.608675) 00: 0000 0.3834 (-0.113858,0.608675) 0001 0.1166 (-0.280054,-0.195247) 0010 0 (0,0) 0011 0 (0,0) 0100 0 (0,0) 0101 0 (0,0) 0110 0 (0,0) 0111 0 (0,0) 1000 0.1166 (-0.280054,-0.195247) 1001 0.3834 (-0.113858,0.608675) 1010 0 (0,0) 1011 0 (0,0) 1100 0 (0,0) 1101 0 (0,0) 1110 0 (0,0) 1111 0 (0,0)
|R1>|00>|R0>
, which reduces to
T=|R1>|R0>
, which equals R:
T: 00 0.3834 (-0.113858,0.608675) 01 0.1166 (-0.280054,-0.195247) 10 0.1166 (-0.280054,-0.195247) 11 0.3834 (-0.113858,0.608675)
11
(QT3.out):
R: 000 0.1361 (0.125447,0.346873) 001 0.1139 (-0.27759,0.192058) 010 0.1139 (-0.27759,0.192058) 011 0.1361 (0.125447,0.346873) 100 0.1139 (-0.27759,0.192058) 101 0.1361 (0.125447,0.346873) 110 0.1361 (0.125447,0.346873) 111 0.1139 (-0.27759,0.192058) 11: X: Z: 00000 0 (0,0) 00001 0 (0,0) 00010 0 (0,0) 00011 0 (0,0) 00100 0 (0,0) 00101 0 (0,0) 00110 0.1361 (0.125447,0.346873) 00111 0.1139 (-0.27759,0.192058) 01000 0 (0,0) 01001 0 (0,0) 01010 0 (0,0) 01011 0 (0,0) 01100 0 (0,0) 01101 0 (0,0) 01110 0.1139 (-0.27759,0.192058) 01111 0.1361 (0.125447,0.346873) 10000 0 (0,0) 10001 0 (0,0) 10010 0 (0,0) 10011 0 (0,0) 10100 0 (0,0) 10101 0 (0,0) 10110 0.1139 (-0.27759,0.192058) 10111 0.1361 (0.125447,0.346873) 11000 0 (0,0) 11001 0 (0,0) 11010 0 (0,0) 11011 0 (0,0) 11100 0 (0,0) 11101 0 (0,0) 11110 0.1361 (0.125447,0.346873) 11111 0.1139 (-0.27759,0.192058)
|R2>|R1>|11>|R0>
, which reduces to
T=|R2>|R1>|R0>
, which equals R:
T: 000 0.1361 (0.125447,0.346873) 001 0.1139 (-0.27759,0.192058) 010 0.1139 (-0.27759,0.192058) 011 0.1361 (0.125447,0.346873) 100 0.1139 (-0.27759,0.192058) 101 0.1361 (0.125447,0.346873) 110 0.1361 (0.125447,0.346873) 111 0.1139 (-0.27759,0.192058)