Error Function in LaTeX (\text{erf}(x))

erf(x)\text{erf}(x)
LaTeX command
\text{erf}(x)
Package
Add to your preamble:\usepackage{amsmath}
Mode
Text and math mode

Where it is used

Error function: the scaled integral of the Gaussian e^{-t^2} from 0 to x, used for normal probabilities.

The definition is \text{erf}(x) = \frac{2}{\sqrt{\pi}} \int_0^x e^{-t^2}\,dt, with limits \pm 1 at \pm\infty. The standard normal CDF is \Phi(x) = \frac{1}{2}\big[1 + \text{erf}(x/\sqrt{2})\big], and erf solves the heat equation for a step initial condition. \text{erf} prints upright, but it follows the surrounding font, so it goes italic inside theorems; \operatorname{erf}, or a \DeclareMathOperator in the preamble, is more robust and adds proper spacing. It is odd: \text{erf}(-x) = -\text{erf}(x). The inverse is \text{erf}^{-1}, used to compute normal quantiles.

Minimal compilable example

Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.

Φ(x)=12[1+erf(x2)]\Phi(x) = \frac{1}{2}\left[1 + \text{erf}\left(\frac{x}{\sqrt{2}}\right)\right]
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Error Function: $\text{erf}(x)$

\[ \Phi(x) = \frac{1}{2}\left[1 + \text{erf}\left(\frac{x}{\sqrt{2}}\right)\right] \]
\end{document}

Related symbols

All الدوال الخاصة →

Frequently asked questions

How do I write Error Function in LaTeX?
Type \text{erf}(x) in math mode, for example $\Phi(x) = \frac{1}{2}\left[1 + \text{erf}\left(\frac{x}{\sqrt{2}}\right)\right]$. Load amsmath first with \usepackage{amsmath}.
Which package do I need for \text{erf}(x)?
\text{erf}(x) needs amsmath: add \usepackage{amsmath} to your preamble before the document starts.
Can I use \text{erf}(x) in text mode, or only in math mode?
Both. \text{erf}(x) compiles in running text as well as inside $...$; in a formula keep it in math mode so it gets math fonts and spacing.
Math poweredاكتب LaTeX باستخدام الذكاء الاصطناعي

أفضل محرر LaTeX بالذكاء الاصطناعي، بديل Overleaf

يساعد Octree الباحثين من أكثر من 15 جامعة على كتابة أوراق البحث بشكل أسرع باستخدام الذكاء الاصطناعي

  • أنشئ رسوم TikZ جميلة باستخدام الذكاء الاصطناعي
  • ارفع صورة وحولها إلى LaTeX بسلاسة
  • احصل على مساعدة فورية في كتابة وتنسيق أوراق البحث