Quantum Computing 2.4 -- Quantum code golf

Our task is to prepare a qubit, so that we ge a state ψ | \psi \rangle , that yields the result 0 | 0 \rangle in 75% of cases when measured. The qubit has the initial state 0 | 0 \rangle . Unlike before, only the quantum gates H H and T T are available to manipulate the qubit. The final state ψ | \psi \rangle results from a sequence of operations: ψ = U n U n 1 U 2 U 1 0 , U i { H , T } |\psi\rangle = U_n \cdot U_{n-1} \cdots U_2 \cdot U_1 |0\rangle,\quad U_i \in \{H, T\} What is the minimum number n n of operations needed to get a final state with 0 ψ 2 = 3 4 | \langle 0 | \psi \rangle | ^ 2 = \frac{3} {4} ?

Details: The two quantum gates have in the { 0 , 1 } \{| 0 \rangle, | 1 \rangle \} basis the matrix representation H = 1 2 ( 1 1 1 1 ) T = ( 1 0 0 e i π / 4 ) \begin{aligned} H &= \frac{1}{\sqrt{2}} \left( \begin{array}{cc} 1 & 1 \\ 1 & -1 \end{array} \right) \\ T &= \left( \begin{array}{cc} 1 & 0 \\ 0 & e^{i \pi/4} \end{array} \right) \end{aligned} It may be helpful to visualize the effect of the quantum gates on the Bloch sphere (see problem 2.3 ). In threedimensional space, the phase shift gate T T corresponds geometrically to a rotation around the z ^ \hat z - axis by the angle ϕ = π / 4 \phi = \pi / 4 .


Side note: All 1-qubit quantum gates can be represented or approximated by a sequence of operators H H and T T . In particular, the Pauli matrices have the representation X = H T 4 H Y = i H T 4 H T 4 Z = T 4 \begin{aligned} X &= H \cdot T^4 \cdot H \\ Y &= i H \cdot T^4 \cdot H \cdot T^4 \\ Z &= T^4 \end{aligned}

7 5 6 4

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

The optimal sequence of the operators H H and T T must obey the following rules

  • The sequence must begin and end with the Hadamard gate H H
  • Each Hadamard gate H H is followed by a phase gate T T

We can justify the first rule by the fact, that the phase shift does not alter the probability amplitudes of the state. If the sequece ends with the operation T T , we can delete this last operation without altering the measurement results. In particular, the phase shift does not alter the initial state ( T 0 = 0 T|0\rangle = |0\rangle ).

The second rule follows from the fact, that the Hadamard gate is self-adjoint so that H H = I H \cdot H = I . If in the sequence somewhere the H H operator appears twice in direct succession, then you can simply omit both operators without changing anything.

Considering these rules, we get a sequence of possible "programs" for our quantum computer: H , H T H , H T T H , H T T T H , H T H T H , H, HTH, HTTH, HTTTH, HTHTH, \dots The first nontrivial seqeunces have the form H T k H H T^k H . In this case, the probability P 0 = 0 ψ 2 P_{|0\rangle} = |\langle 0 | \psi \rangle|^2 for the measurement result 0 |0\rangle yields P 0 = 0 H T k H 0 2 = 1 2 ( 1 0 ) ( 1 1 1 1 ) ( 1 0 0 e i k π 4 ) ( 1 1 1 1 ) ( 1 0 ) 2 = 1 2 ( 1 1 ) ( 1 0 0 e i k π 4 ) ( 1 1 ) 2 = 1 + e i k π 4 2 2 = 1 + cos k π 4 2 = 1 , 1 2 + 1 8 , 1 2 , 1 2 1 8 , 0 \begin{aligned} P_{|0 \rangle} = |\langle 0| H T^k H |0\rangle|^2 &= \left|\frac{1}{2} \left(\begin{array}{cc} 1 & 0 \end{array} \right) \left( \begin{array}{cc} 1 & 1 \\ 1 & - 1 \end{array} \right) \left( \begin{array}{cc} 1 & 0 \\ 0 & e^{i k \frac{\pi}{4}} \end{array} \right) \left( \begin{array}{cc} 1 & 1 \\ 1 & - 1 \end{array} \right) \left(\begin{array}{c} 1 \\ 0 \end{array} \right) \right|^2 \\ &= \left|\frac{1}{2} \left(\begin{array}{cc} 1 & 1 \end{array} \right) \left( \begin{array}{cc} 1 & 0 \\ 0 & e^{i k \frac{\pi}{4}} \end{array} \right) \left(\begin{array}{c} 1 \\ 1 \end{array} \right) \right|^2 \\ &= \left|\frac{1 + e^{i k \frac{\pi}{4}}}{2} \right|^2 \\ &= \frac{1 + \cos \frac{k \pi}{4} }{2} \\ &= 1, \frac{1}{2} + \frac{1}{\sqrt 8}, \frac{1}{2}, \frac{1}{2} - \frac{1}{\sqrt 8}, 0 \end{aligned} Note, that the wanted result P 0 = 3 / 4 P_{|0 \rangle} = 3/4 does not appear in this list.

