Details on derivation of the Grubbs test

If we integrate the density function, we get the probability.

By independence, if we do not impose the ordering constraint, the joint density function is

$$\prod_{i=1}^nf(x_i|\mu=0, \sigma^2)=\prod_{i=1}^n \frac1{\sqrt{2\pi}\sigma}\exp\left( -\frac{(x_i-0)^2}{2\sigma^2}\right)= \frac1{(\sqrt{2\pi}\sigma)^n}\exp\left(-\frac1{2\sigma^2}\sum_{i=1}^n x_i^2\right)$$

Now, since we impose the ordering constraint, we are considering the permutations as the same, hence we multiply by $n!$.