Engineering/Mathematics/Preliminaries
Complex Number Arithmetic
A complex number is a pair of real numbers carried in the combination , where satisfies . Everything in linear algebra that requires a scalar — a matrix entry, a coefficient in a linear combination, an eigenvalue — is drawn from this system rather than from the reals, and the reason is that only here is every polynomial guaranteed a root.
- Foundation level
- Stream: complex
- Reading time 12 min
- Ref KVS-ENG-MATH-0117
- Taxonomy
- Engineering / Mathematics
- Prerequisite
- Real arithmetic; no linear algebra required
- Defining relation
- Structure
- A field: every non-zero element has an inverse
- Key property
- Algebraically closed — every non-constant polynomial has a root
- Used for
- Matrix entries, eigenvalues, inner products, transfer functions
Overview
Complex numbers extend the real numbers by adjoining a single new element subject to one rule, , and then insisting that the usual laws of algebra continue to hold. Everything else follows mechanically. A general element is a linear combination of the two symbols and with real coefficients, the real number is its real part, the real number its imaginary part, and two such expressions are equal exactly when both parts agree.
Addition and subtraction act componentwise, so in that respect behaves like the plane . Multiplication is where the structure appears: expanding the product and substituting mixes the parts, producing . Division requires one extra device — multiplying numerator and denominator by the conjugate of the denominator, which converts the denominator into a real number and leaves a quotient in standard form.
The pay-off is that is a field: addition and multiplication are commutative and associative, multiplication distributes over addition, and every element other than zero has a multiplicative inverse. Those are precisely the properties invoked, silently and constantly, in every proof about vector spaces, matrix algebra and linear systems. Choosing rather than costs nothing in that respect, because the reals sit inside the complex numbers as the elements with zero imaginary part.
It buys a great deal. Over the polynomial has no root, so a perfectly innocuous matrix can have no eigenvalues at all and the theory develops a permanent hole. Over every non-constant polynomial factors completely into linear factors, so a characteristic polynomial of degree always supplies roots counted with multiplicity, and every square matrix always has an eigenvalue. Almost every existence theorem in the second half of linear algebra depends on that guarantee.
Definition
Complex Number
CNA complex number is an expression where and are real numbers and is a symbol satisfying . The real number is the real part of and the real number is the imaginary part. The set of all complex numbers is written .
The imaginary part is the real number , not the quantity . Electrical engineering commonly writes in place of to avoid collision with instantaneous current; the arithmetic is identical.
Equality of Complex Numbers
CNETwo complex numbers and are equal precisely when and . A single complex equation therefore encodes two real equations, one for each part.
This is why a complex linear system in unknowns is equivalent to a real system in unknowns, and why complex equations can be split into real and imaginary components when a real formulation is required.
Arithmetic Operations on
CNAFor and the four operations are defined by treating and as ordinary algebraic expressions and reducing every occurrence of to .
- Sum:
- Difference:
- Product:
- Quotient: for , obtained by multiplying numerator and denominator by
Division by the complex number zero, , is undefined, exactly as division by the real zero is.
Concepts
Multiplication is not componentwise
Addition treats the two parts independently, which tempts the assumption that multiplication does too. It does not. Expanding gives four terms, and the term collapses to , so the real part of the product depends on both imaginary parts and the imaginary part depends on both real parts. This coupling is the entire content of complex multiplication and the reason complex numbers model rotation and phase, whereas a pair of independent real numbers cannot.
Division by rationalising the denominator
There is no direct formula for a quotient in standard form, so division is performed in two moves. Multiply numerator and denominator by , the conjugate of the denominator. The denominator becomes , a non-negative real number that is zero only when the denominator was zero. The numerator is an ordinary complex product. Dividing each part of that product by the real denominator returns the quotient as . The same manoeuvre, applied to , produces the multiplicative inverse and proves that is a field.
Why linear algebra takes scalars from
Fields are interchangeable as far as the axioms of a vector space are concerned; what distinguishes is that it is algebraically closed. Every polynomial of degree with complex coefficients has exactly complex roots counted with multiplicity. Applied to the characteristic polynomial this guarantees that every square complex matrix has at least one eigenvalue and a full complement of counted with algebraic multiplicity. Over neither statement holds, and the theory of eigenvalues, diagonalisation and spectral decomposition would be riddled with exceptions.
The reals as a subset, and what changes
Identifying the real number with the complex number embeds inside so that all four operations agree on the overlap. Nothing about real arithmetic is lost. What is lost is order: there is no way to define on that is compatible with both operations, so complex numbers cannot be sorted, no complex number is positive or negative, and inequalities can only be applied to real quantities derived from them — typically the modulus. Any algorithm relying on pivoting by magnitude must therefore compare moduli, not the numbers themselves.
Powers of the imaginary unit
The successive powers of cycle with period four: , , , , and then the pattern repeats. Any integer power reduces by taking the exponent modulo four. This four-fold periodicity is the algebraic shadow of the fact that multiplication by is a quarter-turn rotation, and it is what makes complex exponentials the natural language for oscillation, phase and sampled sinusoids.
Two real numbers, but not a two-dimensional real vector space
As an additive structure is indistinguishable from , and this is a useful implementation view: store a pair of doubles. The distinction is that carries a multiplication of numbers by numbers, closed and invertible, which does not. That extra operation is what allows a single complex scalar to encode a gain and a phase shift simultaneously, and what allows an complex matrix to describe behaviour that would need a real matrix with constrained block structure.
Procedure: reduce a complex expression to standard form
Equations
Defining relation for the imaginary unit
EQ-CNA-01One new symbol and one new rule. Every other formula on this page is a consequence of applying ordinary algebra and then reducing with this identity.
Sum and difference
EQ-CNA-02Componentwise in the real and imaginary parts, so addition alone gives no more structure than a pair of independent reals.
Product
EQ-CNA-03The mixing of parts comes entirely from the term . Four real multiplications and two real additions in the direct form.
Quotient in standard form
EQ-CNA-04Valid whenever and are not both zero. The denominator is real and strictly positive, which is what makes the final division elementary.
Multiplicative inverse
EQ-CNA-05The special case of the quotient with numerator . Its existence for every non-zero element is the final axiom needed to call a field.
Periodicity of powers of
EQ-CNA-06Reduce any integer exponent modulo four. The cycle underlies the appearance of complex numbers in every description of periodic behaviour.
Three-multiplication product
EQ-CNA-07Computing , and yields both parts of the product with three real multiplications instead of four, at the cost of two extra additions and some loss of accuracy.
Variable Definitions
| Symbol | Name | Meaning | Domain / type |
|---|---|---|---|
| Imaginary unit | The adjoined symbol with ; written in electrical engineering | element of C | |
| Complex number | A general element of | complex scalar | |
| Real part | The real coefficient of in | real number | |
| Imaginary part | The real coefficient of in | real number | |
| Complex numbers | The field of all complex numbers, the scalar system for this library | field | |
| Real numbers | The subset of with zero imaginary part | subfield of C | |
| Impedance | Complex ratio of voltage phasor to current phasor in an AC network | complex, ohms | |
| Eigenvalue | Root of a characteristic polynomial; complex in general even for a real matrix | complex scalar |
Worked Numerical Example
Problem statement
Two branches of a single-phase AC network are connected in parallel across a 220 V supply. Branch one is a resistor in series with an inductor, presenting ohms; branch two is a resistor in series with a capacitor, presenting ohms. Find the combined impedance and the supply current, using complex arithmetic throughout.
Form the product of the two impedances
Expand as an ordinary product and reduce the term. The four partial products are , , and .
Form the sum
Addition is componentwise, so the real parts and the imaginary parts are added separately. The net reactance is capacitive because the imaginary part is negative.
Divide, rationalising the denominator
The parallel combination is . Multiply numerator and denominator by , the conjugate of the denominator. The denominator becomes , a real number.
Reduce to standard form
Divide each part by the real denominator. The combined branch behaves as a resistance in series with a inductive reactance — note that the parallel combination is inductive even though one branch was capacitive.
Compute the supply current by a second division
With the supply phasor taken as the real reference volts, Ohm's law gives . Rationalise again, this time with ; the denominator becomes .
Check the result by multiplying back
Verification is a single complex product: the current times the impedance must return the supply voltage. The imaginary part cancelling exactly is a strong check on both divisions.
The parallel network presents and draws a current whose real component is and whose imaginary component is . The negative imaginary part says the current lags the voltage, consistent with the net inductive reactance. Two complex divisions replaced what would otherwise be four coupled real equations, and the closing multiplication verifies both of them at once.
Applications & Industry Use
Phasor analysis of AC networks
Representing sinusoidal voltages and currents as complex phasors converts differential relationships for inductors and capacitors into algebraic ones. Series and parallel combinations, source transformations and network reduction then become complex addition, multiplication and division, and the real and imaginary parts of the resulting power carry the physical meaning of real and reactive power.
Transfer functions evaluated on the imaginary axis
A frequency response is a transfer function evaluated at , which requires complex division of two polynomials at each frequency. The complex value obtained encodes gain and phase together, and stability assessment reduces to statements about where the complex roots of the denominator lie.
Discrete Fourier transform coefficients
Every coefficient of a discrete Fourier transform is a sum of products of samples with powers of a complex root of unity. Fast transform algorithms are organised entirely around the four-fold and higher-order periodicity of those powers, and each butterfly stage is one complex multiplication and two complex additions.
Damped modes and complex natural frequencies
A damped oscillator has a characteristic polynomial with complex conjugate roots, whose real part gives the decay rate and whose imaginary part gives the damped frequency. Working over keeps the two effects in one number and avoids case analysis on whether damping is sub-critical.
Baseband representation of modulated signals
In-phase and quadrature components are the real and imaginary parts of a single complex envelope. Mixing, filtering and channel equalisation are then complex multiplications and divisions, and hardware is designed around complex multipliers that implement exactly the product formula on this page.
Guaranteed existence of eigenvalues
Numerical eigenvalue routines return complex results even for real input matrices because the characteristic polynomial need not factor over the reals. Downstream code that assumes real eigenvalues will fail on any matrix with rotational character, so complex scalars must be carried through the interface even when the application is real.
Design Considerations
Fix the symbol for the imaginary unit and state it
Mathematics and physics write ; electrical engineering writes to keep free for instantaneous current. Mixed-discipline documents that use both, or that use as a summation index alongside as the imaginary unit, generate avoidable errors. Declare the convention once and hold to it; where an index is unavoidable, rename the index rather than the unit.
Never sort or compare complex numbers directly
There is no order on compatible with its arithmetic, so expressions such as are meaningless for a complex eigenvalue. Comparisons must be applied to a derived real quantity: the modulus for magnitude questions, the real part for stability questions. Languages that silently compare only the real part, or that raise an error, differ here, and portable code must not rely on either behaviour.
Use a numerically safe division algorithm
The textbook quotient formula computes , which overflows when the denominator is large and underflows when it is small, even though the quotient itself is perfectly representable. Production code should use a scaled variant that divides through by the larger of and first. This is the difference between a formula that is correct in exact arithmetic and one that is correct in floating point.
Decide whether to carry complex scalars or split into real parts
An complex system can be rewritten as a real system with a two-by-two block structure. The complex form is more compact, halves the index bookkeeping and preserves structure such as Hermitian symmetry; the real form is required when a solver, an FPGA target or a legacy interface accepts only real data. Choose once, at the interface boundary, and convert explicitly.
Test whether the model genuinely needs complex scalars
Geometry, statics and most optimisation work entirely within the reals, and introducing there doubles storage for no benefit. Complex scalars earn their place where oscillation, phase or general eigenvalues appear. The decisive question is whether a characteristic polynomial with no real roots is a possibility for the problem class.
Watch for exact cancellation as a verification opportunity
Many correct complex computations end with an imaginary part that must vanish identically — the modulus squared of any complex number, the determinant of a Hermitian matrix, the total power in a balanced network. A residual imaginary part in such a place is a precise error signal, and it is worth asserting rather than discarding.
Standards & Codes
Notation, interchange and numerical standards that govern how this material is written down, stored and computed in production systems.
| Reference | Title | Relevance to this topic |
|---|---|---|
ISO 80000-2 | Quantities and units — Part 2: Mathematics | Standardises the imaginary unit, the notation and for the real and imaginary parts, and the upright setting of the unit symbol to distinguish it from an italic variable. |
IEC 60027-1 | Letter symbols to be used in electrical technology | Establishes as the imaginary unit in electrical engineering, so that remains available for instantaneous current, and fixes the phasor conventions used in the worked example. |
IEEE 754-2019 | IEEE Standard for Floating-Point Arithmetic | Defines the binary floating-point format used for each of the two real components, and the overflow, underflow and NaN behaviour that makes naive complex division unsafe near the limits of the exponent range. |
ISO/IEC 9899 (C) | Programming languages — C, Annex G | Specifies the _Complex types and the recommended practice for complex multiplication and division, including the handling of infinities and NaNs that a straightforward implementation of the quotient formula gets wrong. |
ISO/IEC 14882 (C++) | Programming languages — C++, <code><complex></code> | Defines std::complex for the standard floating-point types along with its arithmetic operators, and is the reference behaviour that numerical libraries such as Eigen and Armadillo build on. |
Material Selection
For a mathematical topic, "material" is the numeric representation: the scalar field, storage format and precision the computation is built from.
| Representation | Select when | Trade-off |
|---|---|---|
| Gaussian rationals (exact with rational parts) | Symbolic work where the answer must be certified, such as verifying that an eigenvalue is exactly . | Exact and closed under all four operations, but numerator and denominator growth is unbounded and there is no representation for irrational parts. |
| IEEE 754 binary64 pair (complex double) | The default for engineering computation: eigenvalue solvers, transfer functions, network analysis. | About sixteen significant digits per component and universal library support, at sixteen bytes per number and roughly four times the cost of a real multiply. |
| IEEE 754 binary32 pair (complex float) | Large transforms, GPU kernels and streaming signal processing where memory bandwidth dominates. | Halves storage and traffic, but around seven significant digits, which is marginal once several thousand accumulation steps have occurred. |
| Fixed-point complex pairs | Embedded DSP and FPGA targets without floating-point hardware, where the signal range is known in advance. | Deterministic timing and minimal gate count, but the product formula can overflow on any of its four partial products, so explicit scaling and saturation policy are mandatory. |
| Real arithmetic with two-by-two blocks | The toolchain, solver or hardware accepts only real data. | Avoids complex support entirely by mapping to a real rotation-scaling block, but doubles the dimension and hides structure such as Hermitian symmetry from the solver. |
| Arbitrary-precision complex (software floating point) | Ill-conditioned root finding, or investigating whether a numerically close cluster of eigenvalues is genuinely a repeated root. | Precision limited only by memory, at one to two orders of magnitude slowdown; usually worth deploying only on the specific sub-problem in doubt. |
Manufacturing Notes
Implementation notes — how the result is actually produced by hand, by algorithm and by library, including cost and numerical behaviour.
Operation counts for the four operations
Addition and subtraction cost two real operations each. The direct product costs four real multiplications and two real additions. Division costs, in the naive form, six multiplications, three additions and two divisions. On hardware where multiplication is materially more expensive than addition, the product can be reduced to three multiplications and five additions using the identity in the equation table, a trade routinely made in FPGA multipliers and occasionally in software transforms.
Robust complex division in floating point
Smith's algorithm avoids computing directly. When , set and ; the quotient parts are and . Otherwise interchange the roles of and . This keeps every intermediate within a factor of two of the operands and extends the range of denominators that can be handled by roughly a square root of the exponent range. Standard libraries implement this or a further refinement of it.
Doing the arithmetic by hand
For products, expand in full and collect only at the end; attempting to apply the memorised formula directly is where sign errors on the term appear. For quotients, always write the conjugate multiplication as an explicit fraction before simplifying, and confirm the denominator has become real before proceeding. A final check by multiplying the quotient back by the divisor costs one product and catches essentially every arithmetic slip.
Library behaviour and interface hazards
NumPy exposes complex128 and complex64 and propagates complex results automatically, so numpy.linalg.eig on a real matrix may return a complex array without warning. MATLAB uses the same convention. C99 provides _Complex with complex.h, and C++ provides std::complex; the two are layout-compatible in practice but not guaranteed to be by either standard. Any interface that assumes real output from an eigenvalue or root-finding routine is a defect waiting for the right input.
Storage layout: interleaved versus split
Interleaved layout stores real and imaginary parts adjacently and matches the C and C++ array-of-complex convention. Split layout stores all real parts followed by all imaginary parts and vectorises better on wide SIMD units, which is why several fast transform libraries offer it. Mixing the two conventions across a library boundary silently produces a result that is neither the transform nor its conjugate, so the layout must be stated in every interface contract.
Failure Modes & Common Mistakes
| Failure mode / mistake | Impact | Root cause | Prevention & detection |
|---|---|---|---|
| Multiplying componentwise | high | Assuming that because addition acts on parts independently, multiplication does too, giving . | Expand the product in full every time and reduce to . The cross terms and are the whole point of the operation. |
| Losing the sign on | high | Treating as , or dropping the minus sign when collecting the real part of a product. | Write the substitution as a separate step rather than performing it mentally, and sanity-check with before collecting terms. |
| Leaving a complex number in the denominator | medium | Reporting a result as a fraction with a complex divisor rather than reducing it to form. | Always rationalise with the conjugate of the denominator. Two results in unreduced form cannot be compared for equality by inspection. |
| Overflow or underflow in naive division | high | Computing directly when or is near the limits of the exponent range, yielding infinity or zero for a well-scaled quotient. | Use Smith's scaled algorithm or a library division routine, and never hand-code the textbook formula in production numerics. |
| Applying an inequality to a complex quantity | high | Writing a test such as or sorting a spectrum, forgetting that carries no compatible order. | Compare a real-valued function of the number: modulus for size, real part for growth or decay. Make the choice explicit in code rather than relying on a language default. |
| Confusing the imaginary part with | low | Reading the definition loosely, so that the imaginary part of is quoted as rather than . | The imaginary part is a real number by definition. Anything that must be added to a real quantity or compared with one is the coefficient, not the term. |
| Symbol collision between the unit and the index | medium | Using as a summation or entry index in the same expression where it denotes the imaginary unit. | Reserve for the unit in complex contexts and index with or ; in electrical work adopt for the unit as the relevant standards direct. |
| Assuming a real problem yields real answers | medium | Declaring downstream storage as real because the input matrix was real, then truncating complex eigenvalues. | Type the interface for complex output wherever a polynomial root or eigenvalue is produced, and assert that any discarded imaginary part is zero to within tolerance. |
FAQs
Why does linear algebra use complex scalars when most engineering data is real?
Because the theorems come out clean. Over every polynomial of degree has exactly roots, so every square matrix has a full set of eigenvalues and the existence results in the theory carry no exceptions. Real data is a special case in which the imaginary parts happen to be zero, and nothing about the real theory is lost by working in the larger system.
Is the square root of , or is that notation to be avoided?
The defining property is , and has two square roots, and , with no algebraic way to distinguish them. Writing is harmless shorthand but invites the false step . Stating the defining relation rather than a radical avoids the trap entirely.
How do I divide one complex number by another without a calculator?
Multiply numerator and denominator by the conjugate of the denominator. The new denominator is , a positive real number, and the new numerator is an ordinary complex product. Divide each part of that product by the real denominator. Verify by multiplying the answer back by the original divisor.
Can complex numbers be compared with less-than?
No. Any order on compatible with addition and multiplication leads to a contradiction, because would have to be both positive and negative once squared. Practical comparisons use the modulus, which is real and non-negative, and pivoting strategies in complex linear algebra compare moduli rather than the entries themselves.
Why do complex eigenvalues of a real matrix always come in pairs?
Because the characteristic polynomial has real coefficients. Conjugating the equation leaves the coefficients unchanged and replaces by its conjugate, so the conjugate is also a root. The corresponding eigenvectors are likewise conjugates of one another, and together they span a real two-dimensional invariant subspace.
Is the pair-of-doubles implementation of a complex number exactly equivalent to the mathematics?
For representation, yes; for arithmetic, not quite. Rounding in the two components is independent, so identities that hold exactly in — such as a product being exactly real — may leave a small residual imaginary part. Robust code tests such quantities against a tolerance rather than against exact zero.
Should an implementation use the three-multiplication product formula?
Only where multiplications genuinely dominate cost, such as fixed-point hardware or very large transforms. The saving is one multiplication out of four, paid for with three extra additions and a modest loss of accuracy from the intermediate sum . For general-purpose floating-point code the direct form is preferred.
References
- Beezer, R. A. A First Course in Linear Algebra, Version 0.70. University of Puget Sound, 2006. Section CNO, Subsection CNA. Licensed under the GNU Free Documentation License v1.2.
- ISO 80000-2:2019, Quantities and units — Part 2: Mathematics. International Organization for Standardization.
- IEEE 754-2019, IEEE Standard for Floating-Point Arithmetic. Institute of Electrical and Electronics Engineers.
- Smith, R. L. Algorithm 116: Complex division. Communications of the ACM, volume 5, 1962.
- Higham, N. J. Accuracy and Stability of Numerical Algorithms, 2nd edition. Society for Industrial and Applied Mathematics, 2002. Discussion of complex arithmetic and its error analysis.
- ISO/IEC 9899:2018, Information technology — Programming languages — C, Annex G: IEC 60559-compatible complex arithmetic.
AI Suggested Questions
- Derive the three-multiplication complex product and quantify the extra rounding error it introduces relative to the direct formula.
- Show me a well-scaled complex division where the textbook formula overflows in binary64 but Smith's algorithm succeeds.
- How does the two-by-two real block representation of a complex number relate to rotation and scaling in the plane?
- Work through why no order relation on the complex numbers can be compatible with both addition and multiplication.
- Give an example of a real matrix whose eigenvalues are complex, and explain the physical behaviour that the imaginary parts describe.
- Compare the cost and accuracy of solving an n-by-n complex linear system directly against solving the equivalent 2n-by-2n real system.
Related Calculators
Add, subtract, multiply and divide complex numbers with the conjugate rationalisation shown as an explicit intermediate step.
Complex Division Stability ToolCompare the naive quotient formula against Smith's scaled algorithm across the floating-point exponent range.
Phasor & Impedance CalculatorCombine series and parallel complex impedances and report the resulting current phasor in both rectangular and magnitude form.
