Homework 3

Important: Write your name and Unity ID in every submission file. Name the submission files correctly as asked for.

  1. (25 points) Fredkin gate implementation

    The picture below shows one implementation of a Fredkin (controlled swap) gate using 1-qubit gates and CNOTs. (Source: Stack Exchange)

    Fredkin gate implementation

    Implement this Fredkin circuit in Qiskit, as follows:

    You can implement using either Python (.py) or a Jupyter notebook (.ipynb). Submit your solution either as fredkin.py or as fredkin.ipynb.

  2. (20 points) n-bit sequential XORs

    The files xor.py and xor.ipynb show an implementation of the gate-model XOR circuit. Download your preferred version of the file and use it as a starting point to implement an n-bit circuit. (We're providing this starter file so that you'll follow the directions below!)

    Submit your solution as sequential_xor.py or sequential_xor.ipynb.

  3. (30 points) n-bit parallel XORs

    Using the previous exercise as a starting point, implement a generalized n-bit XOR in Qiskit, where instead of adding an additional XOR to the end of the chain the XORs happen in a parallel fashion. Efficient quantum circuits are extremely important, as too many operations introduce a lot of error.

    Submit your solution as parallel_xor.py or parallel_xor.ipynb.

  4. (25 points) Phase kickbacks

    Phase kickbacks are important parts of many quantum algorithms. We will be looking at a couple of different ways these can be seen. Create two circuits in qiskit, each of two qubits, one of which uses a CNOT gate and one of which uses a controlled U1 gate, specifically -pi/2 (a controlled U1 gate can be added with the command circ.cu1(angle, control, target))

    Submit your file as phase.py or phase.ipynb.