By preparing $n$ qubits in $|0 \rangle ^{\otimes n}$ and then passing through the Hadamard gate, one can obtain a system superposition in $\{0,1 \}^n$, each state with equal probability.

I’m wondering if it’s possible to prepare the system in a state where some of the states $|i\rangle$ have a probability of zero.

And $i$ need not be constant in some digit.

Using two qubits as an example: input $|00 \rangle$, expecting $|\psi \rangle = \frac{1}{\sqrt{3}}(|10\rangle +|01\rangle+|00\rangle)$. Do there exists some gate doing this?

  • $\begingroup$ What do you mean “has probability $0$”? You can choose to apply an arbitrary gate to any qubit that puts it into an unequal superposition. There are a number of questions on this site that address how to do that. $\endgroup$ Commented Jun 5, 2022 at 4:18
  • $\begingroup$ For example, two qubits has zero probability in 00, but then 01, 10 are allowed $\endgroup$
    – yupbank
    Commented Jun 5, 2022 at 4:20
  • $\begingroup$ you can find a unitary sending any initial state into any final state, if that's what you're asking. Or more precisely put, given any pair of states $|\psi\rangle,|\phi\rangle$, there is some unitary $U$ (actually, infinitely many such $U$) such that $U|\psi\rangle=|\phi\rangle$. See eg quantumcomputing.stackexchange.com/q/15807/55 $\endgroup$
    – glS
    Commented Jun 5, 2022 at 10:40
  • $\begingroup$ In the general case, there is no single answer on how to create such states efficiently and it is still an ongoing field of research. A related question to your is this one: quantumcomputing.stackexchange.com/questions/15692/… which may provide some insight into why it is not an obvious solution $\endgroup$ Commented Jun 5, 2022 at 11:33
  • 1
    $\begingroup$ Possible duplicate of quantumcomputing.stackexchange.com/q/17358/10454 $\endgroup$
    – Tristan Nemoz
    Commented Jun 5, 2022 at 17:24

1 Answer 1


you can check out qiskit textbook,

  1. https://qiskit.org/textbook/ch-gates/phase-kickback.html
  2. https://qiskit.org/textbook/ch-quantum-hardware/density-matrix.html#5.-Mixed-States-in-the-Bloch-Sphere--

This is how you do it:

import numpy as np
from qiskit import QuantumCircuit, QuantumRegister, assemble, Aer

q = QuantumRegister(2, name = 'q')
circuit = QuantumCircuit(q)   

#Define initial state    
initial_state = [1/np.sqrt(3), 1/np.sqrt(3),1/np.sqrt(3),0]   
circuit.initialize(initial_state, [0,1])   


enter image description here


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.