Skip to content
Tutorials Center
My learning

Topics

Lesson 3 of 38 · Getting Started

Complex Numbers and the Math Toolkit

Review the math you need for quantum mechanics: complex numbers, Euler's formula, the complex exponential, integrals and Gaussians, with runnable checks.

Quantum wavefunctions are complex-valued, and almost every calculation uses complex exponentials. This lesson is a compact review of exactly the mathematics you will use in the next chapters: complex numbers, Euler's formula, derivatives of exponentials and Gaussian integrals. If you are comfortable with these, skim the code and move on.

Complex numbers

A complex number is z = a + b i, where a and b are real and i² = -1. We call a the real part and b the imaginary part. The complex conjugate is z* = a - b i. The modulus (absolute value) is

|z| = √(a² + b²), and z z* = |z|², which is always real and non-negative.

The last fact is why quantum mechanics works: |ψ|² is a real probability density even though ψ is complex.

Euler's formula and polar form

e^{iθ} = cos θ + i sin θ

A complex number can be written in polar form z = r e^{iθ} with r = |z| and θ the phase (argument). Multiplying complex numbers multiplies the moduli and adds the phases. In particular |e^{iθ}| = 1 for real θ: a pure phase does not change probability by itself.

The plane wave e^{i(kx - ωt)} is a complex exponential whose phase rotates in space and time. It will appear constantly.

Python Complex arithmetic and Euler's formula

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The last line prints a number that is zero up to about 1e-16 rounding error: e^{iπ} + 1 = 0.

Calculus with exponentials

For a constant k, d/dx e^{ikx} = i k e^{ikx}. Taking the derivative twice gives -k² e^{ikx}. Differentiating a plane wave therefore multiplies it by a number. This is the secret behind momentum operators and the free Schrödinger equation.

For time, d/dt e^{-iωt} = -iω e^{-iωt}.

Integrals you will use

The Gaussian integral is

∫_{-∞}^{∞} e^{-a x²} dx = √(π/a) for a > 0.

Two consequences:

  • ∫ x² e^{-a x²} dx = √π / (2 a^{3/2})
  • Odd integrands, such as x e^{-a x²}, integrate to zero over a symmetric range.

Another essential fact is that integrals over a whole line of sin and cos products vanish unless frequencies match (orthogonality), which you will see in the particle-in-a-box lesson.

Python Check the Gaussian integrals numerically

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Vectors, inner products and matrices

Later, quantum states will be vectors in a complex vector space. For two complex vectors u and v, the inner product is ⟨u|v⟩ = Σ uₖ* vₖ, with conjugation on the first one. Matrices act on vectors; a matrix A with A† = A (conjugate transpose equals itself) is called Hermitian, and has real eigenvalues. Numerical solvers for quantum mechanics rely on this fact, and numpy.linalg.eigh is built for such matrices.

Python A Hermitian matrix has real eigenvalues

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

np.vdot(a, b) conjugates its first argument, matching the physics inner product.

Python writes the imaginary unit as 1j, not i. Also remember that ** is power and ^ is bitwise XOR in Python.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. What is |3 + 4i|?

    √(3² + 4²) = √25 = 5.
  2. 2. What is d/dx of e^{ikx}?

    The chain rule gives a factor ik.
  3. 3. Why is |ψ|² a legitimate probability density even if ψ is complex?

    ψ*ψ = |ψ|² ≥ 0 for any complex ψ.
  4. 4. Hermitian matrices have eigenvalues that are

    Real eigenvalues are a defining property of Hermitian matrices, which is why they represent measurable quantities.

Summary

  • z z* = |z|², and e^{iθ} = cos θ + i sin θ has modulus 1.
  • Derivatives of plane waves multiply by ik.
  • Gaussian: ∫ e^{-a x²} dx = √(π/a).
  • Hermitian matrices have real eigenvalues and orthogonal eigenvectors; use eigh.

Next: A Python Toolkit for Quantum Mechanics