# How can I find the fidelity of the preparation operation $|0\rangle$ of IBMQ?

I want to know the fidelity (or error rate) of the preparation of $$|0\rangle$$. How can I obtain it?

• Fidelity is a measure of the "closeness" of two quantum states. You need another state to compared your $|0 \rangle$ to. Feb 27 '20 at 1:43
• @VictoryOmole Thank you for the answer, but I mean the fidelity of the preparation operation (|0>) of IBMQ. As you know, in the IBM Q website, the error rates of all the operations are posted except the preparation. Therefore, I posted this question. I want to know how much the initialized state is closed to |0>. Feb 27 '20 at 4:42

## Ideal measurement

Let $$\rho_0$$ denote the state resulting from the $$|0\rangle$$ preparation. The fidelity of $$\rho_0$$ and $$|0\rangle$$ is

$$F: = F(|0\rangle, \rho_0) = \langle 0|\rho_0|0\rangle.$$

On the other hand, the probability of obtaining $$|0\rangle$$ when measuring $$\rho_0$$ in the computational basis is

$$p(0|\rho_0) = \mathrm{tr}\left(|0\rangle\langle 0|\rho_0\right) = \langle 0|\rho_0|0\rangle.\tag1$$

Thus, the fidelity is simply the probability of obtaining the $$|0\rangle$$ outcome upon measuring the output $$\rho_0$$ of the preparation in the computational basis. This suggests that if we prepare and measure $$n$$ times, counting the number $$k$$ of times when $$|0\rangle$$ is obtained then the fraction $$\frac{k}{n}$$ approximates $$F$$. However, as pointed out by @nippon in the comments, this procedure assumes error-free measurement.

## SPAM errors

In practice, measurements are not error-free and $$(1)$$ becomes

$$p(0|\rho_0) = \mathrm{tr}(E_0\rho_0)\tag2$$

where $$E_0$$ and $$E_1$$ are POVM elements describing the real measurement. Note that $$(2)$$ depends on both state preparation and measurement (SPAM) errors. For a full description of SPAM errors, we also require terms for the other computational basis state. These are usually collected into the so-called T matrix

$$T := \begin{pmatrix} \mathrm{tr}(E_0\rho_0) & \mathrm{tr}(E_0\rho_1) \\ \mathrm{tr}(E_1\rho_0) & \mathrm{tr}(E_1\rho_1) \end{pmatrix}$$

where each column provides the measurement outcome distribution for the corresponding preparation. In the ideal case, $$T = I$$. See this paper for more details.

Even though this quantity fails to separate preparation and measurement errors, it is easier to obtain than pure preparation fidelity and is also more useful in practice since every quantum state used in the course of a quantum algorithm is both prepared and measured and thus affected once by each type of error.

• Doesn't this assume that measurements introduce no error? Jan 25 at 11:07
• Yes, you're right. This wasn't very useful. I replaced the analysis assuming error-free measurement with a brief discussion of SPAM errors. Thank you for pointing out the issue! Jan 25 at 18:04