In her lab, Alice can initialize her two auxiliary qubits (on wires 1 and 2) to , and she hopes to create a logical qubit that would help protect the message of her first qubit (wire 0). In other words, if her message is , she wants to encode the message into the state .

Once the qubits pass through the noisy communication channel and Bob receives them, he will have to decode the message, so that the first qubit (wire 0) again takes on the value Alice tried sending, . In this case, we are assuming that either none of the qubits experienced a bit-flip error, or a maximum of one of them did.

In this exercise, you are asked to code the quantum circuit Alice needs to use to encode the qubit into a logical qubit and then. After the bit flip errors, you must also write down the procedure Bob uses to decode Alice's message.

Hint

Look at the theory part! Remember that you can use the qml.CNOT and qml.Toffoli gates to build the encoding and decoding circuits. If you get stuck, use a simple example to help you go through the circuit!

or to submit your code

To interact with codercises, please switch to a larger screen size.

Learning Objectives:

  • Understand the effects of different types of qubit errors.
  • Know how to perform simple quantum error correction to mitigate for bit- and phase-flip errors.