Site Tools


qiskit-qubits

Qubits and Quantum States

Qubits (quantum bits) are the quantum analog of classical bits: the basic unit of quantum information. Unlike classical bits (0 or 1), a qubit exists in superposition—a linear combination of $\lvert 0 \rangle$ and $\lvert 1 \rangle$ states. A single qubit's state is written as $\lvert \psi \rangle = \alpha \lvert 0 \rangle + \beta \lvert 1 \rangle$, where $\alpha$ and $\beta$ are complex amplitudes with $|\alpha|^2 + |\beta|^2 = 1$.

Measurement collapses the qubit: you get 0 with probability $|\alpha|^2$ or 1 with probability $|\beta|^2$. Before measurement, the qubit is in a definite superposition; after, it's in a definite classical state.

Multiple qubits form a quantum register. An $n$-qubit system's state vector lives in a $2^n$-dimensional Hilbert space. Two qubits can be in a product state (independent) or entangled (correlated in a way that has no classical analog). The Bell states are maximally entangled two-qubit states.

from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector
 
# Create a Bell state: (|00⟩ + |11⟩) / √2
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
 
# Get the statevector
sv = Statevector.from_instruction(qc)
print(sv)  # [0.707... 0 0 0.707...]

In Qiskit, qubits are labeled 0, 1, 2, … and you build circuits by specifying which qubit each gate acts on. The simulator tracks the full statevector (classical simulation scales as $2^n$ memory, limiting practical simulation to ~20 qubits).

Initialization and Preparation

By default, qubits start in the $\lvert 0 \rangle$ state. You can initialize a circuit to an arbitrary state using initialize() or build it up with gates. Practical circuits use gates to prepare desired states; arbitrary state preparation usually requires unitary decomposition (expensive in gate count).

qiskit-qubits.md · Last modified: by 127.0.0.1