# Circuits for constructing entangled states


```python
import numpy as np

from qiskit import QuantumRegister, ClassicalRegister
from qiskit import QuantumCircuit
from qiskit import execute, BasicAer

import qiskit.tools.visualization as qvis

import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning) 
```

In the lecture I showed you the entangled state
\begin{eqnarray}
 |\Psi_\rangle &=& \frac{1}{\sqrt{2}} \left( |00\rangle + |11 \rangle \right).
\end{eqnarray}

But this isn't the only two-qubit entangled states. In fact, this state is just one of the four included in the so-called 'Bell basis', a set of 4 orthonormal 2-qubit entangled states. The Bell basis is especially important in the quantum teleporation protocol found in the other notebooks.

Your job here is to write small quantum circuits to construct the four states in the Bell basis
\begin{eqnarray}
|\Psi_{0}\rangle &=& \frac{1}{\sqrt{2}} \left( |00\rangle + |11 \rangle \right) \\
|\Psi_{1}\rangle &=& \frac{1}{\sqrt{2}} \left( |01\rangle + |10 \rangle \right) \\
|\Psi_{2}\rangle &=& \frac{1}{\sqrt{2}} \left( |00\rangle - |11 \rangle \right) \\
|\Psi_{3}\rangle &=& \frac{1}{\sqrt{2}} \left( |01\rangle - |10 \rangle \right) \\
\end{eqnarray}
Below is some boilerplate code for creating the circuits and outputting the state vector so you can be sure you got the right one.


```python
q = QuantumRegister(2, name='q')
bell_circuit = QuantumCircuit(q)

# YOUR CODE GOES HERE 
# Construct the Bell states here by applying Qiskit gates
# You can copy the code into 4 different cells or just modify in here
# to get the different states
bell_circuit.h(q[0])
bell_circuit.cx(q[0], q[1])

# Draw the circuit
print(bell_circuit.draw())

# Execute the quantum circuit and print the state vector
backend = BasicAer.get_backend('statevector_simulator')
result = execute(bell_circuit, backend).result()
print("The state vector in the computational basis is:")
print(result.get_statevector(bell_circuit).reshape(4, 1))
```

## Higher-dimensional entangled states

Entanglement is not limited to two qubits, but can become much more complicated as there are many different 'separability structures' that a multi-qubit entangled state can take. For example, a 3-qubit state might be a tensor product of 3 single qubit states, a tensor product of a two-qubit entangled state with a single-qubit state, or even a purely entangled 3-qubit state (i.e. 'genuine multipartite entanglement').

One such state is the GHZ state,
\begin{equation}
 |GHZ\rangle = \frac{1}{\sqrt{2}} \left( |000\rangle + |111\rangle \right)
\end{equation}


```python
# YOUR CODE HERE
# Create a circuit and construct the GHZ state. 
# You can copy the boilerplate code from the 2-qubit case but will of course have to
# alter the register size and the gate sequence
```

c243ef9b69fd4b3402c12ba0f7c7d4c8fe5abf1e
ipynb
Jupyter Notebook
01-gate-model-theory/notebooks/Making-Entangled-States.ipynb
a-capra/Intro-QC-TRIUMF
9738e6a49f226367247cf7bc05a00751f7bf2fe5
MIT
2019-05-09T17:40:20.000Z
2021-12-15T12:23:17.000Z
01-gate-model-theory/notebooks/Making-Entangled-States.ipynb
a-capra/Intro-QC-TRIUMF
9738e6a49f226367247cf7bc05a00751f7bf2fe5
MIT
2021-09-29T07:34:09.000Z
2021-09-29T21:01:29.000Z
01-gate-model-theory/notebooks/Making-Entangled-States.ipynb
a-capra/Intro-QC-TRIUMF
9738e6a49f226367247cf7bc05a00751f7bf2fe5
MIT
2019-05-09T18:45:49.000Z
2021-12-15T12:23:21.000Z
Qwen/Qwen-72B
1. YES
2. YES

