PRACTICE →↑ BACK TO TOP

Let's talk

contact@adriamics.com

Probability

GitHub Changelog -

  • 1

Probability language and sample spaces

Probability is the mathematics of uncertainty. A probability model has three parts:

  • A sample space of possible outcomes

  • A collection of events built from subsets of

  • A probability measure assigning likelihoods to events

Outcomes, events, and sample spaces

An outcome is one possible result of an experiment.

A sample space is the set of all outcomes.

An event is a subset of the sample space.

Examples:

  • Tossing a coin once:

  • Rolling a die:

  • Drawing a card from a standard deck: has 52 outcomes

Event operations

If and are events:

  • means "not "

  • means or or both

  • means and

  • means occurs and does not

Disjoint events satisfy:

Equally likely outcomes

If all outcomes in a finite sample space are equally likely, then

This is the classical model used in many introductory problems.

Probability as a number

For any event :

Interpretation:

  • means impossible in the model

  • means certain in the model

  • Values near 0 or 1 mean very unlikely or very likely


Counting methods

Counting is often the first step in a probability problem. If you can count outcomes correctly, the probability usually follows.

Product rule

If a process has choices for one step and choices for a second step, then the total number of outcomes is

More generally, multiply the number of choices at each step.

Factorial

The factorial of a positive integer is

with

Permutations

The number of ways to arrange objects chosen from distinct objects is

Use permutations when order matters.

Example:

  • Assigning gold, silver, and bronze to 10 runners

Combinations

The number of ways to choose objects from distinct objects is

Use combinations when order does not matter.

Example:

  • Choosing 3 students from a class of 12

With and without replacement

  • With replacement: an object can be used again, so counts often stay the same from step to step

  • Without replacement: counts change after each selection

Common counting patterns

Arrangements with repeated objects

If objects contain repeats of sizes , the number of distinct arrangements is

Stars and bars

The number of nonnegative integer solutions to

is

This is useful for allocation and composition problems.


Axioms and basic rules

Probability obeys a few core rules. Most other formulas come from these.

Kolmogorov axioms

For any event :

  1. If are pairwise disjoint, then

Complement rule

This is often the fastest way to compute a probability.

Addition rule

For any two events and :

If and are disjoint:

Inclusion-exclusion

For three events:

This extends to more events with alternating signs.

Union bound

For events :

The union bound is useful for quick upper bounds.


Conditional probability and Bayes' theorem

Conditional probability updates probability after new information is observed.

Conditional probability

If , then

This is the probability of given that has occurred.

Rearranging gives the multiplication rule:

and also

Independence

Events and are independent if

Equivalent forms:

Independence is a structural statement, not just a numerical coincidence in one example.

Law of total probability

If are disjoint, exhaustive events with , then

This is often used with partitions such as machine types, disease status, or urn colors.

Bayes' theorem

For :

If is a partition, then

This is the standard framework for diagnosis and classification problems.

Diagnostic interpretation

In a test problem:

  • Prior probability:

  • Likelihood:

  • Evidence:

  • Posterior probability:

Bayes' theorem converts a test result into an updated belief about the underlying cause.


Random variables

A random variable maps outcomes to numbers.

Discrete random variables

A discrete random variable takes countably many values.

Its probability mass function (pmf) is

Properties:

The cumulative distribution function (cdf) is

Continuous random variables

A continuous random variable has probability density function (pdf) .

Properties:

Probabilities come from areas:

For continuous variables,

CDF for continuous and discrete variables

For any random variable:

For continuous random variables:

where differentiation is valid when the CDF is smooth enough.

Transformations

If , then find the distribution of by:

  1. Relating to

  2. Solving for the relevant interval in terms of

  3. Integrating or summing over that interval

For monotone transformations of continuous variables, the pdf can often be obtained via the change-of-variables formula.


Expectation, variance, and moments

Expectation is the long-run average value of a random variable.

Expected value

For a discrete random variable :

For a continuous random variable:

More generally, for any function :

or

This is the law of the unconscious statistician.

Linearity of expectation

Expectation is linear even when variables are dependent:

For sums:

This is one of the most useful tools in probability.

Variance

Variance measures spread around the mean:

where .

Equivalent form:

Standard deviation:

Covariance

For random variables and :

Equivalent form:

If and are independent, then

The converse is not always true.

Correlation

The correlation coefficient is

It lies between and .

Moments

The th raw moment is .

The th central moment is .

These moments are useful for characterizing distributions.


Common discrete distributions

Discrete distributions model counts, categories, and repeated trials.

Bernoulli distribution

Used for one success/failure trial.

For , if , then

Mean and variance:

Binomial distribution

Counts successes in independent Bernoulli trials.

For an integer and , if , then

for .

Mean and variance:

Use when:

  • Fixed number of trials

  • Two outcomes per trial

  • Constant success probability

  • Independence across trials

Geometric distribution

Models the number of trials until the first success.

For , if on , then

Mean and variance:

Memoryless property:

Negative binomial distribution

Counts trials until the th success.

For an integer and , if is the trial count to obtain successes:

for

Poisson distribution

