# Depolarizing channel implementation on IBM Q

Given a single qubit in the computational basis, $$|\psi\rangle =\alpha |0\rangle + \beta|1\rangle$$, the density matrix is $$\rho=|\psi\rangle\langle\psi|=\begin{pmatrix} \alpha^2 & \alpha \beta^*\\ \alpha^*\beta & \beta ^2\end{pmatrix}$$.

Depolarizing channel is defined to be the super-operator $$\mathcal{N}:\rho \rightarrow (1-p)\rho +p\pi$$, where $$\pi=I/2$$. Therefore, here, $$\mathcal{N} (\rho) = (1-p)\begin{pmatrix} \alpha^2 & \alpha \beta^*\\ \alpha^*\beta & \beta ^2\end{pmatrix} + \frac{p}{2} \begin{pmatrix} 1 & 0\\0 & 1\end{pmatrix}$$.

How can one implement this evolution on IBM Q?

• Just wait! $\quad$ – Norbert Schuch Oct 7 '18 at 8:31

There are several ways that you could realise the depolarising map $$\mathcal N_p(\rho) = (1\!-\!p)\:\!\rho + p \!\!\:\cdot\!\tfrac{1}{2}\mathbf 1$$ map on a quantum computer — including an idealised quantum computer, in which waiting around for the noise to do the work for you would not be an available method.$$\def\ket#1{\lvert#1\rangle}$$

We start from the fact that the completely depolarising map can be realised by using a uniformly random Pauli operator: $$\mathcal N_1(\rho) = \tfrac{1}{2}\mathbf 1 = \tfrac{1}{4}\rho + \tfrac{1}{4}X\rho X + \tfrac{1}{4} Y \rho Y + \tfrac{1}{4} Z \rho Z \mspace{48mu} (*) \mspace{-48mu}$$ For the sake of brevity, let $$\mathrm{id}$$ be the identity operation on a single qubit density operator, and let $$\mathcal X(\rho) = X \rho X$$, $$\mathcal Y(\rho) = Y \rho Y$$, and $$\mathcal Z(\rho) = Z \rho Z$$. Then we may abbreviate Eqn. $$(*)$$ by writing $$\mathcal N_1 = \tfrac{1}{4} \mathrm{id} + \tfrac{1}{4} \mathcal X + \tfrac{1}{4} \mathcal Y + \tfrac{1}{4} \mathcal Z ,$$ which emphasises the fact we are considering a randomly applied operation. Then, more generally, we may decompose: \begin{align} \mathcal N_p \,&=\, (1\!-\!p) \;\!\mathrm{id} \,+\, p \:\!\mathcal N_1 \\&=\, (1\!-\!\tfrac{3p}{4}) \;\!\mathrm{id} + \tfrac{p}{4}\mathcal X + \tfrac{p}{4}\mathcal Y + \tfrac{p}{4}\mathcal Z. \end{align} Then, one approach we can take is to simulate a source of randomness which governs which of the four maps $$\mathrm{id}$$, $$\mathcal X$$, $$\mathcal Y$$, or $$\mathcal Z$$ are applied.

Which way you would like to do this depends in part in what operations you would like to use to do so. There are two approaches which strike me as being more obvious ones:

• If you are happy to use up to three TOFFOLI gates, then you can describe the maps as being governed by a probability distribution on two bits in which $$\mathrm{Pr}[x \!=\! 00] \,=\, 1 - 3p/4$$, and $$\mathrm{Pr}[x \!=\! ab] \,=\, p/4$$ for any $$ab \ne 00$$. We could do this by considering an appropriate superposition state to describe the distribution $$x$$, $$\ket{\gamma} = \tfrac{\sqrt{4-3p\,}}{2} \ket{00} + \tfrac{\sqrt p}{2} \ket{01} + \tfrac{\sqrt p}{2} \ket{10} + \tfrac{\sqrt p}{2} \ket{11}$$ and then using TOFFOLI gates to control an $$X$$, $$Y$$, or $$Z$$ operation conditioned on $$x = 01$$, $$x = 10$$, and $$x = 11$$ respectively.

• At the cost of only one more qubit, you can instead use three CNOT gates, using different independently prepared qubits to control whether an $$\mathcal X$$ operation is applied, a $$\mathcal Y$$ operation is applied, a $$\mathcal Z$$ operation is applied, or any combination of them or none of them. This seems to me to be substantially less resource intensive, so I will describe this in some detail.

We are going to use three qubits to trigger independent events. These events are acting on the input with an $$\mathcal X$$ channel, acting on the input with a $$\mathcal Y$$ channel, and action on the input with a $$\mathcal Z$$ operation, in sequence. Because the events are independent, it may be that more than one of them occurs. This is something we have to take into account in order to simulate the distribution $$(1\!-\!\tfrac{3p}{4},\,\tfrac{p}{4},\,\tfrac{p}{4},\,\tfrac{p}{4})$$ of Pauli operations to be applied — because the event of [apply $$\mathcal X$$, don't apply $$\mathcal Y$$, then apply $$\mathcal Z$$] has the same net effect as [don't apply $$\mathcal X$$, apply $$\mathcal Y$$, and don't apply $$\mathcal Z$$], and we would like to have the correct probabilities of having each possible net effect. By symmetry, we can infer that we would like to have the same probability $$z$$ of each of the effects to occur, so we would like to solve the equation $$\tfrac{1}{4}p = z(1-z)^2 + z^2(1-z) = z-z^2$$ For any $$0 \leqslant p \leqslant 1$$, there should be a unique $$0 \leqslant z \leqslant \tfrac{1}{2}$$ which solves the above equation. Subject to that value of $$z$$, we define the state $$\ket{\delta_z} = \sqrt{1-z\;\!}\;\! \ket{0} + \sqrt{z}\;\! \ket{1}.$$ We then prepare three copies of this state to use effectively as a source of randomness, albeit involved in coherently controlled operations which determines whether the input qubit is subject to an $$X$$, $$Y$$, or $$Z$$ transformation. The circuit conveying the main idea is the following one on the left (with the circuit on the right describing how it would be realised in terms of the usual set of Clifford gates):

The symbols at the end of the top three wires are 'trace out' operations, and in effect mean 'ignore anything that happens to this qubit from now on'. (You could measure the qubits and simply ignore the result if you like, though to get the result of the depolarising channel it is important that you actually do ignore the outcomes of those measurements, as the transformation that occurs conditioned on any particular outcome will be not a depolarising map but a particular Pauli transformation.) The three instances of $$H$$ followed by $$S$$ in the right-hand circuit realises the Clifford operation which permutes the Bloch sphere axes $$X \to Y \to Z \to X$$, allowing us to simulate the different controlled Pauli operators via cyclically changing the reference frame on the input qubit.