Multi-Qubit Programs Solutions

Solutions for the exercises in Try Your Hand.

    1. The amplitude for images/_pragprog/svg-74.png is the second element of the vector:

      images/_pragprog/svg-block-636.png
    2. The amplitude for images/_pragprog/svg-71.png is the first element of the vector:

      images/_pragprog/svg-block-637.png
  1. No. The columns of a matrix for a quantum gate correspond to the idealized states. The number of idealized states is a power of 2. Since 3 is not a power of 2, a images/_pragprog/svg-395.png matrix can’t be a quantum gate matrix.

  2. The correct expression is c. This is a single qubit with two pentagon images/_pragprog/svg-17.png qubelets and a single triangle images/_pragprog/svg-18.png qubelet rotated a quarter turn anticlockwise. Thus, the correct way to express it is:

    images/_pragprog/svg-block-638.png
    1. Probability of collapsing to each of the four idealized states is calculated in the following table:

      Idealized State

      Amplitude

      Conjugate of Amplitude

      Probability of Collapsing

      images/_pragprog/svg-71.png

      images/_pragprog/svg-628.png

      images/_pragprog/svg-628.png

      images/_pragprog/svg-629.png

      images/_pragprog/svg-74.png

      images/_pragprog/svg-630.png

      images/_pragprog/svg-631.png

      images/_pragprog/svg-632.png

      images/_pragprog/svg-318.png

      images/_pragprog/svg-633.png

      images/_pragprog/svg-634.png

      images/_pragprog/svg-635.png

      images/_pragprog/svg-319.png

      images/_pragprog/svg-628.png

      images/_pragprog/svg-628.png

      images/_pragprog/svg-629.png

    2. For the classical register to record a 1 when you collapse the second qubit means that the quantum state had to collapse to either a images/_pragprog/svg-74.png or a images/_pragprog/svg-319.png state. Thus, from the probabilities calculated in the previous part, the probability of logging a 1 is:

      images/_pragprog/svg-block-639.png
    3. Yes, the quantum state of the system will change.

      Since the second qubit collapses to images/_pragprog/svg-18.png, the new state of the system can only have the images/_pragprog/svg-74.png and images/_pragprog/svg-319.png states. These must be normalized as follows to get the new state, images/_pragprog/svg-398.png:

      images/_pragprog/svg-block-640.png

      In other words, images/_pragprog/svg-636.png, and the state before and after the measurement of the second qubit are different.

      This example shows that the act of measuring a qubit changes the state of the system. This effect, in fact, is a key defining feature of quantum mechanics and underpins Heisenberg’s uncertainty principle.[119]

      Thus, if you arbitrarily place Measure gates in your code to help you see whether it’s behaving as expected, you’ll end up actually destroying the effect you’re trying to see.

  3. This matrix describes a quantum operation that is like a images/_pragprog/svg-637.png gate as shown by the following circuit:

    images/multi_qubit_algebra/Controlled_S_Dagger.png

    When the control qubit is images/_pragprog/svg-17.png, any pentagon images/_pragprog/svg-17.png qubelets in the target qubit’s state are left alone but the triangle images/_pragprog/svg-18.png qubelets are given a quarter turn clockwise.

    1. Since this gate works on three qubits, its gate matrix’s dimensions will be images/_pragprog/svg-368.png.

    2. The quantum states on the bottom two qubits are swapped only when images/_pragprog/svg-367.png is images/_pragprog/svg-18.png. That is,

      images/_pragprog/svg-block-641.png

      Specifically, only the following states are affected by this gate:

      images/_pragprog/svg-block-642.png

      Even though the control qubit is images/_pragprog/svg-18.png in images/_pragprog/svg-638.png and images/_pragprog/svg-432.png, swapping the second and third states doesn’t change the overall quantum state. For all other cases, the control qubit is images/_pragprog/svg-17.png, and hence, the gate doesn’t modify any of those states. Thus, the gate matrix is:

      images/_pragprog/svg-block-643.png
    1. Since this circuit has two qubits, it’ll have a images/_pragprog/svg-338.png gate matrix. To obtain the gate matrix, recall that the H gate splits the images/_pragprog/svg-17.png and images/_pragprog/svg-18.png qubits as follows:

      images/_pragprog/svg-block-644.png

      In these equations, images/_pragprog/svg-400.png and images/_pragprog/svg-639.png are the actions of the H gate on the images/_pragprog/svg-17.png and images/_pragprog/svg-18.png qubits, respectively.

      Now, work out what this circuit does to each of the four idealized states, images/_pragprog/svg-71.png, images/_pragprog/svg-318.png, images/_pragprog/svg-318.png, and images/_pragprog/svg-319.png:

      images/_pragprog/svg-71.png Idealized State:

      Both the top and bottom H gates split the images/_pragprog/svg-17.png qubit.

      Thus, the mega-qubit formed by this idealized state is:

      images/_pragprog/svg-block-645.png

      This state corresponds to the following vector:

      images/_pragprog/svg-block-646.png
      images/_pragprog/svg-74.png Idealized State:

      The top H gate splits the images/_pragprog/svg-17.png qubit, and the bottom H gate splits the images/_pragprog/svg-18.png qubit.

      Thus, the mega-qubit formed by this idealized state is:

      images/_pragprog/svg-block-647.png

      This state corresponds to the following vector:

      images/_pragprog/svg-block-648.png
      images/_pragprog/svg-318.png Idealized State:

      The top H gate splits the images/_pragprog/svg-18.png qubit, and the bottom H gate splits the images/_pragprog/svg-17.png qubit.

      Thus, the mega-qubit formed by this idealized state is:

      images/_pragprog/svg-block-649.png

      This state corresponds to the following vector:

      images/_pragprog/svg-block-650.png
      images/_pragprog/svg-319.png Idealized State:

      Both the top and bottom H gates split the images/_pragprog/svg-18.png qubit.

      Thus, the mega-qubit formed by this idealized state is:

      images/_pragprog/svg-block-651.png

      This state corresponds to the following vector:

      images/_pragprog/svg-block-652.png

      The previous four vectors correspond to the columns of the matrix representing this circuit:

      images/_pragprog/svg-block-653.png
    2. While the S gate rotates triangle images/_pragprog/svg-18.png qubelets a quarter turn anticlockwise, the images/_pragprog/svg-239.png gate rotates the triangle images/_pragprog/svg-18.png qubelets clockwise. Both gates leave pentagon images/_pragprog/svg-17.png qubelets alone.

      Thus, to obtain the gate matrix for the given circuit, replace images/_pragprog/svg-106.png with images/_pragprog/svg-217.png:

      images/_pragprog/svg-block-654.png
    1. To calculate the matrix for this circuit, start by breaking it up as shown in the following figure:

      images/multi_qubit_algebra/Upside_Down_CNOT_Gate_Components.png

      Then the matrix images/_pragprog/svg-117.png for the entire circuit is calculated as follows:

      images/_pragprog/svg-block-655.png

      images/_pragprog/svg-331.png is the matrix for the CNOT gate. images/_pragprog/svg-640.png and images/_pragprog/svg-641.png are the matrices for the part of the circuit where each qubit is operated on by an H gate, respectively.

      The matrix for the CNOT gate is:

      images/_pragprog/svg-block-656.png

      The images/_pragprog/svg-640.png and images/_pragprog/svg-641.png matrices were obtained in the previous part. That is,

      images/_pragprog/svg-block-657.png

      Thus, the matrix images/_pragprog/svg-117.png for the entire circuit is:

      images/_pragprog/svg-block-658.png

      This circuit, then, modifies the idealized states as follows:

      images/_pragprog/svg-block-659.png

      It leaves the images/_pragprog/svg-71.png and images/_pragprog/svg-318.png states alone but affects the images/_pragprog/svg-74.png and images/_pragprog/svg-319.png states. Specifically, when the second qubit is images/_pragprog/svg-18.png, it switches the first qubit.

      This circuit acts like an upside down CNOT gate where the first qubit is the target and the second qubit is the control, as shown here:

      images/multi_qubit_algebra/Upside_Down_CNOT_Gate_solutions_copy.png
    2. To calculate the matrix for this circuit, start by breaking it up as shown in the following figure:

      images/multi_qubit_algebra/CZ_Gate_Components_solutions_copy.png

      Thus, the matrix images/_pragprog/svg-117.png for the entire circuit can be calculated as follows:

      images/_pragprog/svg-block-660.png

      images/_pragprog/svg-642.png is the matrix for the upside down CNOT gate calculated in the previous part:

      images/_pragprog/svg-block-661.png

      The images/_pragprog/svg-643.png and images/_pragprog/svg-364.png are the matrices for the pass-through H gate. This matrix was calculated in Working with Blended States: Mega-Qubit as a Tensor:

      images/_pragprog/svg-block-662.png

      Thus, the matrix images/_pragprog/svg-117.png for the entire circuit is:

      images/_pragprog/svg-block-663.png

      This is the matrix for the Control Z gate shown in the following figure:

      images/multi_qubit_algebra/Controlled_Z_Gate.png

      This gate leaves the images/_pragprog/svg-71.png, images/_pragprog/svg-74.png, and images/_pragprog/svg-318.png alone but inverts the triangle images/_pragprog/svg-18.png qubelets in the target qubit if the control qubit is images/_pragprog/svg-18.png. That is:

      images/_pragprog/svg-block-664.png
    1. The triangle images/_pragprog/svg-18.png qubelet in the bottom cell of the qubelet combination on the left is rotated 90° anticlockwise but non-inverted in the bottom cell of that on the right. That is, the bottom triangle images/_pragprog/svg-18.png qubelet on the left is rotated 90° clockwise on the right. So for the qubelet combination on the right to have the same quantum state as that on the left, the top triangle images/_pragprog/svg-18.png qubelet in the right combination must be rotated 90° anticlockwise, as shown in the following figure:

      images/multi_qubit_algebra/i11_Qubelet_Combination_After_Rotations.png
    2. The triangle images/_pragprog/svg-18.png qubelet in the bottom cell of the qubelet combination on the left is inverted but non-inverted in the bottom cell of that on the right. So that the right combination has the same quantum state as that on the left, the triangle images/_pragprog/svg-18.png qubelet in the top cell of the left combination is given a 180° rotation, as shown in the following figure:

      images/multi_qubit_algebra/Minus_i101_Qubelet_Combination_After_Rotations.png
    1. Expand the tensor product to get the quantum state as follows:

      images/_pragprog/svg-block-665.png

      This corresponds to a quantum state vector having images/_pragprog/svg-644.png elements. All the elements are images/_pragprog/svg-645.png except its twenty-third element which is images/_pragprog/svg-164.png.

      The associated mega-qubit is:

      images/multi_qubit_algebra/10110_Mega_Qubit.png

      The mega-qubit contains just a single qubelet combination. Thus, even an idealized state can be expressed as a tensor product.

    2. Expand the tensor product to get the quantum state, as follows:

      images/_pragprog/svg-block-666.png

      This corresponds to the following vector:

      images/_pragprog/svg-block-667.png

      The associated mega-qubit is shown in the figure.

      images/multi_qubit_algebra/0_Plus_i_1_OTimes_0_Mega_Qubit.png

      The triangle images/_pragprog/svg-18.png qubelet in the second qubelet combination is rotated 90° due to the amplitude of images/_pragprog/svg-318.png being images/_pragprog/svg-106.png.

    3. Expand the tensor product to get the quantum state as follows:

      images/_pragprog/svg-block-668.png

      This corresponds to the following vector:

      images/_pragprog/svg-block-669.png

      The associated mega-qubit is the following:

      images/multi_qubit_algebra/0_Minus_i_1_OTimes_0_Plus_i_1_Mega_Qubit_solutions_copy.png

      The anticlockwise quarter-turn triangle images/_pragprog/svg-18.png qubelet in the second qubelet combination contributes images/_pragprog/svg-646.png to its amplitude coefficent. That is, images/_pragprog/svg-647.png. Likewise, the clockwise quarter-turn triangle images/_pragprog/svg-18.png qubelet in the third qubelet combination contributes images/_pragprog/svg-648.png to its amplitude coefficient. That is, images/_pragprog/svg-649.png.

      In the last qubelet combination, top triangle images/_pragprog/svg-18.png qubelet contributes images/_pragprog/svg-648.png and the bottom triangle images/_pragprog/svg-18.png qubelet contributes images/_pragprog/svg-650.png. That is, the overall amplitude coefficient is the product of these terms: images/_pragprog/svg-651.png. In other words, the fourth qubelet combination is equivalent to one where both triangle images/_pragprog/svg-18.png qubelets are not rotated. You can also see this by giving both qubelets the same rotation but in opposite directions so that any sign changes are canceled out: rotate the top triangle images/_pragprog/svg-18.png qubelet a quarter turn anticlockwise and the bottom triangle images/_pragprog/svg-18.png qubelet a quarter turn clockwise.

      Thus, the mega-qubit can also be drawn as in the following figure:

      images/multi_qubit_algebra/0_Minus_i_1_OTimes_0_Plus_i_1_Mega_Qubit_After_4th_Column_Rotation_solutions_copy.png

      In this figure, the fourth qubelet combination has non-rotated triangle images/_pragprog/svg-18.png qubelets.

    4. The H gate splits the images/_pragprog/svg-17.png qubit, and the X gate switches the images/_pragprog/svg-18.png qubit as follows::

      images/_pragprog/svg-block-670.png

      Thus, the given tensor product is:

      images/_pragprog/svg-block-671.png

      Expand this tensor product to get the quantum state as follows:

      images/_pragprog/svg-block-672.png

      This corresponds to the following vector:

      images/_pragprog/svg-block-673.png

      This images/_pragprog/svg-322.png vector has a images/_pragprog/svg-164.png in the fifth and sixth positions, and images/_pragprog/svg-645.png elsewhere.

      The associated mega-qubit is:

      images/multi_qubit_algebra/100_Plus_101_Mega_Qubit_solutions_copy.png
    1. To see whether the two qubits are entangled, try factoring the quantum state as follows:

      images/_pragprog/svg-block-674.png

      This quantum state can be factored as the tensor product of two quantum states. Hence, the qubits are not entangled.

    2. The given quantum state can’t be factored as a product of tensor products. Hence, the qubits are entangled.

      You can also directly see this from the quantum state itself. If the first qubit collapses to, say, images/_pragprog/svg-17.png, then the quantum state has collapsed to images/_pragprog/svg-74.png. Thus, the second qubit is forced to collapse to images/_pragprog/svg-18.png. An analogous result holds if the first qubit collapses to images/_pragprog/svg-18.png. Furthermore, you’ll see the same behavior had you collapsed the second qubit before the first.

  4. To identify the three missing qubelets, first expand the tensor product of the three qubits to obtain the quantum state of the mega-qubit, as follows:

    images/_pragprog/svg-block-675.png

    The missing qubelet is in the bottom cell of the fourth qubelet combination which corresponds to the images/_pragprog/svg-429.png term in the quantum state specified in the above equation. This combination is formed by taking the pentagon images/_pragprog/svg-17.png qubelet from the top qubit, the triangle images/_pragprog/svg-18.png qubelet from the middle qubit, and the inverted triangle images/_pragprog/svg-18.png qubit from the bottom qubit. The inverted qubelet gives the negative sign associated with this combination. Thus, the first missing qubelet is an inverted triangle images/_pragprog/svg-18.png qubelet.

    The missing qubelet is in the top cell of the sixth qubelet combination, which corresponds to the images/_pragprog/svg-652.png term in the quantum state specified in the equation for this exercise. This combination is formed by taking the 90°-rotated triangle images/_pragprog/svg-18.png qubelet in the first qubit, the pentagon images/_pragprog/svg-17.png qubelet from the middle qubit, and the inverted triangle images/_pragprog/svg-18.png qubelet from the bottom qubit. The inverted qubelet gives the negative sign and the 90°-rotated top qubelet gives the complex number images/_pragprog/svg-106.png associated with this combination. Thus, the second missing qubelet is a triangle images/_pragprog/svg-18.png qubelet rotated a quarter turn anticlockwise.

    The missing qubelet is in the top cell of the last qubelet combination, which corresponds to the images/_pragprog/svg-653.png term in the quantum state specified in this equation. This combination is formed by taking the the 90°-rotated triangle images/_pragprog/svg-18.png qubelet in the first qubit, the triangle images/_pragprog/svg-18.png qubelet from the middle qubit, and the inverted triangle images/_pragprog/svg-18.png qubelet from the bottom qubit. The inverted qubelet gives the negative sign and the 90°-rotated top qubelet gives the complex number images/_pragprog/svg-106.png associated with this combination. Thus, this qubelet combination should be drawn as in the following figure:

    images/multi_qubit_algebra/Minus_i_111_Qubelet_Combination_Before_Rotations_solutions_copy.png

    But the qubelet combination shown in the given mega-qubit has an unrotated triangle images/_pragprog/svg-18.png qubelet in the middle and bottom cells. Hence, we need to bring the qubelet combination shown in the previous figure to the desired form by rotating qubelets without modifying the combination’s quantum state. Specifically, invert the bottom triangle images/_pragprog/svg-18.png qubelet so it’s unrotated, while simultaneously rotating the top qubelet 180° so the top triangle images/_pragprog/svg-18.png qubelet is now rotated a quarter turn clockwise, as shown in the following figure:

    images/multi_qubit_algebra/Minus_i_111_Qubelet_Combination_After_Rotations.png

    The quantum state of the qubelet combination on the right is still images/_pragprog/svg-653.png. (The faded qubelets in the top and bottom cells indicate the original position of those qubelets, respectively.)

    The final mega-qubit is shown in the following figure:

    images/multi_qubit_algebra/Three_Qubit_Mega_Qubit_Complete.png
    1. This mega-qubit can collapse in the following four ways:

      Collapsed Quantum State

      Probability

      State Logged in Classical register

      images/_pragprog/svg-71.png

      images/_pragprog/svg-block-676.png

      00

      images/_pragprog/svg-654.png

      images/_pragprog/svg-block-677.png

      01

      images/_pragprog/svg-318.png

      images/_pragprog/svg-block-678.png

      10

      images/_pragprog/svg-390.png

      images/_pragprog/svg-block-679.png

      11

      Notice that no rotation information is recorded in the classical register.

    2. Since the probability of each collapsed state is images/_pragprog/svg-655.png, the magnitude of each amplitude is the square root of images/_pragprog/svg-655.png. Thus, the quantum state for the mega-qubit is:

      images/_pragprog/svg-block-680.png
    3. To write the quantum state as a tensor product, factor the previous equation as follows:

      images/_pragprog/svg-block-681.png
    4. The tensor product obtained in the previous part can be drawn as shown in the following figure:

      images/multi_qubit_algebra/Mega_Qubit_from_Rotated_Qubelets_with_Qubits.png

      The top qubit on the left, images/_pragprog/svg-367.png, can be obtained by splitting images/_pragprog/svg-17.png using an H gate.

      The bottom qubit on the left, images/_pragprog/svg-398.png, has a 90°-rotated triangle images/_pragprog/svg-18.png qubelet. Hence, after splitting images/_pragprog/svg-17.png with an H gate, use an S gate to give the triangle images/_pragprog/svg-18.png qubelet a quarter turn anticlockwise.

      The quantum circuit to create this mega-qubit is shown in the following figure:

      images/multi_qubit_algebra/Two_Parallel_H_Gates_Plus_S_Gate.png
  5. No. Once you teleport images/_pragprog/svg-398.png, the images/_pragprog/svg-365.png and images/_pragprog/svg-366.png qubits collapse and are no longer entangled. Furthermore, they are physically distant from each other. Thus, this circuit can no longer teleport any more quantum states—teleporting circuits are single-use circuits. Once they’re done teleporting, the qubits are no longer useful. If you want to teleport another state, you need another pair of images/_pragprog/svg-365.png and images/_pragprog/svg-366.png qubits.

  6. When the images/_pragprog/svg-367.png and images/_pragprog/svg-365.png qubits collapse, the images/_pragprog/svg-366.png qubit is:

    images/_pragprog/svg-block-682.png

    The images/_pragprog/svg-366.png qubit will have one pentagon images/_pragprog/svg-17.png qubelet and a triangle images/_pragprog/svg-18.png qubelet that is rotated a quarter turn clockwise.

    Since images/_pragprog/svg-656.png, you’ll need to apply a Z gate to the images/_pragprog/svg-366.png qubit to obtain the state that will be teleported.

    The Z gate doesn’t affect the pentagon images/_pragprog/svg-17.png gate but turns the triangle images/_pragprog/svg-18.png qubelet 180° so that it ends up rotated a quarter turn anticlockwise. Thus, the state that is teleported is:

    images/_pragprog/svg-block-683.png
  7. Yes, the circuit can be used to teleport a quantum state.

    The Entangler and Loader blocks, together with the images/_pragprog/svg-365.png, images/_pragprog/svg-366.png, and the quantum state to be teleported, images/_pragprog/svg-367.png, are labeled as shown in the following circuit:

    images/multi_qubit_algebra/Upside_Down_Teleporting_Circuit_Labeled.png
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.59.187