# Package for building quantum circuits
from qiskit import QuantumCircuit
# Package for running the quantum code on a simulated quantum computer
from qiskit_aer import AerSimulator
# Package for plotting the results of the quantum code as a histogram
from qiskit.visualization import plot_histogram
Simulating Qubits, Superposition, Entanglement, and Measurement with Qiskit (50 pts.)
Imports
Below are the Qiskit imports needed for this homework. If you need to import any other libraries for your solutions, add the import statements to the below code cell and comment as to why you imported the library or package.
Section 1: Basic Quantum Gates (12 pts.)
This section of the homework will help you a better understanding of how each of the quantum gates affect a single qubit.
- (2 pts.) Create a single qubit and measure its value. Comment on how many times the measurement took place and the results. Visualize your results with a histogram. Are these the expected results?
- (6 pts.) One gate at a time, apply the X, Y, Z, H, and S gates to the single qubit and measure the results. Create a labeled histogram for each experiment to visualize the results. Comment on the results and if they are the expected values.
- (2 pts.) Now focus on just the H gate. Run the code which applies and measures the H gate on the single qubit several times and generate some combined statistics on the results. Comment on the results. Now apply two H gates in series on the qubit and measure, comment, and visualize the results.
Section 2: Two Qubit Superposition (7 pts.)
This section of the homework will test if two qubits are entangled with each other.
- (1 pt.) Create the two qubit state \(|00\rangle\). Measure the results and visualize with a histogram to prove that you have created the correct state.
- (3 pts.) Apply the Hadamard gate to the first qubit and the apply the CNOT gate with the first qubit as the control and the second qubit as the target. What superposition of states have you created (don’t forget the normlization constant)?
- (3pts.) How can you show that you have properly entangled your two qubits? Design and carry out an experiment to show this.
Section 3: Bell States (13 pts.)
The state you made in Section 2 is one of four Bell states. The Bell states are: \[\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)\] \[\frac{1}{\sqrt{2}}(|00\rangle - |11\rangle)\] \[\frac{1}{\sqrt{2}}(|01\rangle + |10\rangle)\] \[\frac{1}{\sqrt{2}}(|01\rangle 1 |10\rangle)\]
- (3 pts.) Which Bell state did you create in Section 2? Explain your answer.
- (10 pts.) Create the Bell state \(\frac{1}{\sqrt{2}}(|01\rangle + |10\rangle)\). Prove that you have properly entangled the qubits.
Section 4: Three Qubit Entanglement (20 pts.)
This section will have you explore creating quantum circuits with three entangled qubits. 1. (2 pts.) Create the three qubit state \(|000\rangle\). Prove that you have made this state. 2. (15 pts.) Apply any gates to this three qubit state such that you get two or more possible states upon measurement. What state (including normalization constants) have you created? Construct a theoretical answer and then test to see if it is true. 3. (3 pts.) Prove that you have properly entangled your three qubits.