Models the number of events in a fixed interval when events occur independently at average rate .

For , if , then

for

Mean and variance:

Poisson is a common model for counts of rare events.

Hypergeometric distribution

Used for sampling without replacement from a finite population.

For integers and , if a population has items, successes, and we draw items without replacement, then

Mean:

Use hypergeometric instead of binomial when draws are dependent because the population is finite.


Common continuous distributions

Continuous distributions model measurements and waiting times.

Uniform distribution

For , if , then

Mean and variance:

Exponential distribution

Models waiting time to the first Poisson event.

For , if , then

CDF:

Mean and variance:

Memoryless property:

Normal distribution

If , then

Standardization:

The normal distribution is central to approximation and inference.

Gamma distribution

Gamma distributions model waiting times to multiple Poisson events.

If with shape and rate , then

Special cases:

  • Exponential distribution when

  • Chi-square distribution as a gamma special case

Beta distribution

The beta distribution is defined on and is often used for probabilities and proportions.

If , then

It is especially useful in Bayesian modeling.


Joint distributions and dependence

Many problems involve multiple random variables.

Joint distribution

For discrete variables and :

For continuous variables:

with probabilities obtained by double integration.

Marginal distributions

From the joint distribution, get the marginal of by summing or integrating out :

Discrete:

Continuous:

Conditional distributions

Discrete:

Continuous:

when the denominator is positive.

Independence of random variables

and are independent if their joint distribution factors:

Discrete:

Continuous:

Conditional expectation

Conditional expectation is the mean of a random variable after conditioning on information.

For a discrete conditioning event:

This quantity is itself a function of .

Conditional expectation is useful for:

  • Regression

  • Prediction

  • Decomposition of variance

Covariance matrix

For a vector of random variables, the covariance matrix records pairwise covariances:

The diagonal entries are variances.


Law of large numbers and central limit theorem

These limit theorems explain why averages become stable and why the normal distribution appears so often.

Law of large numbers

If are i.i.d. with mean , then the sample average

converges to as grows.

Interpretation:

  • More data usually means a more stable average

  • The sample mean should approach the true mean

Central limit theorem

If are i.i.d. with mean and variance , then for large ,

Equivalently,

This approximation is the foundation of much of statistical inference.

Standard error

The standard deviation of the sample mean is

This shrinks as increases.

Normal approximation to binomial

When is large and is not too close to 0 or 1, a binomial random variable can often be approximated by a normal distribution:

Use a continuity correction when appropriate.


Problem-solving workflow

Probability problems are usually easier if you identify the model before doing algebra.

Step 1: Define the experiment

Ask:

  • What is random?

  • What are the possible outcomes?

  • Is order important?

  • Are draws independent?

Step 2: Identify the event

Write the event clearly in words first, then in symbols.

Examples:

  • At least one success

  • Exactly two defects

  • The first success occurs on trial 4

  • Given that the test was positive

Step 3: Choose the right tool

Pick the simplest model:

  • Counting for finite equally likely spaces

  • Conditional probability for updated information

  • Binomial for fixed independent trials

  • Hypergeometric for sampling without replacement

  • Poisson for rare-event counts

  • Exponential for waiting times

  • Normal approximation for large-sample sums and averages

Step 4: Compute carefully

Useful tactics:

  • Use the complement when "at least one" is involved

  • Use partitions when information is grouped into cases

  • Use symmetry when outcomes are equivalent

  • Use linearity of expectation for sums of indicators

Step 5: Check the result

Verify:

  • Probability is between 0 and 1

  • Units make sense if the variable is continuous

  • Independence assumptions are justified

  • The answer matches the event description

Indicator variables

If is the indicator of event , then

and

Indicator variables are a powerful way to count expected numbers of events.


Formula sheet

Core rules

Bayes and total probability

Counting

Random variables

Discrete:

Continuous:

Expectation and variance

Discrete:

Continuous:

Variance:

Covariance:

Standard distributions

Bernoulli:

Binomial:

Geometric:

Poisson:

Exponential:

Normal:

Key moments

Bernoulli:

Binomial:

Poisson:

Exponential:

Uniform on :

Limit theorems

Sample mean:

Standard error:

CLT approximation:


Common mistakes to avoid

  • Confusing permutations with combinations.

  • Forgetting whether order matters.

  • Using the binomial model when sampling is without replacement from a small finite population.

  • Applying conditional probability as if events were independent.

  • Treating continuous variables like discrete ones, especially by assigning positive probability to a single point.

  • Forgetting to normalize a pdf or pmf.

  • Misusing Bayes' theorem by swapping and .

  • Ignoring the complement rule for "at least one" problems.

  • Assuming zero covariance implies independence.

  • Forgetting continuity corrections in normal approximations to discrete counts.


Quick reference for modeling

  • Use binomial for fixed independent trials with success probability .

  • Use hypergeometric for sampling without replacement.

  • Use Poisson for counts of rare events in time or space.

  • Use exponential for waiting times between Poisson events.

  • Use normal for sums, averages, and large-sample approximations.

  • Use Bayes' theorem when information is observed and beliefs must be updated.

Sources