0% found this document useful (0 votes)
4 views3 pages

QCEXP@4

The document outlines an experiment aimed at understanding single qubit quantum gates using Qiskit. It includes a theoretical overview of quantum gates, a code implementation for various single-qubit gates, and concludes with the significance of these gates in quantum computing. The experiment demonstrates the transformation of qubit states and emphasizes the utility of Qiskit for visualizing quantum gate behavior.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

QCEXP@4

The document outlines an experiment aimed at understanding single qubit quantum gates using Qiskit. It includes a theoretical overview of quantum gates, a code implementation for various single-qubit gates, and concludes with the significance of these gates in quantum computing. The experiment demonstrates the transformation of qubit states and emphasizes the utility of Qiskit for visualizing quantum gate behavior.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Mitesh Singh B22-111

EXPERIMENT 4
LO 2:Understand quantum logic gates using open-source simulation tools.

AIM: Write a program to implement the single qubit quantum gates in Qiskit / Cirq.

THEORY:
Quantum gates are fundamental building blocks of quantum circuits, just as classical logic
gates are for classical circuits. They manipulate qubits to perform computations in quantum
computing. Unlike classical gates, quantum gates are reversible and are represented as
unitary matrices. Single-qubit quantum gates operate on a single qubit and perform
transformations on its quantum state.

Common Single-Qubit Gates

1. Hadamard Gate (H):

2. Pauli Gates:

3. Phase Gate (S and T):


o S Gate adds a phase of π/2\pi/2π/2.
o T Gate adds a phase of π/4\pi/4π/4.
4. Identity Gate (I): Leaves the qubit unchanged.
Mitesh Singh B22-111

CODE:

# Importing required libraries


from qiskit import QuantumCircuit, transpile
from qiskit.visualization import plot_bloch_multivector
from qiskit.quantum_info import Statevector
from qiskit_aer import Aer # Import Aer from qiskit_aer

# Initialize a quantum circuit with 1 qubit


qc = QuantumCircuit(1)

# Applying different single-qubit gates


qc.h(0) # Hadamard Gate
qc.x(0) # Pauli-X Gate
qc.y(0) # Pauli-Y Gate
qc.z(0) # Pauli-Z Gate
qc.s(0) # Phase Gate (S)
qc.t(0) # Phase Gate (T)
qc.id(0) # Identity Gate

# Print the quantum circuit


print("Quantum Circuit:")
print(qc.draw())

# Transpile the circuit for the simulator


simulator = Aer.get_backend('statevector_simulator')
transpiled_circuit = transpile(qc, simulator)

# Run the circuit on the statevector simulator


result = simulator.run(transpiled_circuit).result()
statevector = result.get_statevector()

# Visualize the Bloch sphere representation of the final quantum state


print("\nFinal Quantum State:")
plot_bloch_multivector(statevector)
Mitesh Singh B22-111

CONCLUSION:
In this experiment, we implemented and simulated various single-qubit quantum gates using
Qiskit. The program demonstrated how these gates transform the state of a qubit, laying the
foundation for building more complex quantum circuits. Tools like Qiskit make it intuitive to
visualize and understand the behavior of quantum gates, which are crucial for quantum
computations.

You might also like