Skip to main content
  1. Introduction
  2. Basic Terminology
  3. Types of Events
  4. Probability Rules
  5. Conditional Probability
  6. Law of Total Probability
  7. Bayes’ Theorem
  8. Random Variable
  9. Mean, Median, Mode
  10. Variance & Standard Deviation
  11. Probability Distributions
  12. Bernoulli Distribution
  13. Binomial Distribution
  14. Uniform Distribution
  15. Normal Distribution
  16. Poisson Distribution
  17. AI/ML Applications
  18. Formula Cheat Sheet

1. Introduction

Probability is a branch of mathematics that measures the likelihood of an event occurring. It answers questions like:
  • What is the chance of getting a Head?
  • What is the probability a customer buys a product?
  • What is the probability an email is spam?
In Machine Learning, probability helps in:
  • Classification
  • Prediction
  • Decision Making
  • Uncertainty Estimation
  • Bayesian Learning
Probability values lie between 0P(E)10 \le P(E) \le 1 where
  • 0 → Impossible event
  • 1 → Certain event

2. Basic Terminology

Experiment

An action that produces outcomes. Examples:
  • Tossing a coin
  • Rolling a die
  • Picking a card

Sample Space (S)

Set of all possible outcomes. Coin S=H,TS={H,T} Die S=1,2,3,4,5,6S={1,2,3,4,5,6}

Event (E)

A subset of the sample space. Example Rolling an even number E=2,4,6E={2,4,6}

Probability of an Event

P(E)=Number of favorable outcomesTotal outcomesP(E)=\frac{\text{Number of favorable outcomes}} {\text{Total outcomes}}

Example 1: Coin Toss

Sample Space H,T{H,T} Event Getting Head P(H)=12P(H)=\frac12
Output

Example 2: Roll a Die

Event Even number E=2,4,6E={2,4,6} P(E)=36=12P(E)=\frac36=\frac12

Example 3: Coin + Die

Event Head AND Even Number Total outcomes 2×6=122\times6=12 Favorable (H,2),(H,4),(H,6)(H,2),(H,4),(H,6) P(E)=312=14P(E)=\frac3{12}=\frac14

3. Types of Events

Simple Event

Contains one outcome. Example Getting 4 on a die.

Compound Event

Contains multiple outcomes. Example Getting an even number.

Certain Event

Always occurs. P(E)=1P(E)=1 Example Rolling a number less than 7.

Impossible Event

Never occurs. P(E)=0P(E)=0 Example Rolling 8 on a standard die.

Union of Events

“A or B” ABA\cup B Example Even OR Odd

Intersection of Events

“A and B” ABA\cap B Example Even AND Multiple of 3 Result 6{6}

Mutually Exclusive Events

Cannot occur together. AB=A\cap B=\varnothing Example Head and Tail in one coin toss.

Independent Events

One event does not affect another. Example Two coin tosses.

Dependent Events

One event affects another. Example Drawing cards without replacement.

4. Probability Rules

Rule 1: Complement Rule

