Quantum Computing Basics
Qubit
Superposition of $|0\rangle$ and $|1\rangle$:
$$ |\psi\rangle = \alpha|0\rangle + \beta|1\rangle $$
Where $|\alpha|^2 + |\beta|^2 = 1$
Quantum Gates
Pauli-X (NOT)
$$ X = \begin{pmatrix} 0 & 1 \ 1 & 0 \end{pmatrix} $$
Hadamard
$$ H = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \ 1 & -1 \end{pmatrix} $$
Creates superposition: $H|0\rangle = \frac{|0\rangle + |1\rangle}{\sqrt{2}}$
CNOT (Controlled-NOT)
$$ CNOT = \begin{pmatrix} 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & 0 & 1 \ 0 & 0 & 1 & 0 \end{pmatrix} $$
Python (Qiskit)
1from qiskit import QuantumCircuit, execute, Aer
2
3# Create circuit
4qc = QuantumCircuit(2, 2)
5
6# Apply gates
7qc.h(0) # Hadamard on qubit 0
8qc.cx(0, 1) # CNOT: control=0, target=1
9
10# Measure
11qc.measure([0, 1], [0, 1])
12
13# Simulate
14backend = Aer.get_backend('qasm_simulator')
15job = execute(qc, backend, shots=1000)
16result = job.result()
17counts = result.get_counts()
18print(counts)
Further Reading
Related Snippets
- Path Integral Formulation
Feynman's path integral approach to quantum mechanics - Quantum Mechanics Basics
Wave functions, operators, and measurements - Quantum Operators
Position, momentum, and Hamiltonian operators - Schrödinger Equation
Time-dependent and time-independent formulations