Project 1: Depolarizing channel

In this project we will implement the depolarizing channel in qiskit and test it with state tomography on the simulator and on a real device.

We introduced the depolarizing channel in Chapter 5 where we showed the circuit that implements it.

Here it is again, for reference

# imports
import numpy as np
from qiskit import QuantumRegister, QuantumCircuit

####################################
#  Depolarizing channel on IBMQX2  #
####################################

# Quantum register
q = QuantumRegister(4, name="q")

# Quantum circuit
depolarizing = QuantumCircuit(q)

# Depolarizing channel acting on q_2
## Qubit identification
system = 0
a_0 = 1
a_1 = 2
a_2 = 3

## Define rotation angle
theta = 0.0

## Construct circuit
depolarizing.ry(theta, q[a_0])
depolarizing.ry(theta, q[a_1])
depolarizing.ry(theta, q[a_2])
depolarizing.cx(q[a_0], q[system])
depolarizing.cy(q[a_1], q[system])
depolarizing.cz(q[a_2], q[system])

# Draw circuit
depolarizing.draw(output='mpl')


Create a function that returns a quantum circuit implementing a depolarizing channels with parameter $p$ on a specified qubit system, using three ancillary qubits ancillae = [a1, a2, a3].

def depolarizing_channel(q, p, system, ancillae):
"""Returns a QuantumCircuit implementing depolarizing channel on q[system]

Args:
q (QuantumRegister): the register to use for the circuit
p (float): the probability for the channel between 0 and 1
system (int): index of the system qubit
ancillae (list): list of indices for the ancillary qubits

Returns:
A QuantumCircuit object
"""

# Write the code here...


Write a circuit prepare_state that prepares the system qubit in an initial state that has non-zero populations and coherences (both real and imaginary parts)

# Let's fix the quantum register and the qubit assignments

# We create the quantum circuit
q = QuantumRegister(5, name='q')

# Index of the system qubit
system = 2

# Indices of the ancillary qubits
ancillae = [1, 3, 4]


For different values of $p \in [0, 1]$:

1. Concatenate prepare_state and depolarizing_channel in a circuit and create the corresponding tomography_circuits (check the preliminaries for help with the tomography).
2. Execute the tomography_circuits in the simulator and collect the rsults
# For example, let's consider 10 equally spaced values of p
p_values = np.linspace(0, 1, 10)


2. Find analytically what is the density matrix of the system qubit after the depolarizing channel as a function of $p$.
3. Plot the values of $\rho_{11}$, $\rho_{22}$, $\Re \rho_{12}$, $\Im \rho_{12}$ as functions of $p$ and compare them to the analytical prediction.