All Probability Formulas in One Place - Guide for Probability Calculations

Rumman Ansari   Software Engineer   2023-02-23   102 Share
☰ Table of Contents

Table of Content:


All probability Formula in one place

Probability of an event: $$P(A) = \frac{n(A)}{n(S)}$$

Probability of the complement of an event: $$P(A^c) = 1 - P(A)$$

Probability of the union of two events: $$P(A \cup B) = P(A) + P(B) - P(A \cap B)$$

Probability of the intersection of two independent events: $$P(A \cap B) = P(A) \cdot P(B)$$

Probability of the intersection of two dependent events: $$P(A \cap B) = P(A) \cdot P(B|A)$$

Multiplication rule of probability: $$P(A \cap B) = P(A) \cdot P(B|A)$$

Addition rule of probability: $$P(A \cup B) = P(A) + P(B) - P(A \cap B)$$

Law of total probability: $$P(A) = \sum_{i=1}^n P(A|B_i) \cdot P(B_i)$$

Bayes' theorem: $$P(B_j|A) = \frac{P(A|B_j) \cdot P(B_j)}{\sum_{i=1}^n P(A|B_i) \cdot P(B_i)}$$

where $A$ and $B$ are events, $P(A)$ and $P(B)$ are the probabilities of events $A$ and $B$, respectively, $P(B|A)$ is the probability of event $B$ given that event $A$ has occurred, $n(A)$ is the number of outcomes in event $A$, $n(S)$ is the total number of outcomes, and $B_i$ are mutually exclusive and exhaustive events.

 

Conditional probability: $$P(A|B) = \frac{P(A \cap B)}{P(B)}$$

Multiplication rule of conditional probability: $$P(A \cap B) = P(B) \cdot P(A|B) = P(A) \cdot P(B|A)$$

Independent events: Two events $A$ and $B$ are independent if and only if $P(A \cap B) = P(A) \cdot P(B)$. If $A$ and $B$ are independent, then $P(B|A) = P(B)$ and $P(A|B) = P(A)$.

Bayes' theorem (rearranged): $$P(B_j|A) = \frac{P(A|B_j) \cdot P(B_j)}{\sum_{i=1}^n P(A|B_i) \cdot P(B_i)} = \frac{P(A|B_j) \cdot P(B_j)}{P(A)}$$

where $P(A)$ is the marginal probability of event $A$.

Expected value: The expected value (or mean) of a random variable $X$ is given by: $$E(X) = \sum_i x_i P(X=x_i)$$ where $x_i$ are the possible values of $X$ and $P(X=x_i)$ is the probability of $X$ taking on the value $x_i$.

Variance: The variance of a random variable $X$ is given by: $$Var(X) = E((X - \mu)^2) = \sum_i (x_i - \mu)^2 P(X=x_i)$$ where $\mu = E(X)$ is the expected value of $X$.

These are just a few of the many probability formulas out there, but they should cover most of the basics.

 

Law of total probability: Suppose $B_1, B_2, \ldots, B_n$ is a partition of the sample space $S$ (i.e., the $B_i$ are mutually exclusive and exhaustive), and let $A$ be any event. Then: $$P(A) = \sum_{i=1}^n P(A|B_i) \cdot P(B_i)$$

Complement rule: $$P(A^c) = 1 - P(A)$$

Addition rule: For any two events $A$ and $B$: $$P(A \cup B) = P(A) + P(B) - P(A \cap B)$$

Union bound: For any finite collection of events $A_1, A_2, \ldots, A_n$: $$P\left(\bigcup_{i=1}^n A_i\right) \leq \sum_{i=1}^n P(A_i)$$

Joint probability: The joint probability of two events $A$ and $B$ is given by: $$P(A \cap B)$$

Marginal probability: The marginal probability of an event $A$ is the sum of the joint probabilities of $A$ and all other events $B$ that could occur simultaneously with $A$: $$P(A) = \sum_{B} P(A \cap B)$$

 

Conditional probability: The conditional probability of event $A$ given event $B$ is: $$P(A|B) = \frac{P(A \cap B)}{P(B)}$$

Multiplication rule: For any two events $A$ and $B$: $$P(A \cap B) = P(B|A) \cdot P(A) = P(A|B) \cdot P(B)$$

Bayes' theorem: Bayes' theorem provides a way to calculate the conditional probability of an event $A$ given an observed event $B$: $$P(A|B) = \frac{P(B|A) \cdot P(A)}{P(B)}$$

