Representing a qubit state as a column vector in a two-dimensional complex space turns every measurement into a straightforward inner-product calculation. You pick a basis vector for the outcome you care about, multiply, take the modulus squared, and the result is the probability.
State vectors in practice
A single qubit lives in C². Write it as α|0⟩ + β|1⟩ where α and β are complex numbers whose squared lengths sum to one. To obtain the chance of reading 0, form the inner product with |0⟩ and square its magnitude. The same step works for any other basis state or for any observable once you have its eigenvectors.
Complex numbers matter because phases produce interference. Drop the imaginary parts and the model loses the ability to cancel amplitudes, which is exactly what produces the speed-up in algorithms such as Grover search.
Gates become matrix multiplication
Each gate is a unitary matrix. Applying the gate is ordinary matrix-vector multiplication. The Hadamard gate, for instance, maps |0⟩ to an equal superposition; the arithmetic is two additions and a scaling by 1/√2. Because the matrix is unitary, the norm of the state vector stays exactly one after every step.
When you chain gates you multiply the matrices in reverse order of application. For circuits of a few dozen gates on a handful of qubits this calculation fits in any linear-algebra library. Beyond roughly 30 qubits the 2ⁿ storage requirement forces you onto a quantum processor or an approximation method.
Tensor products for multiple qubits
Two qubits occupy the tensor product space C² ⊗ C². The joint state is a four-component vector formed by the Kronecker product of the individual vectors. Entanglement appears when the resulting vector cannot be factored back into two separate vectors. Checking factorability is a rank test on the reshaped matrix; if rank exceeds one, the qubits are entangled.
To add a third qubit you take another Kronecker product. Each added qubit doubles the dimension, so the concrete limit on classical simulation is memory, not arithmetic speed. If your problem fits inside 20-25 qubits you can still run exact linear-algebra code on a laptop; past that point you must decide whether to truncate the state, use tensor-network methods, or move to hardware.
What to compute next
Build the full state vector once, then extract any marginal probability by summing the squared amplitudes over the qubits you do not measure. For expectation values of Pauli operators, apply the corresponding matrix and take the real part of the inner product with the original state. These three operations-state preparation, matrix application, and inner-product readout-cover the linear-algebra core of every textbook algorithm.
When the circuit grows, replace dense matrices with sparse or structured representations such as Pauli strings. The trade-off is that you lose the ability to inspect the full vector; you gain the ability to handle hundreds of qubits on classical hardware provided the circuit has low entanglement.
Start with any linear-algebra package that supports complex numbers. Encode your initial state, multiply by each gate matrix in sequence, and read probabilities from the final vector. That workflow already lets you verify small circuits and decide whether a given algorithm stays inside classical reach.