This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.

Probability

 Probability gives the probability for an event that satisfies the predicate pred under the assumption that x follows the probability distribution dist. Probabilitygives the probability for an event that satisfies the predicate pred under the assumption that x follows the probability distribution given by data. Probabilitygives the probability that an event satisfies pred under the assumption that follows the multivariate distribution dist. Probabilitygives the probability that an event satisfies pred under the assumption that , , ... are independent and follow the distributions , , .... Probabilitygives the conditional probability of given .
• can be entered as x Esc dist Esc dist or .
• can be entered as Esc cond Esc or .
• For a continuous distribution dist, the probability of pred is given by where 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 where 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 and multivariate data is given as a list of vectors .
• N 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
Compute the probability of a simple event:
Compute the probability of nonlinear and logical combination of inequalities:
Compute a conditional probability:
Compute the probability of a simple event:
 Out[1]=
 Out[2]=
 Out[3]=
 Out[4]=

Compute the probability of nonlinear and logical combination of inequalities:
 Out[1]=
 Out[2]=
 Out[3]=
 Out[4]=

Compute a conditional probability:
 Out[1]=
 Out[2]=
 Scope   (25)
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 zero-probability conditioning event:
Apply N 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:
Compute probabilities for univariate continuous distributions:
Compute probabilities for univariate discrete distributions:
Probabilities for multivariate continuous distributions:
Probabilities for multivariate discrete distributions:
Compute probabilities using a univariate EmpiricalDistribution:
Using a multivariate empirical distribution:
Using a univariate HistogramDistribution:
Using a univariate KernelMixtureDistribution:
Using censored data with SurvivalDistribution:
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:
Censored triangular distribution:
Marginal distribution:
Copula distribution:
Formula distribution:
Compute a probability for a mixture of discrete and continuous distributions:
Specify independent distributions using rather than a list notation:
Use a pure function to compute a probability for a list of values:
 Options   (4)
With no Assumptions, conditions are generated:
With Assumptions, a result valid under the given assumptions is returned:
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:
 Applications   (44)
A coin-tossing 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 six-sided die can be modeled using a DiscreteUniformDistribution:
Generate 10 throws of a die:
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:
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 free-throw 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 [], two dice are thrown:
The resulting PDF can be tabulated as:
Find the probability of getting "snake eyes" []:
Or "boxcars" []:
Or "eighter from Decatur" []:
Or "little Joe" []:
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 five-card poker hand:
Find the probability that there are at least 2 spades in the poker hand:
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 40,000, given that exceeds 10,000:
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 19,400 and standard deviation 5000. Find the probability that the average of 25 randomly selected claims exceeds 20,000:
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:
The expected number of raindrops falling into a bucket in a 5-second interval is 20. Simulate the raindrop count for each 5-second 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:
Find mean wind speed:
Simulate wind speeds for a month:
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%:
A switchboard receives on average 100 calls per minute. What should the switchboard capacity be 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:
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 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%:
Expressed in years:
A budget-priced 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:
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:
Summing 6 independent delay distributions:
The probability that the delay is greater than :
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:
Compute and illustrate the continuous probability :
Plot a larger part of the PDF as well as a highlighted probability region:
Show them all together:
Compute and illustrate the discrete probability :
Plot a larger region of the PDF as well as a highlighted probability region:
Show them all together:
Compute and illustrate the discrete probability :
Plot a larger region of the PDF as well as a highlighted probability region:
Show them together:
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:
Compute -values for a -test with alternative hypothesis :
Alternative hypothesis :
Compute the probabilities of events in the complex plane:
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 independent events is the sum of the individual probabilities:
For dependent 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:
Find the probability that a quadratic polynomial with random coefficients has real roots, assuming that the coefficients follow independent exponential distributions:
If the coefficients are equi-distributed:
If the coefficients are uniformly distributed:
New in 8