Jul 13, 2021

## Quantum Computing

# My IBM Quantum Challenge’21 Experience- Part 2

## Solving the third and the fourth exercises of the IQC’21.

In my previous blog, I talked about how I got introduced to quantum and my experience with solving the 1st two exercises of the IBM Quantum Challenge 2021. In this blog, I will take you through my *Intermediate Badge* experience where I briefly talk about solving exercises 3 and 4!!

*I hope you are excited about what is ahead😉*

## 3. Quantum Error Correction:

Quantum Error Correction just like any other error correction is done in two folds- *detection* and *correction*. The exercise walked me through how quantum errors are expressed as a combination of *bit* flips and *phase* flips. Now, an interesting feature or rather a quantum disadvantage is that we can’t directly measure a state to detect an error since this would necessarily collapse the state and produce undesired results. Neither we can create multiple copies of the same state according to the No-Cloning Theorem.

So for error detection, the exercise initially proposed using an entangled state but this method is not efficient because it doesn’t help us locate the actual position of the error. So a better approach was designing a surface code for this problem. The exercise encoded each state into a 5 qubit state given by the *code qubits*. The *syndrome qubits* represented the stabilizers and the output was given by the *output qubits*.

This is the layout of the qubits where *ci *represents *code qubits* and* si *represents *syndrome qubits*. Each triangle is associated with a stabilizer operation on the three qubits at the vertices. The top and bottom one represents XXX and the one on the sides represents ZZZ.

After this, the exercise walked us through creating a syndrome circuit which is like a minuscule version of the real surface code and an initial circuit that gives state `0000`

with certainty.

This is what the combined circuit looked like:

This exercise assumed errors could only be on two qubits, *code[0]* and *code[4]* and we were dealing with only a subset of 4 errors where the error was on a single qubit rather than all the 16 possible errors.

`For error x0:`

Output was 0010 for 1024 shots.

For error x1:

Output was 0100 for 1024 shots.

For error z0:

Output was 0001 for 1024 shots.

For error z1:

Output was 1000 for 1024 shots.

These(above) are the corresponding outputs for the errors we are considering in this exercise. For a larger number of errors repeating the syndrome readouts and analyzing the result obtained helps in the process of decoding the errors. This exercise uses the retired device `ibmq_tokyo`

for the error correction procedure.

The connectivity graph for our layout will look something like this:

`c0....s0....c1`

: : :

: : :

s1....c2....s2

: : :

: : :

c3....s3....c4

Now on comparing this with the layout of `ibmq_tokyo`

, the exercise decided on an initial layout, `initial_layout = [0,2,6,10,12,1,5,7,11]`

where the order of the qubits was given by:

`[Qubit(QuantumRegister(5, 'code'), 0),`

Qubit(QuantumRegister(5, 'code'), 1),

Qubit(QuantumRegister(5, 'code'), 2),

Qubit(QuantumRegister(5, 'code'), 3),

Qubit(QuantumRegister(5, 'code'), 4),

Qubit(QuantumRegister(4, 'syn'), 0),

Qubit(QuantumRegister(4, 'syn'), 1),

Qubit(QuantumRegister(4, 'syn'), 2),

Qubit(QuantumRegister(4, 'syn'), 3)]

I quickly drew the layout formed after mapping the qubits in our circuit to Tokyo’s circuit and this is what I obtained(shown below). This is the point where we start solving the exercise.

As you can see in this, 2 and 7 aren’t connected in Tokyo but they are required to be connected according to our initial circuit layout. Well, one of the hints that I got from Slack was that I was supposed to use a SWAP gate between two qubits such that it had a connection with either 2 or 7. After a lot of deliberations, I decided to do a SWAP between *code[1]* and *syn[0]*.

`# Right ZZZ`

qc_syn.swap(code[1], syn[0])

qc_syn.cx(code[1],syn[2])

qc_syn.swap(code[1],syn[0])

qc_syn.cx(code[2],syn[2])

qc_syn.cx(code[4],syn[2])

#qc_syn.barrier()

I didn’t remember the definition of SWAP so I got tricked hence was not getting the correct results. While discussing this with another person on Slack I recalled that **SWAP just exchanges the states of two qubits but doesn’t physically change the qubits**. So I replaced *code[1]* with *syn[0]* in the CX gate operation and voila! I just finished my first ever Quantum Error Correction problem. 💁

With this, I was one step closer to my *Intermediate Badge*. I just had to solve another problem and boom I will have the *Intermediate Badge* in my bag!!!

## 4. Transmon Qubit:

This is one of the new areas I got introduced to during this challenge. Transmon Qubits are integral to superconducting quantum computing and hence form a backbone of the present-day IBM Quantum System. In this exercise, we perform spectroscopy using a real IBM Quantum System which is used to investigate the characteristic energy of transmon qubits. I was excited to learn about how the physical framework of qubits works and about Qiskit Pulse.

We can see that the energy levels of the quantum harmonic oscillator (QHO) are equally spaced. Due to the Josephson junction anharmonicity is introduced in the circuit and thus the energy levels of the transmon qubit are no longer equally spaced. The energy difference between higher levels is shorter than that of the lower levels.

This picture shows the different hardware channels like the Drive Channel, Control Channel, Pulse Channel, and Acquire Channel which are used to pass several microwave pulses to the Quantum Device. This exercise uses one such channel to perform spectroscopy.

The tutorial walked me through how to calculate the transition frequency for |0⟩→|1⟩** **transition and calibrating X-180 pulse amplitude using Rabi oscillation. The exciting part was to be able to run the pulse experiments on ibmq_jakarta, a real quantum system.

The problem was to find the transition frequency for|1⟩→|2⟩ transition. To solve the exercise we needed to create a pulse schedule with two pulses. First, we had to create an 𝑋𝜋 pulse for the transition of the qubit from |0⟩→|1⟩ and then another pulse with varying frequency for |1⟩→|2⟩ transition. Taking the help of the tutorial I constructed the 𝑋𝜋 pulse as follows:

`pulse.play(x_pulse, DriveChannel(qubit))`

Now for the second pulse I could use the same spec_pulse as was used in the tutorial for |0⟩→|1⟩ transition with varying frequency, so overall my pulse schedule looked like this:

`pulse.play(x_pulse, DriveChannel(qubit))`

pulse.set_frequency(freq*GHz, DriveChannel(qubit))

pulse.play(spec_pulse, DriveChannel(qubit))

Once this was done I had to modify the fitting parameters to fit the spectroscopy signal to a Lorentzian function of this form:

My Spec12 frequency (f12) came out to be approximately 4.887. Finally, I passed the grader and was done solving exercise 4!!!

With that, I secured the next level badge the *Intermediate Badge!! *I had been continuously working on the first four challenges so I decided to give myself a break and come back stronger to solve the final challenge, the most interesting one. 😄