Calculating the Transformation Matrix
Explore how to compute transformation matrices for two-qubit quantum circuits, including the application of quantum gates like H and X, and understand how tensor products represent combined qubit operations. Learn to use Qiskit's UnitarySimulator to obtain final circuit matrices without measurements, enhancing your grasp of multi-qubit quantum transformations.
We'll cover the following...
Calculate the transformation matrix
In line 4, we create the QuantumCircuit with two qubits. Then, in lines 7 and 8, we apply the -gate to the one qubit and the -gate to the other.
Note: Qiskit orders the qubits from back to front about the matrix calculation, so we need to switch the positions.
This time, in line 10, we use a different Qiskit simulator as the backend, the UnitarySimulator. This simulator executes the circuit once and returns the final transformation matrix of the circuit itself. Note that this simulator does not contain any measurements.
The result is the matrix our circuit represents.
What if we only wanted to apply the -gate to one of the qubits and leave the other unchanged? How would we calculate such a two-qubit transformation matrix?
We can use the -gate as a placeholder when we calculate the tensor product. If we want to apply the -gate to the first qubit and leave the second qubit unchanged, we calculate the transformation matrix as follows:
...