Essential mathematics — complex numbers
Two real numbers, one amplitude, and a useful way to describe phase.
- Add and multiply simple complex numbers.
- Calculate squared magnitude and distinguish it from an amplitude.
Meet the imaginary unit
Section titled “Meet the imaginary unit”The number satisfies . A complex number has a real part and an imaginary part . You can picture it as the point on a plane.
Addition works component by component:
Multiplication uses ordinary expansion and :
Squared magnitude becomes probability
Section titled “Squared magnitude becomes probability”The conjugate of is . The squared magnitude is
If an amplitude is , then . It is the squared magnitude, not the real part and not the amplitude itself, that becomes a basis-measurement probability.
Phase is direction
Section titled “Phase is direction”A unit-magnitude complex number can be written
Multiplication by this number rotates an amplitude in the complex plane. For example, multiplying by rotates by radians, or 90 degrees. Its magnitude stays one.
In a quantum state, relative phase between amplitudes affects interference. Multiplying the whole state by the same unit phase does not change physical predictions.
Work it through
Section titled “Work it through”For , the probabilities are and . They sum to one. Replacing with keeps those Z probabilities but changes the relative phase.
Try it: calculate , then divide by 5. The results are 25 and a unit-magnitude complex number, respectively.
Why complex arithmetic appears in a quantum lesson
Section titled “Why complex arithmetic appears in a quantum lesson”A real probability needs only a position on a number line between zero and one. An amplitude needs both a magnitude and a phase. The complex plane provides a compact way to carry those two pieces through additions and multiplications. When a gate combines paths, the directions of the amplitudes determine whether they reinforce or cancel. Taking magnitudes too early would erase precisely the information the calculation needs.
In the diagram, the amplitude has real and imaginary parts of one half. Its distance from the origin is the square root of one half, and its phase is 45 degrees. Its probability contribution is one half. These are three different quantities: the Cartesian components, the distance, and the squared distance. Keep their units and roles separate when checking numerical output.
Worked calculation: conjugation before squaring
Section titled “Worked calculation: conjugation before squaring”For a complex amplitude, the probability uses multiplication by the conjugate. With an amplitude of one half plus one half times i, the conjugate changes the imaginary sign. Multiplying them gives a real result because the cross terms cancel:
Squaring the amplitude itself would instead give an imaginary result. That cannot be a probability. The distinction between an ordinary square and a squared magnitude is therefore essential, even when both operations happen to agree for real positive examples. A negative real amplitude is also a useful check: its squared magnitude is positive, while its sign must still be kept during later gate operations.
Consider a complete state with first amplitude one half plus one half times i and second amplitude one over the square root of two. Their squared magnitudes sum to one, so the state is normalised. Multiplying both amplitudes by the same unit complex number rotates the entire description without changing any measurement prediction. Multiplying only the second amplitude changes its phase relative to the first and can change an interference result.
Multiplication as a rotation
Section titled “Multiplication as a rotation”Euler’s relation writes a unit complex number as a cosine plus i times a sine. Multiplying an amplitude by this number preserves its magnitude and adds to its phase. Multiplication by i is a quarter turn: a positive real amplitude becomes positive imaginary, a positive imaginary amplitude becomes negative real, and four such turns return the original value. This is the arithmetic behind the phase gate S.
To see why signs are phases, compare a positive real number with its negative. They have equal magnitudes, but their directions differ by half a turn. The minus sign in the minus state therefore carries a relative phase of pi radians. It is not a negative chance of seeing one. A phase of zero and a phase of two pi describe the same direction, which is why the explorer’s 0-degree and 360-degree settings agree.
Zero is a special case. Its magnitude is zero, so there is no direction to assign. A phase readout for a zero amplitude should say it is undefined. Small floating-point remnants near zero should not be interpreted as meaningful phase evidence. The statevector table applies a numerical tolerance so that a theoretically absent component does not acquire a misleading angle from rounding error.
Put the arithmetic into the explorer
Section titled “Put the arithmetic into the explorer”The lab opens at polar angle 90 degrees and relative phase 45 degrees. The zero amplitude is positive real, while the one amplitude has equal positive real and imaginary parts. Calculate those parts before revealing the model. Their common value is one half; each basis probability is one half. The relative phase appears in the one amplitude, even though the two probabilities are equal.
After checking the initial preparation, apply S. Predict the new real and imaginary parts of the one amplitude by multiplying by i. Then reveal and compare. The histogram should stay fixed while the amplitude moves in the complex plane. Apply S three more times to complete a full turn. The final state should return to its initial amplitudes within rounding tolerance.
Qubit explorer
Prepare a pure qubit, apply gates, then compare amplitudes, phases and Z-basis probabilities. Reset restores the initial preparation shown by the lesson’s controls.
Prepare your experiment using the controls. Record a prediction, then reveal the statevector or run the experiment.
Changing the preparation or circuit starts a new prediction.
Take it further
Prepare θ = 120°, φ = 90°. Predict both complex amplitudes. Then change φ without changing θ.
Initial setup · reference state
| Basis | Amplitude a + bi | Magnitude | Phase (rad) | Probability |
|---|---|---|---|---|
| |0⟩ | 0.707107 + 0i | 0.707107 | 0.000000 | 50.0% |
| |1⟩ | 0.5 + 0.5i | 0.707107 | 0.785398 | 50.0% |
Signs and complex phases are part of the state. Phase is undefined for a zero amplitude. A shared global phase changes no probabilities; relative phases can affect a later operation. Values are rounded to six decimal places.
Prediction to try: Predict the amplitudes and Z-basis probabilities for the preparation and gates you have chosen. If starting from |0⟩, what will H do?
Challenge: Prepare θ = 120°, φ = 90°. Predict both complex amplitudes. Then change φ without changing θ.
Open the live experiment studioPractice: cancellation needs the whole amplitude
Section titled “Practice: cancellation needs the whole amplitude”Two contributions to the same output are one half plus one half times i and one half minus one half times i. Add them first, then calculate the squared magnitude. Compare that with adding their separate squared magnitudes. Explain why those operations answer different questions.
Check your reasoning
The sum is one, whose squared magnitude is one. Each separate contribution has squared magnitude one half, so their separate probabilities also sum to one in this particular example. That numerical agreement is accidental. If the second contribution were negative one half minus one half times i, the coherent sum would be zero while the separate squared magnitudes would still sum to one. Coherent alternatives combine as amplitudes; alternatives distinguished by a classical record require the appropriate probability description.
Check your understanding
Section titled “Check your understanding”What is the squared magnitude of 0.5 + 0.5i?
Answer: 0.5. Multiply by the conjugate: 0.25 + 0.25 = 0.5. Squaring the complex number itself is a different operation.
Reference: IBM Quantum — Quantum information.
Ready for the next step?
Your progress stays in this browser.