First Year Engineering is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

Error function

Error function (erf), its definitions, properties, series/asymptotic expansions, relations to Gaussian integrals and normal distribution, and using erf/erfc to evaluate integrals.

Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

Engineers meet the error function in heat conduction (transient diffusion into a semi-infinite solid), mass diffusion, signal processing, and probability (Gaussian/normal noise). It lets us express integrals of the Gaussian e^(−x²) that do not have elementary antiderivatives, so we can write exact answers and compute reliable numerical values.

Key ideas

- Exact definition: For all real x,
  erf(x) = (2/√π) ∫₀ˣ e^(−t²) dt.
- Here √π is the positive square root of π. The integral is an area under the Gaussian curve e^(−t²).
  • Basic properties from the definition:

    • erf(0) = 0; erf is an odd function: erf(−x) = −erf(x).
    • As x → ∞, erf(x) → 1; as x → −∞, erf(x) → −1. So −1 < erf(x) < 1 for all real x, with horizontal asymptotes ±1.
  • Complementary error function:

    • The complementary error function, written erfc(x), is defined by
      • erfc(x) = 1 − erf(x) = (2/√π) ∫ₓ^∞ e^(−t²) dt.
    • It is convenient for tail (large-x) probabilities/integrals because erfc(x) → 0 as x → ∞ and has accurate asymptotic expansions.
  • Relation to the normal distribution:

    • The standard normal cumulative distribution function (CDF) Φ(x) is defined by Φ(x) = (1/√(2π)) ∫_{−∞}^x e^{−t²/2} dt.
    • Exact relation: Φ(x) = 1/2 [1 + erf(x/√2)]. Also, 1 − Φ(x) = 1/2 erfc(x/√2).
    • This connects engineering probability calculations (noise, tolerances) to erf/erfc tables or software.
  • Differentiation and integral representation:

    • From the definition and the Fundamental Theorem of Calculus: d/dx [erf(x)] = (2/√π) e^(−x²).
    • Indefinite integral: ∫ e^(−β x²) dx = (√π/(2√β)) erf(√β x) + C, with β > 0.
    • Definite integral from 0: ∫₀ˣ e^(−β t²) dt = (√π/(2√β)) erf(√β x), β > 0.
  • Series expansion (Maclaurin) and convergence:

    • e^(−t²) = ∑_{n=0}^∞ (−1)ⁿ t^{2n} / n! for all real t.
    • Integrate term-by-term to get the power series for erf:
      • erf(x) = (2/√π) ∑_{n=0}^∞ [ (−1)ⁿ x^{2n+1} / (n!(2n+1)) ], valid for all real x.
    • This alternating series converges rapidly for small |x| and more slowly for large |x|.
  • Asymptotic behavior for large |x|:

    • For x → +∞, erfc(x) has the standard asymptotic expansion
      • erfc(x) ∼ (e^(−x²)/(√π x)) [ 1 − 1/(2x²) + 3/(4x⁴) − 15/(8x⁶) + … ].
    • Therefore, erf(x) = 1 − erfc(x) gives an accurate approximation to 1 with a small correction when x is large.
  • No elementary antiderivative of e^(−x²):

    • It is a standard, examinable fact that the integral ∫ e^(−x²) dx is not expressible in a finite combination of elementary functions. The function erf(x) is introduced to represent this integral exactly.
  • Gaussian integral (a classic derivation):

    • The exact value ∫_{−∞}^{∞} e^(−x²) dx = √π is obtained by squaring the integral, converting to plane polar coordinates, and integrating. From this, ∫₀^{∞} e^(−x²) dx = √π / 2.
    • This result underlies the scaling constants in erf and erfc.
  • Dimensional considerations and scaling:

    • The argument of erf must be dimensionless. If a physical variable has units (say length x in m) and appears in e^(−a x²) with a in m⁻², then √a x is dimensionless, and erf(√a x) is valid. Always scale variables before applying erf/erfc.
  • Graph to sketch (if asked):

    • Draw an S-shaped curve passing through the origin (0,0), increasing monotonically, with horizontal asymptotes y = 1 as x → ∞ and y = −1 as x → −∞. Mark key points: (0,0); label asymptotes; note odd symmetry about the origin.

