# I want to create a depolarizing channel on IBM qiskit

I want to replicate the depolarizing noise channel for a 4 qubit circuit system, where p is the probability for an error. I tried doing this: But I get the error WARNING: all-qubit error already exists for instruction "measure", composing with additional error.

I have looked at Qiskits documentation on the depolarizing_error function but it is not clear, or I don't understand the maths.

Could anyone please shed more light on this?

Edit: I might have found a solution, but I'm not sure if my logic is right.

For my 4 qubit system, I want to apply the depolarizing channel noise to the measurement of the qubits $$q_{0}$$ and $$q_{2}$$ in the z-direction: Edit: I realized that the single-qubit depolarizing channel above acts separately on the two qubits: The aim is to use Qiskits built in depolarizing quantum error channel function $$\texttt{depolarizing}\_\texttt{error(param, num_qubits, standard_gates=True)}$$ to create the desired depolarizing channel. It takes the depolarization parameter $$\lambda$$ and number of qubits $$n$$ to create the depolarizing channel $$\begin{equation} \label{eqn:depo-chan-qiskit} \varepsilon(\rho) = (1-\lambda)\rho + \lambda Tr\left[\rho\right]\frac{I}{2^{n}} \text{.} \end{equation}$$
It can then be manipulated to create the single qubit depolarizing channel $$\begin{equation} \label{eqn:depo-chan-1qubit} \varepsilon(\rho_{single-qubit}) = (1-P)\rho + \frac{P}{3}\left(X\rho X + Y\rho Y + Z\rho Z\right) \text{.} \end{equation}$$ This is shown by the following derivation. For a single qubit $$n=1$$ $$\frac{I}{2^{1}} = \frac{1}{4} \left(I\rho I + X\rho X + Y\rho Y + Z\rho Z\right),$$ and $$Tr[\rho] = 1.$$
If we then chose $$\lambda=\frac{4^{n}P}{4^{n}-1},$$ where $$P$$ is the probability. At $$n=1$$ the depolarization paramater $$\lambda = \frac{4P}{3}$$ and by substituting these results into $$\varepsilon(\rho)$$ we get that
\begin{align} \varepsilon(\rho) &= (1-\frac{4P}{3})\rho + \frac{4P}{3} \left(I\rho I + X\rho X + Y\rho Y + Z\rho Z\right) \frac{1}{4} \\ &= \left( 1 - \frac{4P}{3} + \frac{P}{3} \right)\rho + \frac{P}{3} \left(X\rho X + Y\rho Y + Z\rho Z\right) \\ &= (1-P)\rho + \frac{P}{3}\left(X\rho X + Y\rho Y + Z\rho Z\right) \text{.} \end{align} 