2

I am trying to rule out the state |000> for a simple 3 qbits quantum circuit executed on a real quantum backend.

The code exctract below is unelegant but I guess it does the trick and for the time being the value |000> hasn't come up. Still I don't clearly understand why the statevector based on the instructions set analysis (measurement excepted) shows that all the state are strictly equiprobable while the CCNOT gate is such that q0 is forced to |0> in all instances where both q1 AND q2 are in state |0>. I tend to think that the explanation has to do with density matrixes applied to mixed states but I don't know where to get precisely from there...Could you point me in the right direction?

    qcM=QuantumCircuit (3)  
    qcM.h(0)
    qcM.h(1)
    qcM.h(2)
    qcM.x(1)
    qcM.x(2)
    qcM.ccx(1,2,0)
    qcM.x(1)
    qcM.x(2)
 
    #Statevector du circuit décrit
    st1 = Statevector.from_instruction(qcM)
    print('State vector : ', st1)
    qcM.measure_all()

The statevector I am getting upon execution is the following:

    The best backend is ibmq_manila
    State vector :  Statevector([0.35355339+0.j, 0.35355339+0.j, 0.35355339+0.j,
             0.35355339+0.j, 0.35355339+0.j, 0.35355339+0.j,
             0.35355339+0.j, 0.35355339+0.j],
            dims=(2, 2, 2))

Here is a picture of the circuit:

MyCircuit

Thanks for your help,
Kind regards,
Bertrand

CKE
  • 1,533
  • 19
  • 18
  • 29
BCayzac
  • 21
  • 2

1 Answers1

0

I think that the circuit you have shown might not be exhibiting the behavior you expect. The Hadamard gate maps the initial state to the state |+> = (|0>+|1>)/sqrt 2, visualized as the x-axis on the Bloch sphere.

The |+> state is the +1 eigenstate of the Pauli-X operator. This can be seen with the matrix representation:

X|+> = [[0,1],[1,0]]*[[1/sqrt(2)],[1/sqrt(2)]] = [[1/sqrt(2)],[1/sqrt(2)]]

Since all of the qubits are in the |+> state after the Hadamard operators, none of the Pauli X-gates nor the Toffoli gate affect the final state. This can also be observed by writing out the evolution of the state explicitly in dirac notation, numbering the qubits with q_0 being the least significant bit.

|000> -> |+++> -> (X|+>)(X|+>)|+> = |+++> = 1/2(|00>+|01>+|10>+|11>)|+>

Applying the Toffoli to the last state yields

1/2(|00>+|01>+|10>)|+> + 1/2 |11>X|+> = |+++> -> (X|+>)(X|+>)|+> = |+++>

So the system is left in the same state as it was after the initial row of Hadamards. The resulting statevector will be an even mixture of each of the amplitudes, which you can verify by writing out the Kronecker product of |+> with itself twice. When I am trying to visualize the effect of different components of a circuit, I like to use quirk. Here is a demonstration of the circuit you have shown in quirk: Link to circuit. Lastly, the qiksit textbook has a great treatment of single-qubit gates.

Sorry for the typesetting, I don't have the reputation to display my LaTeX with images! I hope this is helpful.

  • Thank you very much Ben for this wealth of information. I need to do exacltly what your recomment to start thinking along the linear algebra behing the circuits and move away from classical promgramming way of thinking. Kind regards, Bertrand – BCayzac Jan 21 '22 at 00:20
  • Hi Ben, Quirk is a great tool ! Thanks. I think I am closing in to a solution with it (see link below) but I am struggling to find the equivalent of "anti control" gate in Qiskit https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22H%22%2C%22H%22%2C%22H%22%5D%2C%5B%22%7C1%E2%9F%A9%E2%9F%A81%7C%22%2C%22%E2%97%A6%22%2C%22%E2%97%A6%22%5D%2C%5B%22Measure%22%2C%22Measure%22%2C%22Measure%22%5D%5D%7D – BCayzac Jan 25 '22 at 00:05
  • ...still trying to find way arounds (now with MCT). Ideeas welcome.. KInd regards, Bertrand – BCayzac Jan 25 '22 at 00:06