7 Cascaded Quantum Gates

Computer Science Level pending

Suppose we feed a qubit with initial state 0 | 0 \rangle into a system consisting of 7 7 cascaded quantum logic gates. 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 7 U 6 U 2 U 1 0 , U i { H , T } \large{|\psi\rangle = U_7 \cdot U_6 \cdots U_2 \cdot U_1 |0\rangle,\quad U_i \in \{H, T\}}

The two available component gates are defined below:

H = 1 2 ( 1 1 1 1 ) T = ( 1 0 0 e i π / 4 ) \large{\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}}

The gate system can be configured in 2 7 2^7 different ways. The probability of observing output ψ | \psi \rangle in the state 0 | 0 \rangle can take 7 7 distinct values. If the arithmetic mean of these 7 7 probability values is α \alpha , enter 1000 α \lfloor 1000 \alpha \rfloor .

Note: \lfloor \cdot \rfloor denotes the floor function .

Supplemental Information:
Inspiration
Prereq #1
Prereq #2


The answer is 546.

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

Steven Chase
Jul 23, 2018

The following code evaluates all 128 possibilities. The process is the following:

1) For each binary permutation from 0000000 0000000 to 1111111 1111111 , assign the H H matrix to 0 0 and the T T matrix to 1 1
2) Multiply all 7 matrices together sequentially to yield an aggregate system matrix
3) Multiply the aggregate system matrix by ( 1 0 ) \left( \begin{array}{c} 1 \\ 0 \end{array} \right) to yield a result in the form ( α β ) \left( \begin{array}{c} \alpha \\ \beta \end{array} \right)
4) Calculate the probability of measuring the state 0 = ( 1 0 ) | 0 \rangle = \left( \begin{array}{c} 1 \\ 0 \end{array} \right) by calculating α 2 |\alpha|^2
5 ) Print analyses and results for all system configurations, and produce a sorted list of probabilities for measuring state 0 = ( 1 0 ) | 0 \rangle = \left( \begin{array}{c} 1 \\ 0 \end{array} \right)


Results (pastebin)

The probabilities for measuring the 0 | 0 \rangle state can be the following:

0.00000000 0.14644661 0.50000000 0.57322330 0.75000000 0.85355339 1.00000000 0.00000000 \\ 0.14644661 \\ 0.50000000 \\ 0.57322330 \\ 0.75000000 \\ 0.85355339 \\ 1.00000000

Code:

import math
import numpy as np
import random
import sys

H = (1.0/math.sqrt(2.0)) * np.array([[1.0,1.0],[1.0,-1.0]])

T = np.array([[1.0,0.0],[0.0,complex(1.0/math.sqrt(2.0),1.0/math.sqrt(2.0))]])

zero = np.array([[1.0],[0.0]])

zero_mat = []

print "H"
print H
print ""
print "T"
print T
print ""
print "zero"
print zero
print ""

print "#####################################"
print "#####################################"
print "#####################################"
print ""

count = 0

for j in range(0,2**7):

    N0 = (j / (2**0)) % 2
    N1 = (j / (2**1)) % 2
    N2 = (j / (2**2)) % 2
    N3 = (j / (2**3)) % 2
    N4 = (j / (2**4)) % 2
    N5 = (j / (2**5)) % 2
    N6 = (j / (2**6)) % 2

    print "Matrix configuration (0=H, 1=T)"
    sys.stdout.write(N6)
    sys.stdout.write(N5)
    sys.stdout.write(N4)
    sys.stdout.write(N3)
    sys.stdout.write(N2)
    sys.stdout.write(N1)
    sys.stdout.write(N0)
    print ""
    print ""

    print "Count"
    print count
    print ""

    ####

    if N0 == 0:
        M0 = H
    else:
        M0 = T

    ####

    if N1 == 0:
        M1 = H
    else:
        M1 = T

    ####

    if N2 == 0:
        M2 = H
    else:
        M2 = T

    ####

    if N3 == 0:
        M3 = H
    else:
        M3 = T

    ####

    if N4 == 0:
        M4 = H
    else:
        M4 = T

    ####

    if N5 == 0:
        M5 = H
    else:
        M5 = T

    ####

    if N6 == 0:
        M6 = H
    else:
        M6 = T

    Q = np.dot(M0,M1)
    Q = np.dot(Q,M2)
    Q = np.dot(Q,M3)
    Q = np.dot(Q,M4)
    Q = np.dot(Q,M5)
    Q = np.dot(Q,M6)

    ans = np.dot(Q,zero)

    alpha = ans[0]
    beta = ans[1]

    zero_mat.append((abs(alpha))**2.0)

    print "Final state"
    print ans
    print ""
    print "Probabilities of |0> and |1> states"
    print (abs(alpha))**2.0
    print (abs(beta))**2.0
    print ""
    print "Unitarity check"
    print math.hypot(abs(alpha),abs(beta))
    print "#################################"
    print ""

    count = count + 1

print ""
print ""

print "#####################################"
print "#####################################"
print "#####################################"
print ""

zero_mat.sort()

print "Sorted probabilities for |0> state"
print ""

for j in range(0,len(zero_mat)):
    print zero_mat[j]

improve more

improve more - 2 years, 9 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...