# How to get a qubit into superposition?

I have a qubit
$$\left| \psi \right> = (\alpha_1 + i\alpha_2 ) \left|0\right> + (\beta_1 + i\beta_2 )\left|1\right>$$

so if i give values $$\alpha_1 + i\alpha_2 = 1 + 4i$$ and $$\beta_1 + i\beta_2 = 3 + 4i$$ i will nomralise these and give it to psi

now when I measure using qiskit and plot it will be like 0.6 in state zero and 0.4 in state is there any way that I can make it an equal probability?

I tried passing it through Hadamard gate but it does not give me equal probability.

• What do you mean by "bring these to superposition"? Can you give an example of something being brought to superposition? – Rammus Mar 2 at 18:44
• I mean to bring them into the equal probability of finding in state zero and state one when I measure it. – bhagi radh Mar 2 at 18:48
• So you want a unitary matrix $U$ such that $U |\psi\rangle = \frac{e^{i \phi}}{\sqrt{2}} |0\rangle + \frac{e^{i \theta}}{\sqrt{2}} |1\rangle$, for some $\theta, \phi$? – Rammus Mar 2 at 18:49
• I have edited my question can you check once. Thank you for responding. – bhagi radh Mar 2 at 18:57
• If you want to use the Hadamard gate then reset it to the state $|0\rangle$ then appy the Hadamard gate. – KAJ226 Mar 2 at 19:42

The Hadamard gate put the states $$|0\rangle$$ and $$|1\rangle$$ into uniform superposition but not for any arbitrary state.

You can check that: $$H|0\rangle = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1& 1\\ 1 & -1 \\ \end{pmatrix} \begin{pmatrix} 1 \\ 0\end{pmatrix} = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 1 \end{pmatrix} = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$$ and similarly, you can show that $$H|1\rangle = \dfrac{|0\rangle - |1\rangle}{\sqrt{2}}$$. In each case, the probability to see a $$|0\rangle$$ or $$|1\rangle$$ is $$\big| 1/\sqrt{2}\big|^2 = 1/2.$$

If you have an arbitrary single qubit state, $$|\psi \rangle = \alpha|0\rangle + \beta|1\rangle$$ then you can show that $$H|\psi\rangle = (\alpha + \beta)|0\rangle + (\alpha - \beta)|1\rangle$$, so the probability of seeing the state $$|0\rangle$$ is $$\big| \alpha + \beta|^2$$, and the probability of seeing the state $$|1\rangle$$ is $$\big| \alpha - \beta \big|^2$$, thus they are not the same. So applying the Hadamard gate to an arbitrary state does not bring it to a uniform superposition state.

Of course, you can find a Unitary matrix $$U$$ that maps the state $$|\psi\rangle$$ to the uniform superposition state $$\dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$$. But from all your previous questions, it seems like you are using Qiskit for the work that you are doing. What you can do is to reset the particular qubit you are interesting in to the $$|0\rangle$$ state through the reset option, then apply the Hadamard gate. This is probably the easiest. Below is an example of how to do reset:

from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
qreg_q = QuantumRegister(1, 'q')
creg_c = ClassicalRegister(1, 'c')
circuit = QuantumCircuit(qreg_q, creg_c)
circuit.ry(1.213, qreg_q[0])  #A quantum state that is not in uniform superposition
circuit.reset(qreg_q[0]) # reset the qubit to |0>
circuit.h(qreg_q[0]) # Apply the Hadamard  gate
print(circuit)

┌───────────┐     ┌───┐
q_0: ┤ RY(1.213) ├─|0>─┤ H ├
└───────────┘     └───┘
c: 1/═══════════════════════