How to Numerically Evaluate P(1 < Z ≤ 2) for a Standard Normal
At a glance
- 1. Use the CDF
Find the standard normal cumulative probabilities at 2 and 1, then subtract the latter from the former.
- 2. Integrate the density
Numerically integrate the standard normal density from 1 to 2 as an independent method.
- 3. Simulate if needed
Generate standard normal samples and estimate the probability by the fraction that fall in the interval.
Try it: Normal probability calculator
For a standard normal random variable , 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 , so about 13.59% of standard normal observations fall in this interval.
Method 1: Subtract CDF values
The standard normal CDF, written as , gives . Therefore,
Using standard normal CDF values,
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
Integrating this density over the interval gives the same probability:
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 independent draws, the estimate’s standard error is approximately
where . For , this is about . A rough 95% margin of error is twice that, about . 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?
| Method | Best use | Result type |
|---|---|---|
| CDF subtraction | A standard normal interval with available software or tables | Accurate numerical value |
| Numerical integration | Checking the result or integrating a density without a convenient CDF | Accurate numerical approximation |
| Simulation | Complex models where direct calculation is difficult | Random estimate with sampling error |
For this particular probability, use unless you specifically need to demonstrate integration or simulation.
Common mistakes
- Using the wrong subtraction order: The probability from 1 to 2 is , not the reverse.
- Confusing a CDF value with an interval probability: 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 . Thus is the same as or .
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 .
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.