Now we consider the next sequence H T H T H HTHTH : P 0 = 0 H T H T H 0 2 = 1 8 ( 1 0 ) ( 1 1 1 1 ) ( 1 0 0 e i π 4 ) ( 1 1 1 1 ) ( 1 0 0 e i π 4 ) ( 1 1 1 1 ) ( 1 0 ) 2 = 1 8 ( 1 1 ) ( 1 0 0 e i π 4 ) ( 1 1 1 1 ) ( 1 0 0 e i π 4 ) ( 1 1 ) 2 = 1 8 ( 1 e i π 4 ) ( 1 1 1 1 ) ( 1 e i π 4 ) 2 = 1 8 ( 1 e i π 4 ) ( 1 + e i π 4 1 e i π 4 ) 2 = 1 8 1 + 2 e i π 4 e i π 2 2 = 1 8 ( 2 + 1 ) + ( 2 1 ) i 2 = 1 8 ( ( 2 + 1 ) 2 + ( 2 1 ) 2 ) = 1 8 ( 2 + 1 + 2 2 + 2 + 1 2 2 ) = 3 4 \begin{aligned} P_{|0\rangle} = |\langle 0| HTHTH |0\rangle|^2 &= \left|\frac{1}{\sqrt{8}} \left(\begin{array}{cc} 1 & 0 \end{array} \right) \left( \begin{array}{cc} 1 & 1 \\ 1 & - 1 \end{array} \right) \left( \begin{array}{cc} 1 & 0 \\ 0 & e^{i \frac{\pi}{4}} \end{array} \right) \left( \begin{array}{cc} 1 & 1 \\ 1 & - 1 \end{array} \right) \left( \begin{array}{cc} 1 & 0 \\ 0 & e^{i \frac{\pi}{4}} \end{array} \right) \left( \begin{array}{cc} 1 & 1 \\ 1 & - 1 \end{array} \right) \left(\begin{array}{c} 1 \\ 0 \end{array} \right) \right|^2 \\ &= \frac{1}{8} \left| \left(\begin{array}{cc} 1 & 1 \end{array} \right) \left( \begin{array}{cc} 1 & 0 \\ 0 & e^{i \frac{\pi}{4}} \end{array} \right) \left( \begin{array}{cc} 1 & 1 \\ 1 & - 1 \end{array} \right) \left( \begin{array}{cc} 1 & 0 \\ 0 & e^{i \frac{\pi}{4}} \end{array} \right) \left(\begin{array}{c} 1 \\ 1 \end{array} \right) \right|^2 \\ &= \frac{1}{8} \left| \left(\begin{array}{cc} 1 & e^{i \frac{\pi}{4}} \end{array} \right) \left( \begin{array}{cc} 1 & 1 \\ 1 & - 1 \end{array} \right) \left(\begin{array}{c} 1 \\ e^{i \frac{\pi}{4}} \end{array} \right) \right|^2 \\ &= \frac{1}{8} \left| \left(\begin{array}{cc} 1 & e^{i \frac{\pi}{4}} \end{array} \right) \left(\begin{array}{c} 1 + e^{i \frac{\pi}{4}}\\ 1 - e^{i \frac{\pi}{4}} \end{array} \right) \right|^2 \\ &= \frac{1}{8} \left|1 + 2 e^{i \frac{\pi}{4}} - e^{i \frac{\pi}{2}} \right|^2 \\ &= \frac{1}{8} \left|(\sqrt{2} + 1) + (\sqrt{2} - 1) i \right|^2 \\ &= \frac{1}{8} \left((\sqrt{2} + 1)^2 + (\sqrt{2} - 1)^2 \right) \\ &= \frac{1}{8} \left(2 + 1 + 2 \sqrt 2 + 2 + 1 - 2 \sqrt 2 \right) \\ &= \frac{3}{4} \end{aligned} Thus, we get the wanted probability of 75%. Futhermore, we have proved, that the sequence H T H T H HTHTH with the length n = 5 n = 5 is the shortest sequence with this property.

Alternatively, you can visualize these operations on the Bloch sphere. In this representation, the operator H H corresponds to a rotation about the angle π \pi around the axis x ^ + z ^ \hat x + \hat z and T T rotates the state vector by the angle π / 4 \pi / 4 around the axis z ^ \hat z . We start at the point r = z ^ \vec r = \hat z (north pole of the Bloch sphere). The goal is to get to a point at the circle z = cos ( θ ) = 2 cos 2 ( θ / 2 ) 1 = 1 / 2 z = \cos (\theta) = 2 \cos ^ 2 (\theta / 2) - 1 = 1/2 using only this two rotation operations. The two rotation matrices read H = ( 0 0 1 0 1 0 1 0 0 ) T = ( 1 2 1 2 0 1 2 1 2 0 0 0 1 ) \begin{aligned} \mathcal{H} &= \left( \begin{array}{ccc} 0 & 0 & 1 \\ 0 & -1 & 0 \\ 1 & 0 & 0 \end{array} \right) \\ \mathcal{T} &= \left( \begin{array}{ccc} \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} & 0 \\ \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} & 0 \\ 0 & 0 & 1 \end{array} \right) \end{aligned} The final state of the operation H T H T H HTHTH results (without displaying all the calculations) H T H T H z ^ = ( 1 / 2 1 / 2 1 / 2 ) \mathcal{H} \cdot \mathcal{T} \cdot \mathcal{H} \cdot \mathcal{T} \cdot \mathcal{H} \cdot \hat z = \left( \begin{array}{c} 1/ \sqrt{2} \\ 1/2 \\ 1/2 \end{array} \right) Finally, we can visualize these operations:

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...