Expected value: The expected value of a random variable $X$ is given by: $$E(X) = \sum_{x} x \cdot P(X = x)$$

Variance: The variance of a random variable $X$ is given by: $$Var(X) = E[(X - \mu)^2] = \sum_{x} (x - \mu)^2 \cdot P(X = x)$$ where $\mu = E(X)$.

Standard deviation: The standard deviation of a random variable $X$ is the square root of its variance: $$\sigma = \sqrt{Var(X)}$$

Covariance: The covariance between two random variables $X$ and $Y$ is given by: $$Cov(X,Y) = E[(X - \mu_X)(Y - \mu_Y)] = E(XY) - E(X)E(Y)$$ where $\mu_X = E(X)$ and $\mu_Y = E(Y)$.

Correlation coefficient: The correlation coefficient between two random variables $X$ and $Y$ is given by: $$\rho_{X,Y} = \frac{Cov(X,Y)}{\sigma_X \sigma_Y}$$ where $\sigma_X$ and $\sigma_Y$ are the standard deviations of $X$ and $Y$, respectively.

Bernoulli distribution: The Bernoulli distribution models the probability of a binary outcome, such as success or failure, with parameter $p$: $$P(X = 1) = p, \quad P(X = 0) = 1-p$$

Binomial distribution: The binomial distribution models the number of successes in a fixed number of independent Bernoulli trials, with parameters $n$ and $p$: $$P(X = k) = {n \choose k} p^k (1-p)^{n-k}$$

Poisson distribution: The Poisson distribution models the number of rare events that occur in a fixed amount of time or space, with parameter $\lambda$: $$P(X = k) = \frac{\lambda^k e^{-\lambda}}{k!}$$

 

Geometric distribution: The geometric distribution models the number of trials it takes to achieve the first success in a sequence of independent Bernoulli trials, with parameter $p$: $$P(X = k) = (1-p)^{k-1}p$$

Hypergeometric distribution: The hypergeometric distribution models the number of successes in a sample of size $n$ drawn without replacement from a population of size $N$ containing $K$ successes, with parameters $n$, $N$, and $K$: $$P(X = k) = \frac{{K \choose k} {N-K \choose n-k}}{{N \choose n}}$$

Normal distribution: The normal distribution is a continuous distribution with a bell-shaped curve, defined by its mean $\mu$ and standard deviation $\sigma$: $$f(x) = \frac{1}{\sigma \sqrt{2\pi}}e^{-\frac{(x-\mu)^2}{2\sigma^2}}$$

Central limit theorem: The central limit theorem states that the sample mean $\bar{X}$ of a large number of independent and identically distributed random variables approaches a normal distribution with mean $\mu$ and standard deviation $\frac{\sigma}{\sqrt{n}}$ as the sample size $n$ approaches infinity.

 

Exponential distribution: The exponential distribution models the time between rare events occurring in a Poisson process with rate parameter $\lambda$: $$f(x) = \begin{cases} \lambda e^{-\lambda x}, & \text{if } x \geq 0 \ 0, & \text{otherwise} \end{cases}$$

Uniform distribution: The uniform distribution models a continuous random variable that is equally likely to take on any value within a certain range $[a, b]$: $$f(x) = \begin{cases} \frac{1}{b-a}, & \text{if } a \leq x \leq b \ 0, & \text{otherwise} \end{cases}$$

Conditional probability: The conditional probability of an event $A$ given that an event $B$ has occurred is: $$P(A | B) = \frac{P(A \cap B)}{P(B)}$$

Law of total probability: The law of total probability states that if $B_1, B_2, \ldots, B_n$ are mutually exclusive and exhaustive events, then for any event $A$, we have: $$P(A) = \sum_{i=1}^n P(B_i)P(A | B_i)$$

 

Bayes' theorem: Bayes' theorem is a formula for computing conditional probabilities. It states that for any two events $A$ and $B$ with positive probabilities, we have: $$P(A | B) = \frac{P(B | A)P(A)}{P(B)}$$

Variance and standard deviation: The variance of a random variable $X$ is defined as: $$Var(X) = E[(X - E[X])^2]$$ The standard deviation of $X$ is the square root of its variance: $$\sigma_X = \sqrt{Var(X)}$$

Covariance and correlation: The covariance between two random variables $X$ and $Y$ is defined as: $$Cov(X,Y) = E[(X - E[X])(Y - E[Y])]$$ The correlation between $X$ and $Y$ is defined as: $$\rho_{X,Y} = \frac{Cov(X,Y)}{\sigma_X \sigma_Y}$$