Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

Recipe

Find the best approximation of a function using an orthogonal family

Use when: you have a target function f and a finite orthogonal family u_1,\dots,u_p, and need the closest combination of them to f

Goal: the coefficients c_i=\langle f,u_i\rangle/\langle u_i,u_i\rangle that make \sum c_iu_i the best L^2 approximation to f in that family's span

Taught in Why an orthogonal family is the right thing to expand a function in

  1. 1

    Check that \langle u_i,u_j\rangle=0 for every pair of distinct family members before using the one-inner-product-per-coefficient shortcut in the steps below.

    • the family is orthogonal — continue to Step 2 and find each coefficient separately.
    • the family is not orthogonal (e.g. \{x,x^2\} on [0,1], where \langle x,x^2\rangle=\tfrac14\ne0) — the one-line formula below doesn't apply; the coefficients are coupled and need a full system solved together instead.

    Why: the projection formula's own proof (Section 5) used orthogonality to make every cross term vanish; without it, the coefficients don't decouple.

  2. 2

    Form the inner product of the target f with each family member, one integral per coefficient.

    Example

    For f(x)=x and u_1=\sin x on [-\pi,\pi]: \langle f,u_1\rangle=\int_{-\pi}^{\pi}x\sin x\,dx=2\pi.

    Why: this is the numerator the projection formula assigns to each basis function.

  3. 3

    Divide the Step 2 result by that same basis function's own squared norm.

    Example

    \langle\sin x,\sin x\rangle=\pi, so c=\dfrac{2\pi}{\pi}=2.

    ⚡ Shortcut

    If the family is already orthonormal (\langle u_i,u_i\rangle=1 for every i), skip this division entirely; the Step 2 inner product already is the coefficient.

    Why: this rescales for a family whose members aren't already unit length; skipping it reports the wrong coefficient whenever \langle u_i,u_i\rangle\ne1.

  4. 4

    Sum \hat f=\sum c_iu_i, then confirm \|f\|_2^2=\|\hat f\|_2^2+\|f-\hat f\|_2^2 as a check that doesn't require re-integrating (f-\hat f)^2 directly.

    Example

    With \hat f=2\sin x: \|f\|_2^2=\tfrac{2\pi^3}{3}\approx20.67 and \|\hat f\|_2^2=4\pi\approx12.57, so the residual is \approx8.10 and \hat f already captures \tfrac{6}{\pi^2}\approx60.8\% of f's total energy.

    Why: the identity is guaranteed by the residual being orthogonal to the family's span, so it double-checks the coefficients without a fresh integral.

Common mistakes

  • Applying the one-inner-product-per-coefficient shortcut to a family that isn't actually orthogonal.
  • Forgetting to divide by \langle u_i,u_i\rangle when the family isn't already orthonormal.
  • Assuming adding more terms could ever increase the residual, which Section 8's monotonicity result rules out.
  • Reading \|\hat f\|_2^2 (energy captured) and \|f-\hat f\|_2^2 (energy left over) backwards when reporting a percentage.