Formulas

  • Φ(x) = 1/2 · [1 + erf(x/√2)] — standard normal CDF; Φ is dimensionless probability; x is dimensionless; applies to N(0,1).
  • d/dx [erf(x)] = (2/√π) e^(−x²) — derivative of erf; x dimensionless.
  • ∫ e^(−β x²) dx = (√π/(2√β)) erf(√β x) + C — antiderivative for β > 0; x has units inverse to √β so that √β x is dimensionless.
  • ∫₀ˣ e^(−β t²) dt = (√π/(2√β)) erf(√β x) — definite integral form; β > 0.
  • ∫_{−∞}^{∞} e^(−x²) dx = √π — Gaussian integral; dimensionless.
  • ∫₀^{∞} e^(−x²) dx = √π/2 — half-Gaussian; dimensionless.
  • erf(x) = (2/√π) · [ x − x³/(3·1!) + x⁵/(5·2!) − x⁷/(7·3!) + … ] — power series; all terms dimensionless; all real x.
  • erfc(x) ≈ (e^(−x²)/(√π x)) · [ 1 − 1/(2x²) + 3/(4x⁴) − 15/(8x⁶) + … ] — large-x asymptotic; x > 0.
  • 1 − Φ(x) = 1/2 · erfc(x/√2) — upper-tail probability of standard normal.

Worked examples

  1. Numerical approximation by series: Compute erf(1) to at least 6 correct decimal places.

    • Step 1: Use the power series at x = 1: erf(1) = (2/√π) ∑_{n=0}^∞ (−1)ⁿ / (n!(2n+1)).
    • Step 2: Sum terms until change is < 1×10⁻⁷ (sufficient for 6–7 decimals). • Partial sums of S = ∑ (−1)ⁿ/[n!(2n+1)] at x = 1: n=0: 1 n=1: −1/3 = −0.3333333333 → S₁ = 0.6666666667 n=2: +1/(2·5) = +0.1 → S₂ = 0.7666666667 n=3: −1/(6·7) ≈ −0.02380952381 → S₃ ≈ 0.7428571429 n=4: +1/(24·9) ≈ +0.00462962963 → S₄ ≈ 0.7474867725 n=5: −1/(120·11) ≈ −0.000757575758 → S₅ ≈ 0.7467291967 n=6: +1/(720·13) ≈ +0.000106837607 → S₆ ≈ 0.7468360343 n=7: −1/(5040·15) ≈ −0.000013227513 → S₇ ≈ 0.7468228068 n=8: +1/(40320·17) ≈ +0.000001459854 → S₈ ≈ 0.7468242667
    • Step 3: Multiply by 2/√π ≈ 1.1283791671: erf(1) ≈ 1.1283791671 × 0.7468242667 ≈ 0.842700894.
    • Final answer: erf(1) ≈ 0.842700894 (dimensionless). This matches the known value 0.842700793… to 6 d.p. accuracy.
  2. Expressing an integral in terms of erf: Evaluate ∫ e^(−4x²) dx.

    • Step 1: Identify β = 4 > 0. Use the formula ∫ e^(−β x²) dx = (√π/(2√β)) erf(√β x) + C.
    • Step 2: Compute constants: √β = √4 = 2.
    • Step 3: Substitute: ∫ e^(−4x²) dx = (√π/(2·2)) erf(2x) + C = (√π/4) erf(2x) + C.
    • Final answer: ∫ e^(−4x²) dx = (√π/4) erf(2x) + C.
  3. Gaussian definite integral and scaling: Evaluate ∫₀^∞ e^(−a x²) dx for a > 0.

    • Step 1: Use the substitution u = √a x ⇒ du = √a dx ⇒ dx = du/√a.
    • Step 2: Limits: x = 0 ⇒ u = 0; x → ∞ ⇒ u → ∞.
    • Step 3: Transform the integral: ∫₀^∞ e^(−a x²) dx = ∫₀^∞ e^(−u²) (du/√a) = (1/√a) ∫₀^∞ e^(−u²) du.
    • Step 4: Use the half-Gaussian integral ∫₀^∞ e^(−u²) du = √π/2.
    • Step 5: Combine: ∫₀^∞ e^(−a x²) dx = (1/√a) · (√π/2) = (1/2) √(π/a).
    • Final answer: ∫₀^∞ e^(−a x²) dx = (1/2) √(π/a).
  4. Probability connection: Express P(−b ≤ Z ≤ b) for Z ~ N(0,1) in terms of erf and evaluate at b = 1.5.

    • Step 1: For Z standard normal, P(−b ≤ Z ≤ b) = Φ(b) − Φ(−b).
    • Step 2: Using Φ(x) = 1/2 [1 + erf(x/√2)], we have Φ(−b) = 1/2 [1 + erf(−b/√2)] = 1/2 [1 − erf(b/√2)].
    • Step 3: Therefore, Φ(b) − Φ(−b) = [1/2 (1 + erf(b/√2))] − [1/2 (1 − erf(b/√2))] = erf(b/√2).
    • Step 4: For b = 1.5, compute argument: b/√2 ≈ 1.5/1.41421356 ≈ 1.06066.
    • Step 5: Using a table/software value, erf(1.06066) ≈ 0.866385 (dimensionless).
    • Final answer: P(−1.5 ≤ Z ≤ 1.5) ≈ 0.866385 (i.e., about 86.64%).

