Homework 3


Assignments: These assignments are optional, but highly encouraged. They will not be checked.

  1. (25 points) Slide 35 indicates how to build a more complex gate from a sequence of simpler ones, i.e., how to build a CNOT from 2 Hadamards and a CPHASE, also depicted in slide 37. Use Quirk to create such a 3-gate 2-Qubit CNOT solution. Notice that CPHASE is a Pauli gate, you have to figure out which one. Also add a regular CNOT gate using 2 more Qubits. And add a sample display to all four Qubits. Then test your solution: The upper 2-Qubit circuit should behave the same as the lower 2-Qubit one for all four input combinations.

    Turn in file cphase.txt (export as URL)

  2. (25 points) Test drive the IBM Quantum Experience and create a Toffoli equivalent circuit.
    Hints:

    Turn in file toffoli.pdf and toffoli.qasm

  3. (25 points) Let's create the toffoli circuit in qiskit.
    Hints:

    Turn in file toffoli.py

  4. (25 points) You already created the 1-bit full adder from slide 41 on Quirk. The CCNOT gates are Toffoli gates, i.e., you can now create the adder in Qiskit.
    Hints:

    Turn in file adder.py

  5. We could even run it on IBM's larger-scale simulator (see device tab in Q Experience: ibmqx_quasm_simulator [20 Qbits] and ibmqx_hpc_quasm_simulator [32 Qubits, no conditions]), or connect Qiskit to a real IBM Q machine (but check their wiring, it's limited in that only certain Qubits are connected, which also dictates how you need to map your controlled gates.