This guide provides key concepts, equations, and mnemonics to help me grasp ( err try. shit’s hard) quantum computing fundamentals. It includes handy references, shortcuts, and visualization techniques to make complex topics more intuitive.
“Row times Column gives the Sum.”
A qubit is a 2D vector in a complex Hilbert
space:
\[
|\psi\rangle = \alpha|0\rangle + \beta|1\rangle, \quad \text{where }
|\alpha|^2 + |\beta|^2 = 1.
\] - Computational Basis: \(|0\rangle = \begin{bmatrix} 1 \\ 0 \end{bmatrix},
|1\rangle = \begin{bmatrix} 0 \\ 1 \end{bmatrix}\).
\[
|\psi\rangle = \cos{\frac{\theta}{2}} |0\rangle + e^{i\phi}
\sin{\frac{\theta}{2}} |1\rangle
\] Mnemonic:
- Latitude (θ) controls probability distribution.
- Longitude (φ) controls phase difference.
- “Theta tilts, Phi spins.”
Gate | Matrix Representation | Effect |
---|---|---|
Pauli-X (NOT) | \(X = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}\) | Flips \(|0\rangle \leftrightarrow |1\rangle\) |
Pauli-Y | \(Y = \begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix}\) | Phase + Flip |
Pauli-Z | \(Z = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}\) | Phase shift |
Hadamard (H) | \(H = \frac{1}{\sqrt{2}} \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}\) | Superposition |
Phase Gate (S, T) | \(S = \begin{bmatrix} 1 & 0 \\ 0 & i \end{bmatrix}\), \(T = \begin{bmatrix} 1 & 0 \\ 0 & e^{i\pi/4} \end{bmatrix}\) | Phase shifts |
“Halfway between 0 and 1.” (Splits \(|0\rangle\) and \(|1\rangle\) into an equal mix.)
\[ H |0\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) \]
\[ |\Phi^+\rangle = \frac{1}{\sqrt{2}} (|00\rangle + |11\rangle) \]
Mnemonic for Bell States:
- “Entangled twins” (They behave as a single unit.)
from qiskit import QuantumCircuit, Aer, execute
qc = QuantumCircuit(2, 1)
qc.h([0,1]) # Create superposition
qc.cx(0,1) # Apply function
qc.h(0) # Interference step
qc.measure(0,0)
sim = Aer.get_backend('qasm_simulator')
result = execute(qc, sim, shots=1000).result()
print(result.get_counts())
import numpy as np
from qiskit import QuantumCircuit
def qft(n):
qc = QuantumCircuit(n)
for i in range(n):
for j in range(i):
qc.cp(np.pi / 2**(i-j), j, i) # Controlled phase gates
qc.h(i)
return qc
qc = qft(3)
qc.draw('mpl') # Visualize QFT circuit
“Interference creates frequency magic.”
Concept | Formula / Mnemonic |
---|---|
Qubit State | \(|\psi\rangle = \alpha|0\rangle + \beta|1\rangle\) |
Hadamard Gate | \(H = \frac{1}{\sqrt{2}} (|0\rangle + |1\rangle)\) |
Entanglement | \(|\Phi^+\rangle = \frac{1}{\sqrt{2}} (|00\rangle + |11\rangle)\) |
Measurement Probability | \(P(0) = |\alpha|^2, P(1) = |\beta|^2\) |
Deutsch’s Algorithm | Uses Hadamard, CNOT, Hadamard |
QFT | Phase shift + Hadamard |