Probability
Probability[pred,xdist]
gives the probability for an event that satisfies the predicate pred under the assumption that x follows the probability distribution dist.
Probability[pred,xdata]
gives the probability for an event that satisfies the predicate pred under the assumption that x follows the probability distribution given by data.
Probability[pred,{x_{1},x_{2},…}dist]
gives the probability that an event satisfies pred under the assumption that {x_{1},x_{2},…} follows the multivariate distribution dist.
Probability[pred,{x_{1}dist_{1},x_{2}dist_{2},…}]
gives the probability that an event satisfies pred under the assumption that x_{1}, x_{2}, … are independent and follow the distributions dist_{1}, dist_{2}, ….
Probability[pred_{1}pred_{2},…]
gives the conditional probability of pred_{1} given pred_{2}.
Details and Options
 xdist can be entered as x dist dist or x\[Distributed]dist.
 pred_{1}pred_{2} can be entered as pred_{1} cond pred_{2} or pred_{1}\[Conditioned]pred_{2}.
 For a continuous distribution dist, the probability of pred is given by ∫Boole[pred]f[x]x where f[x] is the probability density function of dist and the integral is taken over the domain of dist.
 For a discrete distribution dist, the probability of pred is given by ∑Boole[pred]f[x] where f[x] is the probability density function of dist and the summation is taken over the domain of dist.
 For a dataset data, the probability of pred is given by Sum[Boole[pred],{x,data}]/Length[data].
 Univariate data is given as a list of values {v_{1},v_{2},…} and multivariate data is given as a list of vectors {{v_{11},…,v_{1m}},{v_{21},…,v_{2m}},…}.
 Probability[pred,{x_{1}dist_{1},x_{2}dist_{2}}] corresponds to Expectation[Probability[pred,x_{2}dist_{2}],x_{1}dist_{1}] so that the last variable is summed or integrated first.
 N[Probability[…]] calls NProbability for probabilities that cannot be evaluated symbolically. »
 The following options can be given:

