A5: Generate state 13(0+1+2))\frac{1}{\sqrt{3}} (\ket{0} + \ket{1} + \ket{2})) II

Time Limit: 3 sec

Memory Limit: 512 MiB

Score: 100

Writer: admin

Editorial

In problem A4, we prepared the superposition state 1200+12(10+01)\frac{1}{\sqrt{2}} \ket{00} + \frac{1}{2}(\ket{10} + \ket{01}), composed of the three computational basis states 00\ket{00}, 10\ket{10}, and 01\ket{01}.

In this problem, we establish a uniform superposition of these states, changing their probability amplitudes to 1/31/\sqrt{3}.

This can be achieved by replacing the Hadamard gate in Equation (1)(1) of editorial A4 with a rotation gate. If we can find a rotation gate RR which acts on the left qubit to transform the initial 00\ket{00} state to 1300+2310\frac{1}{\sqrt{3}} \ket{00} + \sqrt{\frac{2}{3}} \ket{10}, then the subsequent controlled-Hadamard and controlled-XX gates would produce our desired uniform superposition:

00R1300+2310CH(0,1)13(00+10+11)CX(1,0)13(00+10+01)\begin{align} \ket{00} &\xrightarrow{R} \frac{1}{\sqrt{3}} \ket{00} + \sqrt{\frac{2}{3}} \ket{10} \nonumber\\ &\xrightarrow{CH(0, 1)} \frac{1}{\sqrt{3}} (\ket{00} + \ket{10} + \ket{11}) \nonumber\\ &\xrightarrow{CX(1, 0)} \frac{1}{\sqrt{3}} (\ket{00} + \ket{10} + \ket{01}) \end{align}

We will now find the axis of rotation and the angle to perform such a transformation.

An arbitrary state ψ\ket{\psi} of a single qubit can be expressed by two angle parameters, θ\theta and ϕ\phi, as follows:

ψ=cos(θ/2)0+(cos(ϕ)+isin(ϕ))sin(θ/2)1\begin{equation} \ket{\psi} = \cos(\theta/2) \ket{0} + (\cos(\phi) + i \sin(\phi))\sin(\theta/2) \ket{1} \end{equation}

The method of representing the quantum state of one qubit on the surface of a sphere with radius 1 is called the Bloch sphere, and by using phase gates and rotation gates based on the angular parameters θ\theta and ϕ\phi, it is possible to transition any one-qubit state to any other arbitrary state.

Bloch SphereBloch sphere

Let us find the Bloch angular parameters θ\theta and ϕ\phi for the state 1300+2310\frac{1}{\sqrt{3}} \ket{00} + \sqrt{\frac{2}{3}} \ket{10}.

Since the imaginary component is 00, we can set ϕ=0\phi = 0, and establish the following system of equations:

{cos(θ/2)=1/3sin(θ/2)=2/3\begin{equation} \left\{ \, \begin{aligned} & \cos(\theta/2) = 1/\sqrt{3} \\ & \sin(\theta/2) = \sqrt{2/3} \end{aligned} \right. \end{equation}

By solving the above equation within the range 0θ<2π0 \leq \theta < 2 \pi, we obtain the following solution:

θ0=4arctan(63+3)\begin{equation} \theta_0 = 4 \arctan\left(\frac{\sqrt{6}}{3 + \sqrt{3}}\right) \end{equation}

Looking at the Bloch sphere, we see that the angle parameter θ\theta represents the rotation angle about the yy-axis.

Thus, using the RyR_y gate, which is a rotation gate about the yy-axis, we can implement the rotation by θ0\theta_0 to achieve the transition

00Ry(θ0,0)1300+2310.\ket{00} \xrightarrow{Ry(\theta_0, 0)} \frac{1}{\sqrt{3}} \ket{00} + \sqrt{\frac{2}{3}} \ket{10}.

As a result, the problem can be solved through the following transitions:

00Ry(θ0,0)1300+2310CH(0,1)13(00+10+11)CX(1,0)13(00+10+01)\begin{align} \ket{00} &\xrightarrow{Ry(\theta_0, 0)} \frac{1}{\sqrt{3}} \ket{00} + \sqrt{\frac{2}{3}} \ket{10} \nonumber\\ &\xrightarrow{CH(0, 1)} \frac{1}{\sqrt{3}} (\ket{00} + \ket{10} + \ket{11}) \nonumber\\ &\xrightarrow{CX(1, 0)} \frac{1}{\sqrt{3}} (\ket{00} + \ket{10} + \ket{01}) \end{align}

Sample Code

Below is a sample program:

from qiskit import QuantumCircuit
import math
 
def solve() -> QuantumCircuit:
    qc = QuantumCircuit(2)
 
    theta = 4 * math.atan(math.sqrt(6)/ (3 + math.sqrt(3)))
 
    qc.ry(theta, 0)
    qc.ch(0, 1)
    qc.cx(1, 0)
 
    return qc