Error function and cumulative of the gaussian

$erf(x) = \frac{1}{2\pi} \int_0^x e^{-t^2}dt$

Cumulative of "unit" gaussian $G(\mu=0, \sigma=1)$ is $0.5(1+errf(x))$


$\chi^2 = \sum_i^N \frac{(x_i-\mu_i)^2}{\sigma_i^2}$

Number of degrees of freedom = $n = N$
or $n = N-p$ if $\mu_i$ are fit to $p$ parameters
If $x_i$ are $G(\mu_i, \sigma_i)$ then $\chi^2$ follows this distribution

$f(x) dx = \frac{1}{\Gamma(n/2)} x^{n/2-1} e^{-n/2}$

The expectation value (mean) is $<\chi^2> = n$
$\chi^2/n \approx 1$ is a rule-of-thumb for a good fit
But it there is much more to it in the tails.