# Central Limit Theorem - solve for a const, given probability

I hope this is not a very complicated question, but I have problems finding the answer. Quite often, I need to calculate something like this: $P(-a<\bar{x}<a) = p$, where $\bar{x}$ refers to the sample mean and p is given. The standard approach is to use the CLT as follows:

$P[(-a-\mu)\sqrt{n}/\sigma) < Z < (a-\mu)\sqrt{n}/\sigma] = p$, where $n, \mu, \sigma$ are given. From here, knowing that Z is distributed $N(0,1)$, we can use "the table" and find the appropriate values for a.

Is there anyway to do it through Mathematica? In particular, I need to find a.

• Probability[Abs[x] < 1, x \[Distributed] NormalDistribution[]] // N Change the 1 to whatever number you need. – bill s Nov 29 '14 at 19:17
• @bills, I need to find a! – dark blue Nov 29 '14 at 19:19

First, let's find a in functional form:

Probability[Abs[x] < a, x \[Distributed] NormalDistribution[]]


which shows that

f[a_] := Erf[a/Sqrt[2]]


Now you want to solve for the a that has some probability, say 0.1. Then

Solve[f[a] == 0.1, a]

{{a -> 0.125661}}


A little more generally:

Solve[f[a] == p, a]

{{a -> Sqrt[2] InverseErf[p]}}


which provides a direct solution for a with any value of p in terms of the InverseErf function.