St · Statistics & Probability

How to Numerically Evaluate P(1 < Z ≤ 2) for a Standard Normal

Published By the 9to5Science editorial team

At a glance

  1. 1. Use the CDF

    Find the standard normal cumulative probabilities at 2 and 1, then subtract the latter from the former.

  2. 2. Integrate the density

    Numerically integrate the standard normal density from 1 to 2 as an independent method.

  3. 3. Simulate if needed

    Generate standard normal samples and estimate the probability by the fraction that fall in the interval.

Advertisement

Try it: Normal probability calculator

For a standard normal random variable ZZ, the probability that it lies between 1 and 2 is the area under the normal density over that interval. The most direct numerical method is to subtract two values of the standard normal cumulative distribution function (CDF). You can also integrate the density numerically or estimate the probability by simulation.

The probability is approximately 0.13590.1359, so about 13.59% of standard normal observations fall in this interval.

Method 1: Subtract CDF values

The standard normal CDF, written as Φ(z)\Phi(z), gives P(Z≤z)P(Z\le z). Therefore,

P(1<Z≤2)=Φ(2)−Φ(1).P(1 < Z \le 2)=\Phi(2)-\Phi(1).

Using standard normal CDF values,

Φ(2)≈0.9772498681,Φ(1)≈0.8413447461,P(1<Z≤2)≈0.9772498681−0.8413447461≈0.1359051220.\begin{aligned} \Phi(2)&\approx 0.9772498681,\\ \Phi(1)&\approx 0.8413447461,\\ P(1 < Z \le 2)&\approx 0.9772498681-0.8413447461\\ &\approx 0.1359051220. \end{aligned}

This is usually the simplest and most accurate approach when you have access to a statistics package or a reliable normal table. The normal CDF has no elementary closed-form expression, but software evaluates it efficiently using established numerical algorithms.

For example, in Python with SciPy:

from scipy.stats import norm

p = norm.cdf(2) - norm.cdf(1)
print(p)  # 0.13590512198327787

Method 2: Numerically integrate the density

The standard normal probability density is

φ(z)=12πe−z2/2.\varphi(z)=\frac{1}{\sqrt{2\pi}}e^{-z^2/2}.

Integrating this density over the interval gives the same probability:

P(1<Z≤2)=∫1212πe−z2/2 dz.P(1 < Z \le 2)=\int_1^2 \frac{1}{\sqrt{2\pi}}e^{-z^2/2}\,dz.

A numerical integration routine approximates the area by evaluating the density at selected points. Adaptive quadrature, which adjusts the points and subinterval sizes to control numerical error, is a good general-purpose choice. For instance:

from math import exp, pi, sqrt
from scipy.integrate import quad

def standard_normal_pdf(z):
    return exp(-z**2 / 2) / sqrt(2 * pi)

p, estimated_error = quad(standard_normal_pdf, 1, 2)
print(p)  # approximately 0.1359051219832779

Composite Simpson’s rule or the trapezoidal rule can also approximate the integral. With these methods, using a smaller step size generally improves accuracy, though the error depends on the method and the smoothness of the integrand. For this smooth density on a short interval, standard numerical integration works very well.

Method 3: Estimate it by simulation

To estimate the probability by Monte Carlo simulation, generate many independent standard normal values and count the fraction between 1 and 2:

import numpy as np

rng = np.random.default_rng(123)
z = rng.standard_normal(1_000_000)
estimate = np.mean((z > 1) & (z <= 2))
print(estimate)

The result will vary from run to run. With NN independent draws, the estimate’s standard error is approximately

p(1−p)N,\sqrt{\frac{p(1-p)}{N}},

where p=0.1359051p=0.1359051. For N=1,000,000N=1{,}000{,}000, this is about 0.0003430.000343. A rough 95% margin of error is twice that, about 0.000670.00067. Simulation is useful when the probability is part of a more complicated model that is hard to integrate, but it is less efficient than CDF subtraction for this simple interval.

Which method should you use?

MethodBest useResult type
CDF subtractionA standard normal interval with available software or tablesAccurate numerical value
Numerical integrationChecking the result or integrating a density without a convenient CDFAccurate numerical approximation
SimulationComplex models where direct calculation is difficultRandom estimate with sampling error

For this particular probability, use Φ(2)−Φ(1)\Phi(2)-\Phi(1) unless you specifically need to demonstrate integration or simulation.

Common mistakes

  • Using the wrong subtraction order: The probability from 1 to 2 is Φ(2)−Φ(1)\Phi(2)-\Phi(1), not the reverse.
  • Confusing a CDF value with an interval probability: Φ(2)\Phi(2) is the probability of being at or below 2; it is not the probability of being between 1 and 2.
  • Treating simulation as exact: A Monte Carlo result fluctuates. Report the estimate with an appropriate number of significant digits and, when relevant, its sampling uncertainty.
  • Worrying about the endpoint convention: The standard normal distribution is continuous, so P(Z=1)=P(Z=2)=0P(Z=1)=P(Z=2)=0. Thus P(1<Z≤2)P(1 < Z \le 2) is the same as P(1≤Z<2)P(1 \le Z < 2) or P(1<Z<2)P(1 < Z < 2).

If you are estimating probabilities by repeated simulation, the number of trials needed depends on the precision you want; increasing the trial count reduces the standard error in proportion to 1/N1/\sqrt{N}.

References

  1. SciPy documentation: scipy.stats.norm
  2. SciPy documentation: scipy.integrate.quad

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.