1
$\begingroup$

For my undergraduate final project I am working on a Quantum Inspired Genetic Algorithm.

For this I am using IBM Q real devices and I need to set a custom initial state on qubits. Using the statevector simulator this was possible, however I am not sure how to do so on real quantum hardware. For example I want to put qubit into state $|\psi\rangle = \sqrt{0.3}|0\rangle + \sqrt{0.7}|1\rangle$.

$\endgroup$
11
  • 3
    $\begingroup$ Hi! Were you using qc.initialize() before? This can still be run on the real devices $\endgroup$
    – met927
    Feb 6, 2020 at 18:06
  • 1
    $\begingroup$ Did you have an issue with running it? I just tested and was able to $\endgroup$
    – met927
    Feb 6, 2020 at 18:12
  • 2
    $\begingroup$ Just note that quantum tomography is used for a quantum state measurement, not for qubits initialization. $\endgroup$ Feb 6, 2020 at 18:16
  • 1
    $\begingroup$ You can run qc.initialize([1,0], 0) to initialize it into the |0> state, where the 1st param is the vector to use and the 2nd is the qubits to apply it to. The state you are describing isn't a valid quantum state, as a^2 + b^2 = 1 $\endgroup$
    – met927
    Feb 6, 2020 at 18:17
  • 2
    $\begingroup$ I understand that Adhisha is looking for method how to initialize state of qubit and I edited the question accordingly. $\endgroup$ Feb 6, 2020 at 22:12

1 Answer 1

3
$\begingroup$

To prepare an arbitrary single qubit state it is possible to use $\mathrm{U3}$ gate. The gate is defined by a matrix

$$ \mathrm{U3}(\theta, \phi, \lambda)= \begin{pmatrix} \cos(\theta/2) & -\mathrm{e}^{i\lambda}\sin(\theta/2) \\ \mathrm{e}^{i\phi}\sin(\theta/2) & \mathrm{e}^{i(\phi+\lambda)}\cos(\theta/2) \end{pmatrix}. $$

When then gate is applied on a qubit in state $|0\rangle$ (i.e. initial state of all qubits on IBM Q), it is transformed to state

$$ |\varphi_0\rangle = \cos(\theta/2)|0\rangle + \mathrm{e}^{i\phi}\sin(\theta/2)|1\rangle. $$

Setting parameters $\theta$ and $\phi$ allows you to get any single qubit state you need.

In your case $|\psi\rangle = \sqrt{0.3}|0\rangle + \sqrt{0.7}|1\rangle$, so obviously $\phi = 0$.

Since $\cos(\theta/2) = \sqrt{0.3}$ parameter $\theta$ is given as

$$ \theta = 2 \arccos(\sqrt{0.3}) = 1.9823. $$

Note 1: In case $\alpha$ and $\beta$ are real numbers, $\phi = 0$ always and you can apply $\mathrm{Ry}(\theta)$ gate (i.e. y-rotation) with same parameter $\theta$ instead because $\mathrm{Ry}(\theta) = \mathrm{U3}(\theta,0,0)$.

Note 2: To preare any multiqubit quantum state, a method introduced in Transformation of quantum states using uniformly controlled rotations can be employed.

$\endgroup$

Your Answer

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

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