Probability that an event does not occur. P(A)=1P(A)P(A')=1-P(A) Example P(Not Head)=112=12P(\text{Not Head})=1-\frac12=\frac12

Addition Rule

Mutually Exclusive

P(AB)=P(A)+P(B)P(A\cup B)=P(A)+P(B) Example Roll a die A = 2 B = 4 P(A)=16P(A)=\frac16 P(B)=16P(B)=\frac16 P(AB)=16+16=13P(A\cup B)=\frac16+\frac16=\frac13

Non-Mutually Exclusive

P(AB)=P(A)+P(B)P(AB)P(A\cup B)=P(A)+P(B)-P(A\cap B) Example A = Even B = Multiple of 3 A=2,4,6A={2,4,6} B=3,6B={3,6} Intersection 6{6} P(A)=36P(A)=\frac36 P(B)=26P(B)=\frac26 P(AB)=16P(A\cap B)=\frac16 P(AB)=36+2616=46=23P(A\cup B)=\frac36+\frac26-\frac16=\frac46=\frac23

Multiplication Rule

Independent

P(AB)=P(A)P(B)P(A\cap B)=P(A)P(B) Example Two coins P(HH)=12×12=14P(HH)=\frac12\times\frac12=\frac14

Dependent

P(AB)=P(A)P(BA)P(A\cap B)=P(A)P(B|A)

5. Conditional Probability

Probability of B given A occurred. P(BA)=P(AB)P(A)P(B|A)= \frac{P(A\cap B)} {P(A)} Example A = Even B = Multiple of 3 P(BA)=1/63/6=13P(B|A)=\frac{1/6}{3/6} =\frac13

6. Law of Total Probability

If A1,A2,...AnA_1,A_2,...A_n partition the sample space, then P(B)=iP(BAi)P(Ai)P(B)= \sum_i P(B|A_i)P(A_i) Used when probability comes from multiple possible cases. Example Medical diagnosis Different age groups contribute differently to disease probability.

7. Bayes’ Theorem

Used to update probabilities after observing evidence. P(AB)=P(BA)P(A)P(B)P(A|B)= \frac{P(B|A)P(A)} {P(B)} Where
  • (P(A)) = Prior
  • (P(B|A)) = Likelihood
  • (P(B)) = Evidence
  • (P(A|B)) = Posterior
Applications
  • Spam filtering
  • Medical diagnosis
  • Recommendation systems
  • Naive Bayes Classifier
Example Disease prevalence P(D)=0.01P(D)=0.01 Test accuracy P(+D)=0.99P(+|D)=0.99 False positive P(+Dˉ)=0.05P(+|\bar D)=0.05 Use Bayes’ theorem to compute P(D+)P(D|+)

8. Random Variable

A variable whose value depends on a random experiment.

Discrete Random Variable

Countable values. Example Number of Heads.

Continuous Random Variable

Infinite values. Example Height Weight Temperature

9. Mean, Median, Mode

Mean

Average value. μ=xn\mu= \frac{\sum x}{n}

Median

Middle value after sorting.

Mode

Most frequently occurring value.

10. Variance & Standard Deviation

Variance

Measures spread. Population σ2=(xμ)2N\sigma^2= \frac{\sum(x-\mu)^2} N Sample s2=(xxˉ)2n1s^2= \frac{\sum(x-\bar x)^2} {n-1}

Standard Deviation

Square root of variance. σ=σ2\sigma=\sqrt{\sigma^2} Higher SD ⇒ More spread. Lower SD ⇒ Less spread.

11. Probability Distribution

Describes how probabilities are assigned to values. Two types
  • Discrete Distribution
  • Continuous Distribution
Common distributions
  • Bernoulli
  • Binomial
  • Uniform
  • Normal
  • Poisson

12. Bernoulli Distribution

Single trial. Only two outcomes.
  • Success
  • Failure
Parameter pp Examples
  • Pass/Fail
  • Spam/Not Spam
  • Click/No Click
Mean pp Variance p(1p)p(1-p)

13. Binomial Distribution

Extension of Bernoulli. Conditions
  • Fixed number of trials
  • Independent trials
  • Same probability
Formula P(X=k)=(nk)pk(1p)nkP(X=k)= \binom nk p^k (1-p)^{n-k} Example Probability of exactly 3 Heads in 5 tosses. Applications
  • Customer conversions
  • Defect detection

14. Uniform Distribution

Every value is equally likely. PDF f(x)=1baf(x)= \frac1{b-a} Example Random number between 0 and 1. Applications
  • Random initialization
  • Simulation

15. Normal Distribution

Most important distribution in ML. Bell-shaped curve. Properties
  • Symmetric
  • Mean = Median = Mode
  • Area = 1
PDF f(x)=1σ2πe(xμ)22σ2f(x)= \frac1{\sigma\sqrt{2\pi}} e^{-\frac{(x-\mu)^2}{2\sigma^2}} 68-95-99.7 Rule
  • 68% within 1 SD
  • 95% within 2 SD
  • 99.7% within 3 SD
Applications
  • Gaussian Naive Bayes
  • Noise Modeling
  • Statistics
  • Data Normalization

16. Poisson Distribution

Models the number of events occurring in a fixed interval. Formula P(X=k)=eλλkk!P(X=k)= \frac{e^{-\lambda}\lambda^k} {k!} Applications
  • Calls per minute
  • Website hits
  • Machine failures
  • Customer arrivals

17. AI/ML Applications


18. Formula Cheat Sheet

Probability

P(E)=FavorableTotalP(E)=\frac{\text{Favorable}}{\text{Total}}

Complement

P(A)=1P(A)P(A')=1-P(A)

Addition Rule

P(AB)=P(A)+P(B)P(AB)P(A\cup B)=P(A)+P(B)-P(A\cap B)

Multiplication Rule

P(AB)=P(A)P(B)P(A\cap B)=P(A)P(B)

Conditional Probability

P(BA)=P(AB)P(A)P(B|A)= \frac{P(A\cap B)} {P(A)}

Total Probability

P(B)=P(BAi)P(Ai)P(B)=\sum P(B|A_i)P(A_i)

Bayes’ Theorem

P(AB)=P(BA)P(A)P(B)P(A|B)= \frac{P(B|A)P(A)} {P(B)}

Mean

μ=xn\mu=\frac{\sum x}{n}

Variance

σ2=(xμ)2N\sigma^2=\frac{\sum(x-\mu)^2}{N}

Standard Deviation

σ=σ2\sigma=\sqrt{\sigma^2}

Binomial Distribution

P(X=k)=(nk)pk(1p)nkP(X=k)= \binom nk p^k (1-p)^{n-k}

Uniform Distribution

f(x)=1baf(x)=\frac1{b-a}

Normal Distribution

f(x)=1σ2πe(xμ)22σ2f(x)= \frac1{\sigma\sqrt{2\pi}} e^{-\frac{(x-\mu)^2}{2\sigma^2}}

Poisson Distribution

P(X=k)=eλλkk!P(X=k)= \frac{e^{-\lambda}\lambda^k} {k!}

Key Takeaways

  • Probability measures uncertainty and ranges from 0 to 1.
  • Understand sample space, events, and probability rules before advanced topics.
  • Conditional Probability, Law of Total Probability, and Bayes’ Theorem are foundational for probabilistic ML.
  • Random variables describe outcomes numerically.
  • Mean, variance, and standard deviation summarize data.
  • The most important probability distributions for AI/ML are Bernoulli, Binomial, Uniform, Normal, and Poisson.
  • These concepts underpin algorithms such as Naive Bayes, Gaussian Models, Bayesian Networks, and many statistical learning methods.