Assumptions $Assumptions assumptions to make about parameters GenerateConditions False whether to generate conditions on parameters Method Automatic what method to use
Background & Context
 Probability[pred,x] represents the probability for an event that satisfies a predicate pred under the assumption that the chosen random variable x follows an indicated probability distribution (i.e. is a discrete or continuous distribution such as NormalDistribution, BinomialDistribution, ChiSquareDistribution, etc.) or is taken from a given dataset (i.e. defines a dataset), and where is a shorthand for Distributed. The output of Probability is either a number (where the probability of an impossible event is 0 while the probability for a certain event is 1) or a symbolic expression involving the input parameters.
 Probability also works with multivariate distributions; with nonparametric distributions such as EmpiricalDistribution, HistogramDistribution, and KernelMixtureDistribution; and with derived distributions such as TransformedDistribution and ProductDistribution. In addition, Probability may be applied to random processes, including those defined by ContinuousMarkovProcess, DiscreteMarkovProcess, WienerProcess, and PoissonProcess.
 The predicate pred may include both linear and nonlinear inequalities, as well as logical combinations of inequalities. Probability can compute conditional probabilities using a predicate of the form pred_{1}pred_{2}, where is a shorthand for Conditioned. A number of options may be passed to Probability, including Assumptions, GenerateConditions, and Method. The output provided by Probability is calculated using exact methods such as symbolic integration and summation. Corresponding results involving numerical methods can be obtained via NProbability.
 Several Wolfram Language functions, including PDF, CDF, and SurvivalFunction, return results that are equivalent to those obtainable using Probability with particular predicate structures. In addition, results obtained by Probability may be obtained by Expectation by pairing Expectation with a Boole construct. For example, Expectation[Boole[1<x<3],xNormalDistribution[]] is equivalent to Probability[1<x<3,xNormalDistribution[]].
 Probability can be used to exactly solve many problems in probability. For example, the probability that a toss of two dice will yield a sum of 3 or 4 is given by Probability[3≤x+y≤4,{x,y}DiscreteUniformDistribution[{{1,6},{1,6}}], while the chances that a triple of uniformly distributed random variables satisfying will yield a polynomial with real roots can be computed using Probability[b^{2}4a c≥0,{a,b,c}UniformDistribution[Table[{0,1},{3}]]].
Examples
open allclose allBasic Examples (3)
Scope (30)
Basic Uses (9)
Compute the probability of an event in a continuous univariate distribution:
Discrete univariate distribution:
Continuous multivariate distribution:
Discrete multivariate distribution:
Find the probability of an event in a distribution specified by a list:
Compute the probability using independently distributed random variables:
Find the conditional probability with general nonzero probability conditioning:
Discrete univariate distribution:
Multivariate continuous distribution:
Multivariate discrete distribution:
Compute the conditional probability with a zeroprobability conditioning event:
Apply N[Probability[…]] to invoke NProbability if symbolic evaluation fails:
With no Assumptions, conditions are generated:
With Assumptions, a result valid under the given assumptions is returned:
Use nonlinear predicates and arbitrary logical combinations:
Calculate the probability of an event for a time slice of a Poisson process:
Quantity Uses (3)
Probability of events specified using Quantity:
Probability involving QuantityDistribution:
Conditional probability specified using Quantity:
Parametric Distributions (5)
Nonparametric Distributions (4)
Compute probabilities using a univariate EmpiricalDistribution:
Using a multivariate empirical distribution:
Using a univariate HistogramDistribution:
A multivariate histogram distribution:
Using a univariate KernelMixtureDistribution:
Using censored data with SurvivalDistribution:
Derived Distributions (9)
Compute the probability using a TransformedDistribution:
An equivalent way of formulating the same probability:
Find the probability using a ProductDistribution:
An equivalent formulation for the same probability:
Using a component mixture of normal distributions:
Parameter mixture of exponential distributions:
Truncated Dirichlet distribution:
Generalizations & Extensions (3)
Options (5)
Assumptions (1)
With no Assumptions, conditions are generated:
With Assumptions, a result valid under the given assumptions is returned:
Method (4)
Compute a probability using the default method:
The computed probability is given by a difference of two CDF evaluations:
Here, the CDF method fails because the predicate is transcendental:
The probability can be computed using the PDF and symbolic integration:
Compute the probability of an event for TukeyLambdaDistribution:
This uses the Quantile since the PDF of the distribution is not available in closed form:
Compute the probability of an event for a continuous distribution:
This example uses Integrate:
Use Activate to evaluate the result:
Applications (50)
Random Experiments (8)
A cointossing experiment consists of tossing a fair coin repeatedly until a head results. Simulate the process:
Compute the probability that at least 5 coin tosses will be necessary:
Compute the expected number of coin tosses:
The number of heads in n flips with a fair coin can be modeled with BinomialDistribution:
Show the distribution of heads for 100 coin flips:
Compute the probability that there are between 60 and 80 heads in 100 coin flips:
Now, suppose that for an unfair coin the probability of heads is 0.6:
The distribution and the corresponding probabilities have changed:
The number of tails before getting 4 heads with a fair coin:
Plot the distribution of tail counts:
Compute the probability of getting at least 6 tails before getting 4 heads:
Compute the expected number of tails before getting 4 heads:
Find the probability that a randomly chosen point is the left part of the interval:
A fair sixsided die can be modeled using a DiscreteUniformDistribution:
Compute the probability that the sum of three dice values is less than 6:
Verify by generating random dice throws, in this case times three dice throws:
Verify by explicitly enumerating all possible dice outcomes:
Suppose an urn has 100 elements, of which 40 are special:
The probability distribution that there are 20 special elements in a draw of 50 elements:
Compute the probability that there are more than 25 special elements in a draw of 50 elements:
Compute the expected number of special elements in a draw of 50 elements:
Probability of finding a prime number of the form among the first 10000 primes:
Probability of finding a prime number of the form among the first 100000 primes:
Probability that a random integer between 1 and 9999 will have digits that sum to 12:
Sports and Games (4)
Gary Kasparov, chess champion, plays in a tournament simultaneously against 100 amateurs. It has been estimated that he loses about 1% of such games. Find the probability of his losing 0, 2, 5, and 10 games:
Use a Poisson approximation to compute the same probabilities:
Perform the same computation when he is playing 5 games, but with stronger opposition so that his loss probability is 10% instead:
In this case the Poisson approximation is less accurate:
A basketball player has a freethrow percentage of 0.75. Simulate 10 free shots:
Find the probability that the player hits 2 out of 3 free shots in a game:
In the game of craps [MathWorld], two dice are thrown:
The resulting PDF can be tabulated as:
Find the probability of getting "snake eyes" [MathWorld]:
Or "boxcars" [MathWorld]:
Or "eighter from Decatur" [MathWorld]:
Or "little Joe" [MathWorld]:
The full list of probabilities:
Find the probability of losing in one throw or getting craps, i.e. any of the sums 2, 3, or 12:
Find the probability of winning in one throw, i.e. getting the sums 7 or 11:
Find the distribution of the number of spades in a fivecard poker hand:
Find the probability that there are at least 2 spades in the poker hand:
Actuarial Science (5)
An actuary has discovered that policy holders are three times as likely to file two claims as to file four claims. Assuming the number of claims filed follows a Poisson distribution, find the variance of the number of claims filed:
A group insurance policy covers the medical claims of the employees of a small company. The value, , of the claims made in one year is described by , where is a random variable with density function proportional to for . Find the conditional probability that exceeds 40000, given that exceeds 10000:
Two insurers provide bids on an insurance policy to a large company. The bids must be between 2000 and 2200. The company decides to accept the lower bid if the two bids differ by 20 or more. Otherwise, the company will consider the two bids further. Assume that the two bids are independent and are both uniformly distributed on the interval from 2000 to 2200. Determine the probability that the company considers the two bids further:
Claims filed under auto insurance policies follow a normal distribution with mean $19400 and standard deviation $5000. Find the probability that the average of 25 randomly selected claims exceeds $20000:
The waiting time for the first claim from a good driver and the waiting time for the first claim from a bad driver are independent and follow exponential distributions with means 6 years and 3 years, respectively. Compute the probability that the first claim from a good driver will be filed within 3 years and the first claim from a bad driver will be filed within 2 years:
Weather (3)
The expected number of raindrops falling into a bucket in a 5second interval is 20. Simulate the raindrop count for each 5second interval:
Find the probability that more than 20 raindrops fall into the bucket in 5 seconds:
Logistic distribution can be used to approximate wind speeds:
Find the estimated distribution:
Compare the PDF to the histogram of the wind data:
Find the probability of a day with wind speed greater than 30 km/h:
Cloud duration approximately follows a beta distribution with parameters 0.3 and 0.4 for a particular location. Find the probability that cloud duration will be longer than half a day:
Simulate the fraction of the day that is cloudy over a period of one month:
Find the average cloudiness duration for a day:
Find the probability of having exactly 20 days in a month with cloud duration less than 10%:
Find the probability of at least 20 days in a month with cloud duration less than 10%:
Traffic (4)
A switchboard receives on average 100 calls per minute. Find the switchboard capacity so that it gets saturated less than once in every 60 minutes:
Find the minimum capacity that satisfies the constraint:
Two trains arrive at a station independently and stay for 10 minutes. If the arrival times are uniformly distributed, find the probability the two trains will meet at the station within one hour:
The region where the two trains meet:
A person is standing by a road counting cars until he sees a black one, at which point he restarts the count. Simulate the counting process, assuming that 10% of the cars are black:
Find the expected number of cars to come by before the count starts over:
Find the probability of counting 10 or more cars before a black one:
Assume that the delay caused by a traffic signal is exponentially distributed with an average delay of 0.5 minutes. A driver has to drive a route that passes through seven unsynchronized traffic signals. Find the distribution for the delay passing all signals:
Hence the distribution for the sum of 7 independent exponential variables:
Find the probability that traffic signals cause a delay greater than 5 minutes:
Reliability (5)
A battery has a lifetime that is approximately normally distributed with a mean of 1000 hours and a standard deviation of 50 hours. Find the fraction with a lifetime between 800 and 1000 hours:
Out of 100 batteries, compute how many have a lifetime between 800 and 1000 hours:
Suppose the lifetime of an appliance has an exponential distribution with an average lifetime of 10 years. Find the appliance lifetime distribution:
Find the probability that a used appliance with years of use will not fail in the next 5 years:
Using the memoryless property of ExponentialDistribution:
A system uses triple redundancy with three microprocessors and is designed to operate as long as one processor is still functional. The probability that a microprocessor is still functional after seconds is . Find the probability that the system is still operating after seconds:
With mean time to failure for each processor , find out when the system functions with a probability of less than 99%:
A budgetpriced lighter has 0.90 probability of lighting on any given attempt. Simulate the lighting process; the result indicates the number of failures before successful lighting:
Find the probability that the lighter lights in 3 trials or less:
A system is composed of 4 independent components, each with lifespan exponentially distributed with parameter . Find the probability that no component fails before 500 hours:
Directly use SurvivalFunction:
Find the probability that exactly one component will fail in the first 1200 hours:
Directly use CDF and SurvivalFunction:
By using BooleanCountingFunction, you can also define the logical condition:
Communication (4)
A packet consisting of a string of n symbols is transmitted over a noisy channel. Each symbol has probability of incorrect transmission. Find n such that the probability of incorrect packet transmission is less than :
Compute the same limit using a Poisson approximation:
Assume that the duration of telephone calls is exponentially distributed. The average length of a telephone call is 3.7 minutes. Find the probability that 9 consecutive phone calls will be longer than 25 minutes:
Summing 9 independent phone call durations:
The probability that they last longer than 25 minutes:
Waiting times at a receiver for signals coming from four independent transmitters are exponentially distributed with parameters , , , and , respectively. Find the probability that the signal from the third transmitter arrives first to the receiver:
Find the distribution of the waiting time for any signal at the receiver:
Find the average waiting time for any signal at the receiver:
Simulate the waiting time between signals arriving at the receiver for , , , and :
Assume that the time delay in a logic element is exponentially distributed and that the average delay is seconds. The longest sequence of logic elements in a combinational logic network is six. Find the probability that delay through all six elements is longer than seconds:
Quality (4)
A student will take a test repeatedly until passing it, each time succeeding with probability . Find the probability that the student succeeds in attempts or fewer:
Given that the student passes the test in attempts or fewer, find the PDF:
Assume the waiting time a customer spends in a restaurant is exponentially distributed with an average wait time of 5 minutes. Find the probability that the customer will have to wait more than 10 minutes:
Find the probability that the customer will have to wait an additional 10 minutes, given that he or she has already been waiting for at least 10 minutes (the past does not matter):
A company manufactures nails with length normally distributed, mean 0.497 inches, and standard deviation 0.002 inches. Find the fraction that satisfies the specification of length equal to 0.5 inches plus/minus 0.004 inches:
Direct computation with CDF:
Suppose there are 5 defective items in a batch of 10 items, and 6 items are selected for testing. Simulate the process of testing when the number of defective items found is counted:
Find the probability that there are 2 defective items in the sample:
Probability Visualizations (3)
Compute and illustrate the continuous probability :
Plot a larger part of the PDF as well as a highlighted probability region:
Compute and illustrate the discrete probability :
Plot a larger region of the PDF as well as a highlighted probability region:
Compute and illustrate the discrete probability P[2≤x≤5∧3≤y≤7]:
Plot a larger region of the PDF as well as a highlighted probability region:
Other Applications (5)
A radioactive material on average emits 3.2 particles per second; show the distribution:
Compute the probability that more than 4 particles are emitted over the next second:
Simulate a typical particle count per second over 10 minutes:
A drug has proven to be effective in 30% of cases. Find the probability it is effective in 3 of 4 patients:
Find the expected number of successes when applied to 500 cases:
Logistic distribution provides very good fit for fractional price changes from the previous closing price of stocks. Find the estimated distribution for the daily fractional price changes of Standard & Poor's 500 index from January 1, 2000, to January 1, 2009:
Compare the histogram of the data with the PDF of the estimated distribution:
Find the probability of the fractional price change being greater than 0.5%:
Find the mean fractional price change:
Simulate fractional price changes for 30 days:
Show that using logistic distribution provides better fit than when using LogNormalDistribution:
Elections (1)
Boy or Girl? (1)
Theoretical versus Sample Probabilities (1)
Triangle Construction (1)
Consider a stick of length 1. Pick two points uniformly at random on the stick, and break the stick at those points. Find the probability that the three segments obtained in this way form a triangle. Start with a predicate for a valid triangle:
Break the stick uniformly and independently at two locations and :
Regions (1)
Find the probability over a Disk for a DirichletDistribution:
Properties & Relations (11)
The probability of an impossible event is 0:
The probability of a certain event is 1:
The probability of an arbitrary event must lie between 0 and 1:
A conditional probability is defined by a ratio of probabilities:
The probability of the union of disjoint events is the sum of the individual probabilities:
For nondisjoint events, one needs to subtract the probability of an intersection event:
For a distribution specified by a list, Probability computes relative frequencies:
The probability of an event in a continuous distribution is defined by an integral:
The probability of an event in a discrete distribution is defined by a sum:
The CDF of a distribution can be expressed in terms of Probability:
The survival function for a distribution can be expressed in terms of Probability:
The hazard function for a distribution can be expressed in terms of Probability:
Use NProbability to find the numerical value for the probability of an event:
The probability of an event is equivalent to the Expectation of the Boole of the event:
Text
Wolfram Research (2010), Probability, Wolfram Language function, https://reference.wolfram.com/language/ref/Probability.html (updated 2016).
CMS
Wolfram Language. 2010. "Probability." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/Probability.html.
APA
Wolfram Language. (2010). Probability. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Probability.html