Common mistakes

  • Confusing erf and erfc for tail probabilities; for large x, use erfc(x) to avoid subtracting two nearly equal numbers (loss of significance).
  • Mixing the normal CDF Φ(x) and erf(x) without the √2 scaling: Φ(x) = 1/2 [1 + erf(x/√2)].
  • Applying the small-x power series at large x and expecting fast convergence; for large x, use the erfc asymptotic formula.
  • Dropping the constant of integration C in indefinite integrals.

For your exam

  • d/dx [erf(x)] = (2/√π) e^(−x²) from the Fundamental Theorem of Calculus.
  • Series expansion of erf(x) by integrating the Maclaurin series of e^(−t²).
  • Gaussian integral ∫_{−∞}^{∞} e^(−x²) dx = √π via polar coordinates, then deduce ∫₀^∞ e^(−a x²) dx = (1/2) √(π/a).
  • Asymptotic form of erfc(x) for large x (first 1–2 terms) using integration by parts.
  • Numericals:
    • Evaluate definite integrals of the form ∫ e^(−a x²) dx between given limits using erf/erfc and compute numeric values (units: dimensionless unless scaled).
    • Probability questions: express normal probabilities using erf; compute using tables/software.
  • Diagrams: Sketch y = erf(x) with key features labeled (origin; asymptotes at y = ±1; odd symmetry; monotonic increase).
  • Full-marks answers: define terms clearly, show scaling steps so the argument of erf is dimensionless, write the formula before substituting numbers, carry units where applicable (physical parameters), and present a clean final value.

Quick check

  1. Show that d/dx [erf(x)] = (2/√π) e^(−x²).
  2. Write ∫₀^a e^(−k x²) dx in terms of erf, with k > 0.
  3. Express Φ(x) in terms of erf, and hence find P(|Z| ≤ x) for Z ~ N(0,1).

Answers: 1) From the definition and the Fundamental Theorem of Calculus. 2) (√π/(2√k)) erf(√k · a). 3) Φ(x) = 1/2 [1 + erf(x/√2)], so P(|Z| ≤ x) = erf(x/√2).

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?