Sitemap
2 min readOct 25, 2023

--

Hadamard Gate

#quantum30

#day-25

The Hadamard gate (H) is a fundamental quantum gate used in quantum computing to create superposition states. Let's break down the Hadamard gate step by step:

1. **Initialize the Quantum State**:
- At the beginning of the operation, the qubit is typically in one of the basis states, either |0⟩ (ground state) or |1⟩ (excited state).

2. **Apply the Hadamard Gate**:
- The Hadamard gate (H) is applied to the qubit. Mathematically, it is represented as follows:
H = 1/√2 * |0⟩⟨0| + 1/√2 * |0⟩⟨1| + 1/√2 * |1⟩⟨0| - 1/√2 * |1⟩⟨1|
- Applying the Hadamard gate transforms the qubit's state as follows:
H|0⟩ = 1/√2 * |0⟩ + 1/√2 * |1⟩
H|1⟩ = 1/√2 * |0⟩ - 1/√2 * |1⟩

3. **Resulting Superposition State**:
- After the Hadamard gate is applied, the qubit is in a superposition state. It's no longer in a definite |0⟩ or |1⟩ state, but rather in a probabilistic combination of both.

Get Inderpal Suthar’s stories in your inbox

Join Medium for free to get updates from this writer.

4. **Measurement**:
- When you measure the qubit in this superposition state, there's a 50% chance of obtaining |0⟩ and a 50% chance of obtaining |1⟩. The probabilities are |α|^2 = (1/√2)^2 = 1/2 for |0⟩ and |β|^2 = (1/√2)^2 = 1/2 for |1⟩.

In essence, the Hadamard gate creates a balanced superposition of the basis states |0⟩ and |1⟩. It's a crucial operation in quantum algorithms, as it allows quantum computers to explore multiple possibilities in parallel, which can lead to speedups in certain computational tasks.

Certainly! Here's a Python code example that demonstrates the application of the Hadamard gate using Qiskit:


from qiskit import QuantumCircuit, Aer, transpile
from qiskit.visualization import plot_bloch_multivector, plot_histogram

# Create a quantum circuit with one qubit
circuit = QuantumCircuit(1)

# Apply the Hadamard gate to the qubit
circuit.h(0)

# Visualize the circuit
print(circuit)

# Simulate the circuit
simulator = Aer.get_backend('statevector_simulator')
compiled_circuit = transpile(circuit, simulator)
result = simulator.run(compiled_circuit).result()

# Get the statevector
statevector = result.get_statevector()
print("Statevector: ", statevector)

# Plot the Bloch vector of the qubit
plot_bloch_multivector(statevector)

Thanks for reading my article.

QuantumComputingIndia

#quantum30

#day-25

--

--

Inderpal Suthar
Inderpal Suthar

Written by Inderpal Suthar

Student at IIT-D , Edward Witten is ♥️