Create your own
Lesson illustration

Normalizing a Two-Component Complex Vector for a Single-Qubit State

Welcome to the course. We will build from the linear-algebra and quantum-mechanics essentials into executable circuits, noisy hardware models, optimization workflows, molecular and materials simulation, and mission-planning prototypes. The first module establishes the state-vector vocabulary needed for all of that work.

This lesson begins with the basic validity condition for a qubit: a two-component complex vector must have unit length. By the end, you should be able to take any nonzero candidate vector such as , compute its complex norm correctly, and turn it into a valid single-qubit state.


A qubit is a complex unit vector

A classical bit has one definite value, or . A qubit is described relative to two computational-basis vectors:

A general single-qubit state is a complex linear combination of them:

where and may be complex numbers. They are called probability amplitudes, not probabilities themselves.

The physical requirement is

Equivalently, the vector must have Euclidean or 2-norm equal to one:

This is not a numerical-preprocessing convention, such as feature scaling before training a machine-learning model. It follows from the fact that the possible measurement outcomes must account for total probability one. In the next lesson, you will use the Born rule to calculate those probabilities explicitly.

Bits, gates, and circuits | IBM Quantum Learning

Read IBM Quantum Learning's introduction to the single-qubit state. It establishes the computational basis, the statevector representation, and the unit-length requirement that this module will use throughout.

In Section 3.1, “Quantum state and Bloch sphere,” read from the opening sentence beginning the qubit-state setup. Stop before the alternative angular representation and Bloch-sphere discussion; that geometric representation is the focus of a later lesson. Concentrate on the equivalence between the ket expression, the two-component column vector, and the condition that the squared magnitudes sum to one.


Complex length: why conjugation matters

For real-valued vectors, one may be used to computing a squared length by summing ordinary squares. Complex amplitudes require a small but essential refinement: use the complex conjugate.

If

then its complex conjugate is

The squared magnitude of is

This is always a nonnegative real number. For example,

not . The latter is what you would get from incorrectly computing instead of multiplying by the conjugate.

In bra-ket notation, the bra corresponding to the ket

is its conjugate transpose:

The squared norm is therefore the inner product of the state with itself:

The normalization requirement can be written compactly as

This conjugate-transpose operation will recur constantly: when checking state validity, computing expectation values of observables, and implementing state-vector simulations.

How to Normalize a Wave Function (+3 Examples) | Quantum Mechanics

Watch “How to Normalize a Wave Function (+3 Examples)” from Pretty Much Physics for a worked normalization in bra-ket notation. Although the example uses spin-up and spin-down labels, the calculation is exactly the same for the qubit basis states \lvert 0\rangle and \lvert 1\rangle.

Watch the discrete example, where the complex coefficient is conjugated and the normalization factor is derived. Then skip ahead and watch the general recipe. Pay particular attention to why the scaling factor is the square root of the inner product, rather than the inner product itself.


The normalization procedure

Suppose you are given a nonzero candidate vector

It is a valid qubit state only if its norm is already one. Otherwise, calculate its norm and divide every component by that same number:

A reliable hand-calculation workflow is:

  1. Compute the squared magnitude of each amplitude.
  2. Add those values to obtain the squared norm.
  3. Take the square root to obtain the norm.
  4. Divide both amplitudes by the norm.
  5. Verify that the new squared magnitudes sum to one.

Worked example

Consider the candidate state

Its squared norm is

So its norm is

The normalized qubit state is

Check it:

The important invariant is the relative weighting and phase structure between the components. Normalization removes only the arbitrary overall scale of the original vector. The fact that the second component has a factor of does not alter its magnitude, but it does carry phase information; the physical distinction between global and relative phase is the next topic.

Two edge cases are worth retaining:

  • The zero vector cannot be normalized, because its norm is zero and division is undefined. It cannot represent a quantum state.
  • A vector that is already normalized should not be changed. For example,

already has squared norm one.


Implementing the calculation with NumPy

For the later circuit-simulation lessons, it is useful to make the mathematical operations explicit in code. NumPy stores complex arrays naturally, but use np.vdot when checking an inner product: it conjugates the first argument, matching .

import numpy as np

def normalize_qubit(alpha, beta):
    """Return the normalized statevector [alpha, beta]."""
    state = np.array([alpha, beta], dtype=np.complex128)

    norm = np.linalg.norm(state)
    if np.isclose(norm, 0.0):
        raise ValueError("The zero vector cannot represent a qubit state.")

    normalized_state = state / norm

    # Numerical verification of <psi|psi> = 1
    squared_norm = np.vdot(normalized_state, normalized_state)
    assert np.isclose(squared_norm, 1.0)

    return normalized_state


psi = normalize_qubit(3, 2j)

print("Normalized state:", psi)
print("Squared norm:", np.vdot(psi, psi))

The state printed will be numerically close to

and its squared norm should print as a value close to . Floating-point calculations may display very small numerical residuals, such as an imaginary part near zero. This is why np.isclose is preferable to an exact equality test.

For a more general complex input, the same function needs no modification:

candidate = np.array([1 + 1j, -2j], dtype=np.complex128)

psi = candidate / np.linalg.norm(candidate)

print("State:", psi)
print("Check:", np.vdot(psi, psi))

Here,

so the squared norm is , and the normalization factor is .

A useful engineering habit is to keep a normalization assertion close to any code that creates a custom statevector. It catches swapped coefficients, accidental real-valued array casting, and incorrect treatment of complex amplitudes before those errors propagate into a circuit model.


Why this small operation matters later

Normalization is the contract that makes the state-vector model internally consistent. Once states are normalized:

  • the squared magnitudes can be interpreted as measurement probabilities;
  • quantum gates can preserve the total probability through unitary evolution;
  • sampled measurements can be compared meaningfully with state-vector predictions;
  • amplitude-based encodings and variational quantum states can be checked systematically.

For example, materials simulations ultimately approximate normalized ground states of Hamiltonians, while QAOA constructs normalized states whose measured bitstrings are decoded as optimization candidates. Those applications use many qubits and more sophisticated circuits, but they rely on exactly the same inner-product rule introduced here.


Key takeaways

A single-qubit state is a two-component complex column vector,

that satisfies

For any nonzero candidate vector, compute the 2-norm using complex conjugation and divide every component by that norm. In code, np.linalg.norm performs the scaling and np.vdot(psi, psi) verifies the quantum inner product.

Next, you will examine phase: why multiplying an entire state by one common complex phase changes no measurement predictions, while changing the phase between its components can change the behavior of a quantum circuit.

Can't find a good explanation? Sign up and we'll make it for you

Sign up