1
$\begingroup$

I am looking for some help in understanding the state vector output. I am studying myself and found some exercise online. Below question is from one of those exercises - Given two qubits. Both of them are in 0 state. Using the single-qubit gates, turn them into |+> state and |-> state respectively.

from qiskit import QuantumCircuit, execute, Aer, assemble, QuantumRegister, ClassicalRegister

qc = QuantumCircuit(2, 2)
qc.h(0)
qc.measure(0, 0) 

qc.x(1)
qc.h(1)
qc.measure(1, 1)
qc.draw(output="mpl")

circuit

svsim = Aer.get_backend('aer_simulator')
qc.save_statevector()
qobj = assemble(qc)
final_state = svsim.run(qobj).result().get_statevector(decimals=3)

from qiskit.visualization import array_to_latex
array_to_latex(final_state, prefix="\\text{Statevector} = ")

Output: Statevector=[0 0 −1 0]

Upon plotting on bloch sphere, I get below -

bloch-sphere

It is my understanding that state vectors are amplitudes. So, how is qubit0 state is 0 and same for qubit 1.

Thanks!

$\endgroup$
2
  • $\begingroup$ You can also try to see if the Bloch sphere has another case once these two quanta are entangled, perhaps ..... $\endgroup$
    – R-X Zhao
    Jul 18 at 10:37
  • $\begingroup$ There is no entanglement as they are single qubit gates. $\endgroup$
    – Nihir
    Jul 18 at 16:05

1 Answer 1

1
$\begingroup$

This is circuit is easy to analyse. H gate on qo will result in a + state. The x gate on q1 puts 1 to 1 state. Next te Hgate on q1 will put q1 in the - state. In the circuit measurementgates are used and therefore the output will collapse to 1 and -1. Measurement gates are only needed for measuring counts.

from qiskit import QuantumCircuit, execute, Aer, assemble, QuantumRegister, ClassicalRegister

qc = QuantumCircuit(2, 2) qc.h(0) #qc.measure(0, 0)

qc.x(1) qc.h(1) #qc.measure(1, 1) qc.draw(output="mpl")

plot_bloch_multivector(final_state)

enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks a lot! This was very helpful to understand. :-) $\endgroup$
    – Nihir
    Jul 19 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.