A quantum state is a mathematical description of a quantum system. In an n-qubit system, it can be written as |ψₙ⟩ = Σⱼ₌₀^(2ⁿ−1) aⱼ|j⟩ₙ, where each amplitude aⱼ describes a computational-basis component. The amplitudes must be normalized so that the total probability is one; state-preparation routines can also normalize supplied amplitudes. section 2.5 section 2.3
Working with quantum states requires keeping three representations aligned:
- Basis states may be written with bit strings or integer labels. The conversion depends on endian convention, so array indexes and measurement results must use the same interpretation. section 2.3
- Integer-based Dirac notation is compact for multiqubit states, but the number of qubits must remain explicit: |0⟩ may otherwise be ambiguous. section 2.5
- Measurement returns a basis state, with each outcome occurring according to the square of its amplitude; it therefore reveals limited information about the complete state. section 4.9
Preparing and inspecting a two-qubit state
Start with two qubits in |00⟩ and an amplitude array [a₀, a₁, a₂, a₃]. A preparation routine targets |ψ₂⟩ = a₀|0⟩ + a₁|1⟩ + a₂|2⟩ + a₃|3⟩, normalizing the inputs when necessary. Implement the routine in Qiskit or Q#, run it repeatedly, and compare measured frequencies with the squared amplitudes. For deeper inspection, use multiple copies for quantum state tomography; use joint measurements when the goal is information about correlations rather than individual qubits. section 2.3 section 4.9 section 1.5

