I am learning from qiskit textbook, and I was wondering how may I get a statevector of the following form:

$$ \frac{\sqrt{2}}{2}|00\rangle + \frac{\sqrt{2}}{2}|10\rangle $$

If I run code for this in jupyter notebook then it shows completely different way to visualize this statevector. How can I represent a statevector like this?

  • $\begingroup$ Just to be clear, were you only looking for the ability to display it as you have written it? Or were you also looking for how to create the state using gates so that it could be represented as shown? It might help clarify if you included your code so that we could see what you had generated with your attempt. Or perhaps a link to the textbook pages you were attempting to work through. (Unless the answer below has already answered your question. In which case, click the checkmark beside the answer to accept it.) $\endgroup$
    – PGibbon
    Commented Sep 14, 2022 at 14:24

1 Answer 1


Use draw method with output parameter set to latex

from qiskit.quantum_info import Statevector
import numpy as np

sv = Statevector([1 / np.sqrt(2), 0, 1 / np.sqrt(2), 0])
sv.draw(output = 'latex')

# Or simply,
# sv.draw('latex')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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