Descriptive Statistics, Probability, and Random Variables
Prerequisite Knowledge
This lecture revises and consolidates concepts from the entire first module. If any feel unfamiliar, review the linked notes before proceeding.
Previously Covered in This Subject
- Data Types and Measures of Central Tendency — covered in Lecture 1
- Measures of Variability, Dispersion, and Basic Probability — covered in Lecture 2
- Conditional Probability and Total Probability — covered in Lecture 3
- Bayes Theorem — covered in Lecture 4
- Naive Bayes, Laplace Smoothing, and Random Variables — covered in Lecture 5
- Discrete and Continuous Distributions, Expectation, Variance — covered in Lecture 6
- Joint, Marginal, Conditional Distributions and Named Distributions — covered in Lecture 7
- Normal Distribution and Normal Approximation to Binomial — covered in Lecture 8
Descriptive Statistics, Probability, and Random Variables — Pre-Exam Revision
This session consolidates the entire first module of the course into a single revision lecture. The instructor walks through every major topic — from data types and descriptive statistics through probability, random variables, and the key distributions — with an eye on what will appear in the exam. The emphasis throughout is on pattern recognition: how to look at a problem and immediately know which concept and which formula to deploy.
9.1 Data Types — Numerical and Categorical
Hook. You look at a dataset. Before you compute a single thing, you need to answer one question: what kind of numbers (or labels) am I holding? Pick the wrong type and every downstream calculation is suspect. Pick the right type and the whole analysis flows naturally.
9.1.1 Definition and Explanation
Intuition. Think of data like items in a grocery store. Some items have a price tag — you can add them, average them, compare them. Those are numerical. Other items have a color label — "red," "green," "organic." You cannot add colors, but you can count how many of each. Those are categorical.
Every variable falls into one of two families: numerical and categorical.
Numerical data is numbers you can do arithmetic on. It splits into two sub-types:
- Discrete — values you can count. Number of students, number of defective items. These are whole numbers; nothing lives between 3 and 4 students.
- Continuous — values you can measure. Height, weight, temperature. Any value in an interval is possible. You can be 172.3 cm tall.
Categorical data is labels, names, or groups. Colors, gender, letter grades, yes/no answers. For the exam, the main skill is: given a variable description, classify it as quantitative or qualitative, numerical or categorical, discrete or continuous.
Worked example — classify these variables.
| Variable | Type |
|---|---|
| Number of cars in a parking lot | Discrete numerical |
| Temperature in Celsius | Continuous numerical |
| Blood type (A, B, AB, O) | Categorical |
| Number of defective bolts in a batch | Discrete numerical |
| Time to complete a race | Continuous numerical |
| Letter grade (A, B, C, D, F) | Categorical |
Sense-check: Counts are always discrete. Measurements are always continuous. Labels are always categorical.
Scope. This classification matters because it determines which statistics you can compute. You cannot compute a meaningful mean of blood types. You cannot list "all possible heights" one by one. The type of the variable constrains every tool downstream.
Visual intuition. Imagine a number line. Discrete data sits as isolated dots at integer positions — you can point to each one. Continuous data fills an entire segment — the dots merge into a solid line. Categorical data does not live on the number line at all; it lives in named bins.
Pitfalls.
- "Numbers are always numerical." False. A zip code is a number but you would never average zip codes. It is categorical in disguise. Ask: does arithmetic on this number make sense?
- "Continuous means infinite." Not exactly. Continuous means any value in a range is possible, not that the range itself is infinite.
- Converting categorical to numerical. You can always encode "red" = 1, "green" = 2, "blue" = 3 — but the numbers are just labels. Do not treat them as meaningful quantities unless the encoding preserves order.
A variable's type — discrete numerical, continuous numerical, or categorical — is the first decision you make in any data analysis. If it is a count, it is discrete. If it is a measurement, it is continuous. If it is a label, it is categorical.
Real-world connection. Every machine learning pipeline begins with this classification. Libraries like pandas infer data types automatically, but the decisions they make — treating zip codes as integers, for example — are exactly the kind of mistakes a human analyst must catch.
9.1.2 Student Questions and Answers
Q: How do we differentiate between discrete and continuous?
A: Discrete means countable — you can list the possible values one by one. Continuous means measurable — any value in a range. If the variable answers "how many?" it is discrete. If it answers "how much?" it is continuous.
Q: For a given example, how do we identify what kind of variable it is?
A: Look at what the variable represents. A count (students, defects) → discrete numerical. A measurement (height, temperature, time) → continuous numerical. A label or category (color, gender, grade) → categorical.
9.2 Measures of Central Tendency — Mean, Median, Mode
Hook. You have a pile of numbers. Where is the center? The answer depends on what you mean by "center" — and picking the wrong one can make your data lie to you.
9.2.1 Definition and Explanation
Intuition. Think of three friends splitting a restaurant bill. The mean is what each pays if they split equally. The median is what the person in the middle pays if they line up by spending. The mode is the most common dish ordered. Same group, three different "centers."
Where the analogy breaks: Unlike the restaurant bill where the mean is always fair, in data with extreme outliers (one friend ordered lobster and champagne), the median is fairer than the mean.
Three numbers summarize where the center of your data lies:
- Mean — the arithmetic average. Add all values and divide by the count. Notation: for population, for sample.
- Median — the positional center. Sort the data in ascending order. The value standing in the middle is the median. If two values share the middle, average them. The median is always unique.
- Mode — the most frequent value. Count occurrences — the one appearing most is the mode. Unlike mean and median, mode can have multiple values (bimodal, multimodal).
Formal definitions. For a dataset :
where denotes the -th value after sorting.
9.2.2 How to Compute
Worked example. Dataset:
- Mean:
- Median: Sort → . (odd), middle position = 4th →
- Mode: 8 appears three times, more than any other value →
Sense-check: Mean (6) = Median (6) ≠Mode (8). They are not all equal, so this dataset is not symmetric. More on that in §9.3.
9.2.3 When to Use Which
Scope & Assumptions.
- Use mean when the data is symmetric and has no extreme outliers. The mean uses every data point — that is both its strength and its weakness.
- Use median when the data is skewed or has outliers. The median resists extreme values because it only cares about position, not magnitude.
- Use mode when you care about the most typical case — or when the data is categorical (you cannot compute a meaningful mean of "red, blue, blue, green").
Visual intuition. Picture a histogram. The mean is the balance point — if the histogram were made of solid blocks, the mean is where you would place a fulcrum to balance it. The median splits the area exactly in half — 50% of the area lies to the left, 50% to the right. The mode is the tallest bar.
Pitfalls.
- Outliers hijack the mean. Add one billionaire to a room of 50 people and the mean income skyrockets — but the median barely moves. Always check both.
- Mode is not always unique. Bimodal data often signals two underlying groups mixed together. Do not just report one mode when two exist.
- "Average" is ambiguous. In everyday English, "average" usually means mean. In statistics, be precise: mean, median, or mode?
Mean, median, and mode are three different ways to say "center." Mean uses every value, median uses only the middle position, mode uses only frequency. Pick based on your data shape and what question you are answering.
Real-world connection. Government agencies report median household income, not mean, precisely because income distributions are right-skewed — the mean would be misleadingly high. Meteorologists report mean temperature because daily temperatures are roughly symmetric. Retailers care about the mode — the most popular size or color.
9.2.4 Student Questions and Answers
Q: When mode has two values (bimodal), how do we check symmetry?
A: You cannot conclude symmetry when there are two modes. Symmetry requires mean = median = mode, all equal. With two mode values this condition breaks — there is no averaging of modes. Bimodal data cannot be called symmetric by the three-center test.
Q: In the five-point summary, are we calculating the same range as max minus min?
A: No — range (max - min) and IQR (Q3 - Q1) are different. Range uses the extremes; IQR uses the middle 50%. The question will specify which one to compute.
9.3 Symmetry and Skewness — The Three-Center Relationship
Hook. You have computed the mean, median, and mode. They are three different numbers. That gap is not random — it is telling you exactly which way your data leans.
9.3.1 Definition and Explanation
Intuition. Imagine a seesaw. A symmetric dataset is balanced — the fulcrum (mean), the middle child (median), and the heaviest child (mode) all sit at the same point. A skewed dataset is like putting a heavier child on one end — the fulcrum has to shift toward the heavy side to balance, pulling the mean away from the median.
Where the analogy breaks: In the seesaw, weight shifts the balance. In data, it is the long tail of extreme values that pulls the mean.
The relationship between mean, median, and mode tells you whether data is symmetric:
- Symmetric: mean = median = mode. All three centers coincide. Think bell-shaped curve.
- Right-skewed (positively skewed): mean > median > mode. The tail stretches right, pulling the mean upward.
- Left-skewed (negatively skewed): mean < median < mode. The tail stretches left, pulling the mean downward.
To check symmetry for a dataset: compute mean, median, and mode. If all three are equal, the data is symmetric. Otherwise, it is not.
Worked example — salary data. A company has salaries (in thousands): 30, 35, 35, 40, 40, 40, 45, 45, 200.
- Mean = (30+35+35+40+40+40+45+45+200) / 9 = 510/9 ≈ 56.67
- Sorted: 30, 35, 35, 40, 40, 40, 45, 45, 200. Median (5th) = 40
- Mode = 40 (appears three times)
Mean (56.67) > Median (40) = Mode (40). This is right-skewed. The one high earner (200) pulls the mean up but does not touch the median or mode.
Sense-check: Remove the 200 and recompute: mean = 38.75, median = 40, mode = 40. Now mean < median ≈ mode → near-symmetric. The outlier was the entire cause of the skew.
Visual intuition. Draw a histogram. Right-skewed: a tall peak on the left, a long thin tail trailing to the right. The mean sits to the right of the peak, dragged by the tail. Left-skewed: the mirror image — tall peak on the right, tail to the left, mean pulled left of the peak.
Pitfalls.
- Bimodal data breaks the three-center symmetry test. With two modes, the condition mean = median = mode cannot hold. This does not mean the data is skewed — it means the test does not apply.
- Small samples can be misleading. With 5 data points, random noise can make mean ≠median even if the population is perfectly symmetric. The test works best with larger datasets.
- Skew direction is about the tail, not the peak. Right-skewed means the tail goes right — even though the "hump" is on the left.
Mean > Median = Mode → right-skewed. Mean < Median = Mode → left-skewed. All three equal → symmetric. This is the fastest diagnostic for data shape — compute all three before any deeper analysis.
Real-world connection. Income distributions are almost always right-skewed (a few very high earners). Exam scores can be left-skewed if the test is easy (most score high, a few score low). Symmetric distributions are rare in the wild but common in controlled manufacturing processes and natural measurements like adult heights.
9.3.2 Student Questions and Answers
Q: How can we say data is symmetric?
A: Find mean, median, and mode. If all three are equal — mean = 40, median = 40, mode = 40 — then the data is symmetric. Otherwise, it is not. That is the full test.
9.4 Variance and Standard Deviation — Measuring Spread
Hook. Two classes both have an average score of 75. One class has everyone scoring between 70 and 80. The other has scores from 30 to 100. Same center, completely different story. You need a number that captures that spread.
9.4.1 Definition and Explanation
Intuition. Think of darts on a dartboard. The mean is where the darts cluster on average — maybe near the bullseye, maybe off to the side. Variance is how far the darts scatter from that center. Low variance = tight grouping. High variance = darts everywhere.
Why square the deviations? If you just averaged the raw deviations , positives and negatives would cancel out to zero — every time. Squaring makes all deviations positive, so the spread does not cancel itself. Then the square root (standard deviation) brings the units back to the original scale.
- Variance — the average squared deviation from the mean. It measures spread in squared units.
- Standard deviation — the positive square root of variance. It brings the measure back to the original units. A standard deviation of 5 cm means a typical data point is about 5 cm from the mean.
9.4.2 Population vs. Sample — N vs. N-1
Use N (population denominator) when you have the entire dataset — all records, nothing sampled.
Use N-1 (sample denominator) when the problem explicitly says a sample was taken from a larger population. The N-1 correction (Bessel's correction) compensates for the fact that a sample tends to underestimate the population variance — the sample mean is "too close" to the sample data.
If nothing is mentioned about sampling, assume population and use N.
Scope. The N vs. N-1 decision is about what you are measuring, not how many data points you have. A dataset of 5 values that represents the entire population still uses N. A dataset of 500 values drawn from a population of millions uses N-1. The count alone does not decide — the problem's wording does.
Worked example. Dataset: 2, 4, 6, 8, 10 (entire population, N=5)
- Mean:
- Deviations: 2-6=-4, 4-6=-2, 6-6=0, 8-6=2, 10-6=4
- Squared deviations: 16, 4, 0, 4, 16
- Variance:
- Standard deviation:
Sense-check: The data spans from 2 to 10 (range = 8). A standard deviation of 2.83 is reasonable — it is about a third of the range. If you got 80, you forgot to divide by N. If you got 0, you forgot to square.
Visual intuition. On a number line, draw the mean at the center. Standard deviation is like a ruler that marks "one typical step away." In a bell-shaped (normal) distribution, about 68% of data falls within one standard deviation of the mean, and about 95% within two.
Pitfalls.
- Forgetting to square the deviations. Sum of raw deviations is always zero. You must square first.
- Forgetting the square root. Variance is in squared units (cm²). Standard deviation is in original units (cm). Report standard deviation when communicating spread to humans.
- Mixing up N and N-1. The exam problem will tell you if it is a sample. Read carefully. If silent, use N.
- Variance is never negative. If you get a negative variance, you made an arithmetic error — squared values cannot sum to negative.
Variance = average squared distance from the mean. Standard deviation = square root of that, back in original units. Use N for population, N-1 for sample. The question wording decides which.
Real-world connection. In finance, standard deviation is called volatility — it measures how wildly a stock price swings. In manufacturing, it is used in Six Sigma quality control — "six sigma" means the specification limits are six standard deviations wide, corresponding to 3.4 defects per million.
9.4.3 Student Questions and Answers
Q: When do we use N-1 instead of N?
A: Use N-1 when it is a sample. Use N when it is the entire population. If nothing is mentioned, use N — treat it as population.
Q: Is there a rule like "if data points are less than 15 or 30, use sample"?
A: No, there is no such fixed threshold. It depends entirely on whether the problem states it is a sample or a population. The count alone does not decide — the problem's wording does.
Q: For exam problems with temperature or height data, should we use N or N-1?
A: The type of data (temperature, height) does not matter. Only whether the problem says it is a sample. If no mention of sample, use N.
Q: Can we use calculators in the exam?
A: Check the exam instructions email. Normally calculators are allowed. It lists which types are permitted.
9.5 Range, IQR, and Quartile Deviation
Hook. Variance and standard deviation are great — but sometimes you need a simpler, faster measure of spread. Something you can compute in your head from a sorted list.
9.5.1 Definition and Explanation
Intuition. The range is like measuring a room by only looking at the two farthest-apart walls. Quick, but one oddly placed pillar ruins everything. The IQR is like measuring the middle section of the room — ignoring the far corners entirely. More stable, less dramatic.
- Range = maximum - minimum. When sorted, . Simplest spread measure — but extremely sensitive to outliers.
- Interquartile Range (IQR) = Q3 - Q1. Spread of the middle 50% of the data. resistant to outliers because it ignores the top and bottom 25%.
- Quartile Deviation (QD) = IQR / 2. Also called the semi-interquartile range.
Worked example. Dataset: 3, 7, 8, 10, 12, 15, 100
Sorted: 3, 7, 8, 10, 12, 15, 100
- Range = 100 - 3 = 97
- Q1 (median of lower half: 3, 7, 8) = 7; Q3 (median of upper half: 12, 15, 100) = 15
- IQR = 15 - 7 = 8
- QD = 8 / 2 = 4
Sense-check: Range = 97 is huge because of the outlier 100. IQR = 8 tells a truer story — the middle 50% is tightly packed. This is exactly why IQR exists.
Scope. Range uses only two values (min and max), so it throws away almost all information. IQR uses the middle 50%, so it throws away the extremes. Neither captures shape the way variance does — they are quick diagnostics, not full summaries.
Visual intuition. On a sorted number line, the range spans from the leftmost to rightmost point. The IQR spans from the 25th percentile marker to the 75th — a shorter bar nested inside the range. In a box plot, the box is the IQR, and the whiskers extend to min and max (or to the fence boundaries if outliers exist).
Pitfalls.
- Range and IQR are not interchangeable. A question may ask for one specifically. Read carefully.
- QD is rarely used in practice but may appear in exam questions. It is just IQR ÷ 2 — nothing more.
Range = max - min (fast but fragile). IQR = Q3 - Q1 (resistant to outliers). QD = IQR / 2. For skewed data, always prefer IQR over range.
Real-world connection. IQR is the foundation of the box plot, one of the most widely used visualization tools in exploratory data analysis. Financial analysts use IQR to detect anomalous trading days without being fooled by a single flash crash.
9.5.2 Student Questions and Answers
Q: What is QD?
A: Quartile deviation — it is IQR divided by 2. .
9.6 Five-Point Summary
Hook. If you could only report five numbers to describe an entire dataset, which five would you pick? The five-point summary is the canonical answer — it gives you the skeleton of any distribution.
9.6.1 Definition and Explanation
Intuition. Think of the five-point summary as the "skeleton" of your data. The min and max are the feet and head. Q1 and Q3 are the shoulders. Q2 (the median) is the heart. Stretch or compress any part and you change the shape. Together they give you the complete frame.
The five-point summary gives a complete skeletal picture of a dataset:
- Minimum — the smallest value (after sorting in increasing order)
- Q1 — the first quartile (25th percentile)
- Q2 — the second quartile, which is the median (50th percentile)
- Q3 — the third quartile (75th percentile)
- Maximum — the largest value
Always put the data in increasing order first. Then read off: the start is the min, the end is the max, the middle is Q2, the middle of the lower half is Q1, the middle of the upper half is Q3.
Worked example. Dataset: 12, 18, 5, 22, 7, 15, 30, 9, 25
- Sort: 5, 7, 9, 12, 15, 18, 22, 25, 30
- Min = 5, Max = 30
- N = 9 (odd). Q2 (median, 5th position) = 15
- Lower half (excl. median): 5, 7, 9, 12. Q1 = (7+9)/2 = 8
- Upper half (excl. median): 18, 22, 25, 30. Q3 = (22+25)/2 = 23.5
Five-point summary: {5, 8, 15, 23.5, 30}
Sense-check: IQR = 23.5 - 8 = 15.5. Lower fence = 8 - 1.5×15.5 = -15.25. Upper fence = 23.5 + 1.5×15.5 = 46.75. No outliers — all values in [5, 30].
Visual intuition. The five-point summary maps directly to a box plot: the box spans Q1 to Q3, the line inside is Q2, and the whiskers reach to min and max (or to the fences).
Pitfalls.
- Forgetting to sort. If you pick min, max, and median from unsorted data, everything is wrong.
- Q1/Q3 ambiguity with odd N. Two approaches exist: include the median in both halves or exclude it. Both are acceptable in this course. Pick one and be consistent.
The five-point summary — {min, Q1, median, Q3, max} — is the irreducible skeleton of any dataset. From it you can compute range, IQR, detect outliers, and sketch the distribution shape.
Real-world connection. Box plots built from the five-point summary are standard in clinical trial reports, where you need to compare treatment groups at a glance — median response, spread, and extreme cases all in one graphic.
9.6.2 Student Questions and Answers
Q: For odd number of items, when calculating Q1, should we include the median in the first half?
A: Two approaches were discussed in class. Both are acceptable. Either include the median in both halves when computing Q1 and Q3, or exclude it and compute from the lower and upper halves separately. Either approach will be accepted. Refer to the solved problems from class.
9.7 Outlier Detection Using IQR
Hook. One data point can wreck your mean, inflate your variance, and mislead every conclusion. How do you decide — objectively — that a value is "too far" to trust? The IQR method gives you a rule, not a gut feeling.
9.7.1 Definition and Explanation
Intuition. Imagine a fence around the middle 50% of your data, with a 1.5× safety margin. Anything inside the fence is "normal." Anything outside is flagged as unusual. The factor 1.5 is convention — it is wide enough to avoid false alarms but tight enough to catch real anomalies.
Outliers are data points far from the bulk of the data. The IQR method defines objective fences:
Any data point below the lower bound or above the upper bound is an outlier.
9.7.2 Procedure
Procedure and worked example. Dataset: 5, 7, 8, 10, 12, 15, 35
- Sort: 5, 7, 8, 10, 12, 15, 35
- Find Q1 and Q3: Q1 = 7, Q3 = 15
- Compute IQR: IQR = 15 - 7 = 8
- Lower bound: 7 - 1.5 × 8 = 7 - 12 = -5
- Upper bound: 15 + 1.5 × 8 = 15 + 12 = 27
- Check: All values from 5 to 35. 35 > 27 → 35 is an outlier.
Sense-check: 35 is far from the pack of 5—15. The method agrees with intuition. If we remove 35, the mean drops from ~13.1 to ~9.5 — a big shift that confirms the outlier's influence.
Visual intuition. Picture a box plot. The box is Q1 to Q3. The whiskers extend to the most extreme non-outlier values. Outliers appear as individual dots beyond the whiskers. The fences (Q1-1.5×IQR and Q3+1.5×IQR) are where the whiskers stop.
Scope & Assumptions.
- The 1.5×IQR rule is a convention, not a theorem. It works well for roughly symmetric, unimodal data. For heavily skewed data, consider the adjusted box plot (which uses the medcouple or a different constant).
- Outliers are not automatically errors. They may be genuine extreme values worth investigating. The fence only flags them — it does not say to delete them.
Pitfalls.
- "Outlier = wrong data." An outlier might be the most interesting observation in the dataset — a genuine discovery, not a mistake.
- Computing fences before sorting. You need Q1 and Q3, which require sorted data. Sort first, always.
- Forgetting the 1.5 factor. It is 1.5 × IQR, not 1 × IQR. Using 1× would flag too many normal points.
The IQR outlier test: lower fence = Q1 - 1.5×IQR, upper fence = Q3 + 1.5×IQR. Points outside these fences are outliers. Sort first, compute IQR, then check each point.
Real-world connection. The IQR outlier method is built into every statistical software package. In manufacturing, it triggers alerts on production lines when a measurement falls outside the fences — flagging a potential machine fault in real time.
9.8 Probability Fundamentals
Hook. You are dealt two cards. What is the chance at least one is an ace? Probability gives you the language to answer this — and four simple formulas cover most of what you will ever need.
9.8.1 Key Formulas and Concepts
Intuition. Think of probability space as a dartboard. The whole board is the sample space S (probability = 1). Event A is one colored region. Event B is another. The overlapping part is A∩B — the region where both colors mix. The combined colored area is A∪B.
Analogy mapping: The dartboard is S. Throwing a dart is the experiment. Where it lands is the outcome. The probability of landing in region A is P(A) = area(A) / area(S).
Four formulas cover most of basic probability:
- General addition rule:
- Complement rule:
- Mutually exclusive events: If , then . The intersection term drops out.
- Independent events: . The intersection is the product.
9.8.2 Mutually Exclusive vs. Independent
This is the most confused pair in probability:
- Mutually exclusive — the two events cannot happen together. . Example: drawing a card that is both a heart and a spade. Impossible.
- Independent — knowing one event happened gives no information about the other. . Example: getting heads on coin first flip tells you nothing about second flip.
They are different concepts. Mutually exclusive events are dependent — if A happens, you know B did NOT happen. That is strong information.
9.8.3 The Venn Diagram Approach
Visual intuition. Draw a rectangle (sample space S). Inside, draw two overlapping circles (events A and B).
- = the lens-shaped overlap — both happen.
- = everything inside either circle — at least one happens.
- "At least" in probability always means union.
- The region outside both circles = = neither happens.
Instead of memorizing formulas, draw this picture. The areas tell you exactly what to add and subtract.
9.8.4 When to Add vs. When to Multiply
- Add for union (or): "A or B happens" → . If mutually exclusive, the intersection is zero — just add.
- Multiply for intersection (and) when events are independent: .
Worked example — cards. Draw one card from a standard 52-card deck.
- P(Heart) = 13/52 = 1/4
- P(King) = 4/52 = 1/13
- P(Heart AND King) = P(King of Hearts) = 1/52
- P(Heart OR King) = P(H) + P(K) - P(H∩K) = 13/52 + 4/52 - 1/52 = 16/52 = 4/13
Sense-check: There are 13 hearts + 3 more kings (spade, club, diamond) = 16 favorable cards out of 52. 16/52 = 4/13. The formula and counting agree.
Pitfalls.
- Adding probabilities without checking for overlap. If events are not mutually exclusive and you just add, you double-count the intersection.
- Assuming independence without justification. "Draw two cards without replacement" → the draws are dependent (the deck changes). Do NOT multiply blindly.
- Confusing P(A∩B) = 0 (mutually exclusive) with P(A∩B) = P(A)P(B) (independent). If A and B are mutually exclusive AND both have positive probability, they cannot be independent.
Add for union (OR), subtract the overlap. Multiply for intersection (AND) only when independent. Draw a Venn diagram when stuck — the picture never lies.
Real-world connection. These four formulas are the backbone of risk assessment. Insurance companies compute P(claim OR late payment). Medical researchers compute P(disease AND positive test). All of it reduces to these four rules.
9.8.5 Student Questions and Answers
Several students asked about the add-vs-multiply distinction.
Q: When to add probabilities and when to multiply them?
A: Add for union (A or B). The general formula is . If mutually exclusive, the intersection is zero → pure addition. Multiply for intersection when events are independent: .
9.9 Conditional Probability
Hook. You hear it might rain today. That changes the probability you will carry an umbrella. Conditional probability is the math of updating beliefs when new information arrives.
9.9.1 Definition
Intuition. You are at a party. 30% of guests are engineers. But among people wearing glasses, 60% are engineers. The condition "wears glasses" narrowed the world — you are now only looking at a subset. Conditional probability formalizes this narrowing.
Analogy: P(B|A) reads "probability of B given that A happened." You shrink the sample space from the whole room to just the A-corner. Then ask: within that corner, what fraction is also B?
The probability of B given that A has happened:
The first event (the "given") goes in the denominator. Both events together go in the numerator.
Similarly:
Worked example. In a class of 100 students, 40 are male and 60 are female. 10 males and 15 females wear glasses.
- P(Glasses | Male) = 10/40 = 0.25
- P(Glasses | Female) = 15/60 = 0.25
- P(Male | Glasses) = 10/25 = 0.40
Sense-check: P(G|M) = P(G|F) = 0.25 means glasses-wearing is independent of gender here. But P(M|G) = 0.40 — not 0.50 — because fewer males wear glasses relative to the overall glasses-wearing group.
Pitfalls.
- Reversing the condition. P(A|B) ≠P(B|A) in general. "Probability of disease given positive test" is not the same as "probability of positive test given disease." Confusing these is the prosecutor's fallacy.
- Denominator must be > 0. You cannot condition on an impossible event. If P(A) = 0, then P(B|A) is undefined.
Conditional probability shrinks the world to the "given" event. Denominator = probability of the condition. Numerator = probability of both happening. Never swap condition and outcome without using Bayes theorem.
Real-world connection. Conditional probability is the engine behind every recommendation system. "Given that you watched Movie X, what is the probability you will like Movie Y?" — that is P(like Y | watched X). Every "Customers who bought this also bought…" banner is conditional probability in action.
9.9.2 Student Questions and Answers
Q: How to read the notation — "P of B given A"?
A: A is the first event (the condition), so P(A) is the denominator. Both A and B in the intersection go in the numerator. For , B is first so P(B) is the denominator.
9.10 Total Probability and Bayes Theorem
Hook. A machine makes a defective item. Which of two production lines is most likely responsible? You cannot see which line it came from — you only see the defect. Bayes theorem reverses the probability: from "P(defect | machine)" to "P(machine | defect)." This is how evidence updates belief.
9.10.1 The Tree Diagram Approach
Intuition. Picture a river splitting into two streams (Machine A and Machine B). Each stream carries a certain flow (probability). Within each stream, some water is "clean" and some is "polluted" (defective). At the end, all water mixes in a lake. You scoop a cup of polluted water from the lake. Which stream did it most likely come from? The tree diagram traces every possible path from source to cup.
Analogy mapping: The two streams are preliminary events (A, B). The pollution is the secondary event (D). Each path's flow = P(stream) × P(polluted | stream). The total pollution in the lake = sum of all polluted paths. The fraction from stream A = (stream A's polluted path) / (total pollution).
The tree diagram unifies total probability and Bayes theorem:
- Identify preliminary events — these partition the whole sample space. Their probabilities must sum to 1.
- From each preliminary event, branch to the secondary event B. Each branch carries .
- Each complete path probability: .
- Total probability: .
- Bayes theorem: . Numerator = the specific path. Denominator = sum of all paths.
9.10.2 Worked Example — Defective Items from Two Machines
Setup:
- Machine A produces 40%:
- Machine B produces 60%:
- Machine A defective rate: 9/1000
- Machine B defective rate: 1/250 = 4/1000
Step 1 — Total probability (item is defective):
Step 2 — Bayes (defective item came from A):
Sense-check: P(A|D) + P(B|D) = 0.60 + 0.40 = 1.00 &one0003;. Even though A produces fewer items (40%), it is responsible for 60% of defects because its defect rate (0.009) is higher than B's (0.004).
9.10.3 Worked Example — Colorblindness and Gender
Setup:
- Assume equal numbers:
Total probability of colorblindness:
Bayes — colorblind person is male:
Sense-check: Almost 95% chance the colorblind person is male. Intuition confirms this — colorblindness is far more common in men. The math quantifies "far more common."
Scope & Assumptions.
- Preliminary events must partition the sample space (sum to 1) and be mutually exclusive.
- The prior probabilities must be known or assumed. Without them, Bayes theorem cannot be applied.
- The result is only as good as the priors. If you assume 50/50 male/female but the actual population is 60/40, the answer changes — see the Q&A below.
Visual intuition. The tree diagram IS your visual. Draw two first-level branches (A and B) with their prior probabilities. From each, branch to D and not-D with conditional probabilities. The path probabilities are at the leaves. Total P(D) = sum of D leaves. Bayes = one D leaf / sum of all D leaves.
Pitfalls.
- Using Bayes when total probability is asked. If the question is "what is the probability the item is defective?" — stop at Step 1. No Bayes needed.
- Using total probability when Bayes is asked. If it says "given the item is defective, what is the probability it came from A?" — you need the full calculation, denominator included.
- Forgetting the denominator. The denominator for all Bayes calculations in a given problem is the same P(B). Compute it once and reuse.
- Dropping the prior. Without P(A) and P(B), Bayes is impossible. If not given, state your assumption.
Total probability = sum of all path probabilities. Bayes = (one specific path) / (sum of all paths). Same denominator for all Bayes computations. Draw the tree — it makes both mechanical.
Real-world connection. Bayes theorem powers spam filters, medical diagnosis, forensic DNA analysis, and machine learning classification. Every time your email client decides "this looks like spam," it is applying Bayes theorem with the words as evidence and spam/not-spam as the preliminary events.
9.10.4 Student Questions and Answers
Q: About the male/female colorblind problem — why is the assumption "equal numbers" needed?
A: Without it, the problem is incomplete. You need and to use Bayes theorem. If not given, the data is not enough — note that. State your assumption if you make one.
Several students asked about how prior changes affect the answer.
Q: If we assume 60% male, 40% female, would the answer change?
A: Yes. The assumption drives the result. That is why the problem gave it explicitly: "assume males and females are equal in numbers." With 60/40: P(C) = 0.60×0.05 + 0.40×0.0025 = 0.031. P(M|C) = 0.03/0.031 ≈ 0.968.
Several students asked about when to use which method.
Q: How do we know a problem needs total probability vs. Bayes theorem?
A: If the question asks "what is the probability of the secondary event (defective, colorblind)?" — total probability only. If it asks "given the secondary event happened, what is the probability it came from a specific preliminary event?" — Bayes theorem. Bayes = total probability in the denominator + a specific path in the numerator.
Q: Will marks be deducted if we use the tree diagram instead of formulas?
A: The tree diagram is enough — it shows your understanding. There is no restriction on using formulas vs. diagrams. Write what you know.
9.11 Discrete Random Variables
Hook. You roll two dice. The sum is a random variable — you do not know what it will be, but you know exactly what values it can take and how likely each one is. That table of values and probabilities is a discrete probability distribution.
9.11.1 Definition and Explanation
Intuition. A random variable is a number that depends on chance. Think of it as the output of an experiment before you run it. A discrete random variable has a list of possible outputs you can count: 0, 1, 2, 3, ... — like the number of heads in 10 coin flips.
Analogy: Your score on a multiple-choice test where you guess every answer. Before taking the test, your score is a random variable. The probability distribution tells you: P(score = 0) = ?, P(score = 1) = ?, and so on.
A discrete random variable X takes values you can count. Its probability distribution gives the probability for each possible x. Two requirements:
9.11.2 The Standard Problem Pattern
For exam problems, expect this pattern:
- Given: A table or expression like for x = 1, 2, 3.
- Find the constant (K): . Solve for K.
- Find the mean: .
- Find the variance: , where — square only x, not the probability.
- Find probabilities: , , etc. Pick relevant x values and sum.
9.11.3 Worked Example — Sum of Two Dice
Setup: X = sum of two unbiased dice. Each die has faces 1-6 equally likely.
Step 1 — Build the probability distribution:
| X | Combinations | Count | P(X=x) |
|---|---|---|---|
| 2 | (1,1) | 1 | 1/36 |
| 3 | (1,2),(2,1) | 2 | 2/36 |
| 4 | (1,3),(2,2),(3,1) | 3 | 3/36 |
| 5 | (1,4),(2,3),(3,2),(4,1) | 4 | 4/36 |
| 6 | (1,5),(2,4),(3,3),(4,2),(5,1) | 5 | 5/36 |
| 7 | (1,6),(2,5),(3,4),(4,3),(5,2),(6,1) | 6 | 6/36 |
| 8 | (2,6),(3,5),(4,4),(5,3),(6,2) | 5 | 5/36 |
| 9 | (3,6),(4,5),(5,4),(6,3) | 4 | 4/36 |
| 10 | (4,6),(5,5),(6,4) | 3 | 3/36 |
| 11 | (5,6),(6,5) | 2 | 2/36 |
| 12 | (6,6) | 1 | 1/36 |
Verification: &one0003;
Step 2 — Answer probability questions:
Step 3 — Mean (expectation):
Step 4 — Variance:
Sense-check: The mean of 7 makes sense — it is the most likely sum (probability 6/36). The variance of ~5.83 means the typical squared deviation from 7 is about 5.83, so typical deviation is — reasonable for a range of 2 to 12.
Pitfalls.
- Computing and stopping. The variance is NOT . You must subtract . This is the single most common mistake on exams.
- Squaring the probability. In , square only x, not P(X=x).
- Forgetting that probabilities sum to 1. This is your error check — if they do not sum to 1, you miscounted something.
For a discrete RV: find K via sum=1, compute E[X] by multiplying each value by its probability and summing, compute Var(X) via . Do NOT forget the subtraction step.
Real-world connection. Discrete random variables model everything countable: number of customers arriving per hour, number of defective items per batch, number of clicks on an ad per day. The sum-of-two-dice distribution is the simplest non-trivial example — understanding it fully means you understand the whole framework.
9.11.4 Student Questions and Answers
Q: What does "unbiased" mean?
A: Unbiased means all outcomes are equally likely. A fair coin: P(head) = P(tail) = 0.5. A biased coin: P(head) = 0.3, P(tail) = 0.7. Unless stated otherwise, assume unbiased — equal probabilities.
Q: For sum = 4, there are 3 combinations but (2,2) appears once — why is that just one count?
A: (2,2) is a single outcome — both dice show 2. (1,3) and (3,1) are two different outcomes because the dice are distinguishable. Total: 3 ways to get sum 4.
Q: Can we use the complement shortcut for probability calculations?
A: Yes. For , compute directly or use . Use whichever is smarter for the given problem.
Several students asked about the scope of this topic.
Q: Which concept do K-value, mean, and variance calculations belong to?
A: These are all under "discrete random variable." The topics are: finding unknown constants from total probability = 1, computing expectation (mean), computing variance via , and computing probabilities for ranges of X.
9.12 Continuous Random Variables
Hook. Not everything is countable. Temperature, time, weight — these can be any value in a range. You cannot list "all possible temperatures" one by one. Continuous random variables handle this with integration instead of summation.
9.12.1 Definition and Explanation
Intuition. A discrete distribution is like a bucket of numbered balls — you can pick one up and read its number. A continuous distribution is like a ribbon of infinitely many points — you cannot pick a point; you can only ask "what fraction of the ribbon lies between here and there?"
Analogy: Think of probability as mass. In the discrete case, mass sits at isolated points (like coins on a table). In the continuous case, mass is smeared continuously (like butter on toast). The density at a point tells you how thickly the butter is spread there — but the amount of butter at a single point is zero. To get a meaningful amount, you need a region.
A continuous random variable takes any value in an interval. Instead of a probability mass function, we use a probability density function (PDF) . Probabilities are found by integration:
Two requirements:
The key difference from discrete: replace summation with integration .
9.12.2 The Standard Problem Pattern
- Find the unknown constant (a, c, k): . Split at breakpoints for piecewise functions.
- Find the mean: over the domain.
- Find the variance: , where .
- Find probabilities: . Split if a or b falls inside different pieces.
9.12.3 How to Identify Discrete vs. Continuous
Look at the range given. If the range is a continuous interval like or , it is continuous. If the range is discrete values like x = 1, 2, 3, it is discrete.
9.12.4 Worked Example — Piecewise PDF
Given:
Task 1 — Find a:
The total area under the PDF must equal 1. Split into three intervals:
First integral:
Second integral:
Third integral:
So for the third integral.
Total: , so .
Verification: The integration is correct. yields total area 1. If , total area would be , which violates the PDF requirement. The value is confirmed.
Task 2 — Find :
Split at x = 1 (where the PDF changes):
Task 3 — : Only the last piece matters:
The upper limit is 3 (end of domain), lower is 2.5. Only one piece — no splitting.
Sense-check: . Since the PDF is symmetric-looking (line up, flat, line down), half the area by x=1.5 is plausible.
9.12.5 Worked Example — Simple PDF
Given:
Task 1 — Find c:
So .
Task 2 — Find mean:
Task 3 — Find variance:
Sense-check: Mean = 1 is the center of the interval [0,2]. Variance = 0.2 is small — the shape concentrates mass near the center.
9.12.6 Summary — Discrete vs. Continuous
| Operation | Discrete | Continuous |
|---|---|---|
| Find constant (K/C) | ||
| Mean | ||
| Variance | ||
| Probability | Sum over x values | Integrate over interval |
The variance formula is identical for both — only how you compute and changes (sum vs. integral).
Scope & Assumptions.
- Integration bounds: for and , integrate over the full domain where f(x) > 0. Where f(x) = 0, the contribution is zero — you can shorten the limits.
- Piecewise functions: split the integral at every breakpoint. Do NOT integrate across a breakpoint with a single formula.
- The PDF value f(x) can exceed 1 — unlike a discrete probability. It is the area that is a probability and must be ≤ 1.
Visual intuition. Imagine the PDF as a smooth curve above the x-axis. The total area under the curve = 1. The probability between a and b is the area under that segment. The mean is the balance point of the shape. The variance measures how spread out the shape is.
Pitfalls.
- Treating f(x) as a probability. f(x) is a density, not a probability. P(X = x) = 0 for any single point in a continuous distribution. Only intervals have non-zero probability.
- Forgetting to split integrals for piecewise functions. If the PDF changes formula at x = 1, you must integrate [0,1] and [1,∞) separately.
- Infinite bounds in the general formula vs. effective domain. is the formal statement, but you only integrate where f(x) > 0.
- Dropping the subtraction in variance. Same trap as discrete — Var(X) ≠E[X²].
Continuous RVs: sum → integral, P(X=x) → f(x)dx. Find constant via ∫f = 1. Mean via ∫x·f. Variance via ∫x²·f - (mean)². Split integrals at every breakpoint of a piecewise function.
Real-world connection. Continuous distributions model virtually every physical measurement: the normal distribution for heights and IQ scores, the exponential distribution for waiting times and component lifetimes, the uniform distribution for random number generation. The piecewise PDF example above is a triangular distribution — used in project management (PERT) to model task completion times when you have an optimistic, most-likely, and pessimistic estimate.
9.12.7 Student Questions and Answers
Q: How do we identify whether a problem is discrete or continuous?
A: Look at the range. A continuous interval (0 ≤ x ≤ 3 or 0 < x < 2) → continuous. Discrete values listed (x = 1, 2, 3, ...) → discrete.
Q: How does integration with upper and lower limits work?
A: For , find antiderivative G(x), then compute G(b) - G(a). Upper limit minus lower limit. For piecewise functions, do each piece separately.
Q: Why does become ?
A: Because f(x) = 0 for x < 0 (outside the defined domain). The PDF is only non-zero on its stated interval. Zero contribution from the tail — ignore it.
Q: Will we get complex integrals like sine or cosine?
A: Mostly no. The integrals will be simple polynomials like . If something complex appears, do as much as you can and leave it.
Q: What does "dx" mean?
A: dx is notation — it tells you the variable of integration is x. The integral of with respect to x is .
9.13 Binomial Distribution
Hook. You flip a coin 8 times. What is the chance of exactly 3 heads? What about at least 5 heads? The binomial distribution answers these counting-of-successes questions with a single formula — and the complement trick saves you from summing seven terms.
9.13.1 Definition
Intuition. Think of a factory testing 8 light bulbs. Each bulb either works (success) or fails (failure). The bulbs are independent — one failing does not change the chance another fails. The total number of working bulbs is a binomial random variable.
Analogy: Flipping a coin N times and counting heads. Each flip is a Bernoulli trial — success (heads) with probability P, failure (tails) with probability Q = 1-P. The number of heads across N flips is Binomial(N, P).
The binomial distribution models the number of successes in N independent trials, each with success probability P. X takes values 0, 1, 2, ..., N.
Key parameters:
- N = number of trials
- P = probability of success on each trial
- Q = 1 - P = probability of failure
Formula:
Mean:
Variance: . The standard deviation is .
9.13.2 Worked Example — Finding N and P from Mean and Variance
Given: A binomial distribution has mean = 4 and variance = 2. Find:
- P(at least 2 successes)
- P(at most 2 successes)
Step 1 — Find P and Q:
Divide:
Check: Q ∈ [0,1] &one0003;. (If dividing the other way gave 2, that is impossible — a built-in error check.)
Step 2 — Find N:
Now: N = 8, P = 1/2, Q = 1/2.
Step 3 — P(at least 2):
"At least 2" = X ≥ 2. Complement approach:
Step 4 — P(at most 2):
"At most 2" = X ≤ 2:
Sense-check: P(X ≥ 2) + P(X ≤ 1) = 247/256 + 9/256 = 1 &one0003;. The results are complements.
Scope & Assumptions.
- Trials must be independent. Drawing cards without replacement violates independence — use hypergeometric instead.
- Each trial has the same success probability P. If P changes (e.g., learning effect), binomial does not apply.
- N is fixed in advance, not random.
Visual intuition. For N=8, P=0.5, the probability histogram is symmetric — tallest at x=4, tapering to both ends. For P ≠0.5, the histogram skews toward the more likely side.
Pitfalls.
- Direct sum vs. complement. Computing P(X ≥ 2) directly requires 7 terms. Using complement requires only 2. Always choose the shorter path.
- X ranges from 0 to N, not 1 to N. If N=8, there are 9 possible values (0 through 8). Forgetting 0 shifts everything.
- Confusing N (trials) with number of possible X values (N+1). In binomial, X ∈ {0, 1, ..., N}.
- Variance is NPQ, not √(NPQ). Standard deviation is √(NPQ). Do not confuse them.
Binomial(N, P): mean = NP, variance = NPQ. Use complement (1 - P(X < k)) to minimize computation. X ranges 0 to N. Verify Q ∈ [0,1] as a sanity check.
Real-world connection. Binomial models appear everywhere: quality control (N items tested, X defective), clinical trials (N patients, X respond to treatment), election polling (N surveyed, X support candidate A), A/B testing (N visitors, X click).
9.13.3 Student Questions and Answers
Several students asked about the language of inequalities.
Q: "At least two" — what does this mean in mathematical notation?
A: At least 2 means ≥ 2. Think: "at least 35 marks to pass" means 35 or more. So X ≥ 2.
Q: "At most two" — what does this mean?
A: At most 2 means ≤ 2. Think: "at most 8 hours in the office" means 8 hours maximum. So X ≤ 2.
Q: Why does X go from 0 to 8 for the binomial with N=8?
A: In binomial, X takes values 0, 1, 2, ..., N. With N = 8 trials, you can have 0 to 8 successes. That is 9 possible values — N+1 outcomes for N trials.
Q: Is the same as 8C2?
A: Yes. . Different notations, same thing.
Q: How do you compute quickly?
A: . For : . Cancel the 6! in the full formula.
Q: What is ? What is ?
A: Anything raised to power 0 equals 1. So . This is why P(0) simplifies cleanly.
9.14 Poisson Distribution
Hook. Your factory produces 2000 items a day, and the defect rate is 0.001. You want the probability of exactly 3 defects. Computing binomial with N=2000 is painful. The Poisson distribution gives you a shockingly simple approximation — one parameter, one formula, done.
9.14.1 When to Use Poisson
Intuition. The binomial counts successes in a fixed number of trials. But when N is huge and P is tiny, the binomial becomes unwieldy — you are multiplying 2000-factor combinations by tiny powers. The Poisson steps in and says: "All that matters is the average number of successes, λ = NP. Let me handle the rest."
Analogy: Counting raindrops hitting a sidewalk square. You cannot count the trials (every possible drop location), but you can count the successes (actual drops that land). The Poisson models rare events in a large population.
Use the Poisson distribution when:
- N is large (e.g., 2000)
- P is small (e.g., 0.001)
- The product λ = NP is moderate (typically λ < 10)
The Poisson approximates the binomial in these cases. The parameter λ (lambda) = NP — it is both the mean and the variance.
Formula:
9.14.2 Formula
9.14.3 Worked Example
Given: N = 2000, P = 0.001. Find P(exactly 3 successes).
λ = NP = 2000 × 0.001 = 2.
With a calculator: , so .
Sense-check: With binomial: . The Poisson approximation is extremely close and infinitely easier.
Scope.
- Use Poisson when N > 100 and NP < 10 (approximate rule of thumb).
- For NP large (say > 15), the normal approximation to the binomial is better — covered in a later topic.
- The Poisson also models events directly: number of calls to a call center per hour, number of earthquakes per year — no explicit N or P needed, just the rate λ.
Pitfalls.
- Using Poisson when N is moderate and P is not small. Poisson approximates binomial only when P is tiny. For N=20, P=0.3, use binomial directly.
- Forgetting that Poisson has ONE parameter. λ defines the entire distribution — mean = λ, variance = λ. Do not try to specify them separately.
- Using Poisson when the events are not independent. If one defect makes another more likely, Poisson does not apply.
Poisson = binomial shortcut for large N, tiny P. λ = NP. Formula: . Mean = variance = λ. If you cannot compute , leave the expression — the setup matters most.
Real-world connection. The Poisson distribution was discovered by Siméon Denis Poisson while studying wrongful convictions in French courts. Today it models: call center arrivals, website hits per minute, radioactive decay counts, disease incidence in epidemiology, and insurance claims per year.
9.14.4 Student Questions and Answers
Several students asked about the decision rule.
Q: How do we know to use Poisson vs. Binomial?
A: When N is large (> 100) and P is very small (NP < 10), use Poisson. When N is moderate and P is not extreme, use Binomial. The problem gives a clue: large N with a tiny probability → Poisson.
Q: What is the condition for using normal approximation instead?
A: For normal approximation, you need NP > 15 and NPQ > 15 (or similar thresholds). That comes later. For now: large N + tiny P → Poisson; moderate N + moderate P → Binomial.
9.15 Joint Probability Distributions
Hook. You have two random variables that move together. Height and weight. Study time and exam score. The joint distribution captures their combined behavior — and from it, you can extract each variable's solo story (marginals) and answer compound questions like "what is the chance both are high?"
9.15.1 Definition
Intuition. A joint distribution is like a spreadsheet. Rows are values of X, columns are values of Y. Each cell holds the probability of that specific (X,Y) pair. Summing a row collapses away Y — you get the marginal distribution of X. Summing a column collapses away X — you get the marginal of Y.
Analogy: A survey of 100 people asks age group (X: youth, adult, senior) and coffee preference (Y: black, latte, cappuccino). The joint table is 3×3. Sum each row = age distribution. Sum each column = drink preference. Reading cell (adult, latte) = joint. P(latte | adult) = the cell divided by the adult row total.
When two random variables X and Y are studied together, their combined behavior is a joint probability distribution — a table of for all combinations.
- Marginal of X: Sum joint probabilities across all Y for each X. Row sums.
- Marginal of Y: Sum joint probabilities across all X for each Y. Column sums.
- Joint probability: Read directly from a cell.
- Conditional: . Numerator from joint table, denominator from marginal.
9.15.2 Key Concepts
9.15.3 Worked Example
Consider a joint distribution: X ∈ {0, 1, 2}, Y ∈ {1, 2, 3, 4, 5, 6}. The combined table has 3 rows × 6 columns.
Marginal of X: For X=0, sum row 0 → P(X=0). For X=1, sum row 1 → P(X=1). For X=2, sum row 2 → P(X=2).
Marginal of Y: For Y=1, sum column 1 → P(Y=1). Similarly for Y=2,...,6.
Answering questions from the table:
- : From marginal X: P(X=0) + P(X=1).
- : From marginal Y: P(Y=1) + P(Y=2) + P(Y=3).
- : From the joint table — 2 rows (X=0,1) × 3 columns (Y=1,2,3). Sum all 6 cells. The comma means "and."
- : Check every cell: (0,1),(0,2),(0,3),(0,4),(1,1),(1,2),(1,3),(2,1),(2,2). Sum those 9 cells.
- : . Same numerator, denominator from marginal Y.
- : . Same numerator, denominator from marginal X.
Sense-check: The two conditional probabilities have the same numerator but different denominators. They are generally different numbers — the condition matters.
Visual intuition. The joint table is a grid. Marginal distributions are the row and column totals written in the margins (so the name). Conditional probability shrinks the grid to a sub-table and renormalizes by dividing by the subtotal.
Pitfalls.
- Marginal of X = row sums, marginal of Y = column sums. Do not swap them.
- Comma means "and" (intersection). is the probability both conditions hold simultaneously — not the union.
- Finding unknown K: Sum ALL cells in the joint table = 1, solve for K. Same principle as the single-variable case.
- Conditional probability has the SAME numerator, different denominators. If you already computed the joint sub-table total, reuse it.
Joint table → row sums = marginal X, column sums = marginal Y. Conditional probability = joint sub-table total / marginal total. The comma means AND. Sum all cells = 1 to find unknown constants.
Real-world connection. Joint distributions are the foundation of multivariate statistics. Credit scoring models use joint distributions of income and debt. Medical diagnosis uses joint distributions of symptoms and diseases. Marketing analytics uses joint distributions of demographics and purchase behavior.
9.15.4 Student Questions and Answers
Q: In the joint table, does the comma mean "and"?
A: Yes. means X ≤ 1 AND Y ≤ 3 — the intersection.
Q: How do we compute the marginal for Y — are we adding columns?
A: Yes. Marginal of Y: sum each column (fixed Y, all X). Marginal of X: sum each row (fixed X, all Y). Rows → X. Columns → Y.
Q: For , how do we find the combinations?
A: Check every cell. If x + y ≤ 4, include it. X=0: Y=1,2,3,4. X=1: Y=1,2,3. X=2: Y=1,2. Sum those 9 cells.
Q: What if the joint table has an unknown constant K?
A: Sum ALL cells, set equal to 1, solve for K — same as single-variable case.
9.16 Normal Distribution
Hook. Among all probability distributions, one rules them all: the bell curve. Heights, IQ scores, measurement errors — they all follow the normal distribution. And once you learn the Z-score trick, every normal problem reduces to looking up one table.
9.16.1 Overview
Intuition. The normal distribution is nature's default. When many small independent effects add up, the result is about normal — this is the Central Limit Theorem, the most important result in statistics.
Analogy: Drop a handful of rice grains onto a table. Each grain bounces independently, left or right. The pile that forms is bell-shaped — most grains cluster near the center, fewer reach the edges. That is the normal distribution emerging from pure randomness.
The normal distribution was covered in the previous session. Key points for the exam:
- Convert any normal to standard normal (Z-score): .
- Use the Z-table to find probabilities.
- The table should be provided in the exam. Without it, exact probabilities cannot be computed — so it must be given.
9.16.2 Exam Guidance
Exam note: If the Z-table is not provided with the question, write the steps (standardize, set up the integral/area) and note that the table is needed for the final value. Work up to the point where the table is required. The normal distribution is among the easiest topics if the table is available.
Visual intuition. The normal curve is symmetric and bell-shaped. The mean μ is the center. The standard deviation σ controls the width. The Z-score measures "how many standard deviations from the mean." Z = 0 at the center, Z = 1 at one SD to the right, Z = -2 at two SDs to the left. The 68-95-99.7 rule: 68% within ±1σ, 95% within ±2σ, 99.7% within ±3σ.
Pitfalls.
- Using the Z-table without standardizing. You cannot look up P(X < 70) directly. You must compute Z = (70-μ)/σ first.
- Reading the wrong side of the table. Some tables give area to the left of Z, some to the right. Check which one you have.
Z = (X - μ)/σ turns any normal into standard normal. Then use the table. Without the table, write the setup and move on — partial credit for the steps.
Real-world connection. The normal distribution underpins quality control (Six Sigma), financial risk modeling (Value at Risk), medical reference ranges ("normal" blood pressure), educational testing (SAT scores), and virtually every field that uses statistical inference.
9.17 Naive Bayes and Laplace Smoothing
Hook. Your email client decides "this is spam" before you even see it. How? It applies Bayes theorem to every word in the message — but with a clever twist called "naive" independence and a smoothing trick that prevents total confidence in zero counts.
9.17.1 Overview
Intuition. Naive Bayes is a detective that only looks at one clue at a time. For spam detection: "The word 'lottery' appears. Given that, what is the probability this is spam?" It checks every word independently — so "naive" — and multiplies the evidence together. The final probability decides: spam or not spam.
Analogy: You are trying to guess whether a restaurant is Italian or Chinese. You peek at individual ingredients: pasta → likely Italian, soy sauce → likely Chinese, garlic → could be either. Naive Bayes checks each ingredient independently (ignoring that pasta and tomato sauce tend to appear together) and combines the clues.
Naive Bayes classification:
- Split data by class (e.g., spam vs. not spam).
- Count word frequencies within each class.
- Compute conditional probabilities for each word given the class.
- Use Bayes theorem to classify new documents: multiply P(word|class) across all words, multiply by prior P(class), and pick the class with the higher score.
9.17.2 Laplace Smoothing
When a word never appears in a class, the raw probability is 0 / denominator. Multiplying by zero wipes out all other evidence — one unseen word kills the classification. Smoothing prevents this.
Simple smoothing: add 1 to numerator and 1 to denominator. So becomes . This is mathematically valid and prevents zero probabilities.
In text classification, a refined version adds the total vocabulary size to the denominator. For this course's statistical context, the basic +1/+1 approach is acceptable.
Pitfalls.
- Zero probabilities without smoothing. If P(word|spam) = 0 for any word, the entire product becomes 0. Smoothing is not optional — it is required.
- The "naive" assumption is usually false. Words are not independent ("New" and "York" appear together). But Naive Bayes works surprisingly well despite this — often outperforming more sophisticated models on small datasets.
Naive Bayes = Bayes theorem + naive independence assumption. Laplace smoothing = add +1 to numerator and denominator to avoid zeros. For this course, the basic +1/+1 smoothing is enough.
Real-world connection. Naive Bayes is one of the oldest and still most widely used classifiers. It powers spam filters (Gmail, Outlook), sentiment analysis, document categorization, and recommendation systems. Despite its simplicity, it often beats deep learning on small text datasets.
9.17.3 Student Questions and Answers
Q: In Naive Bayes, when doing Laplace smoothing, do we add 1 to numerator, denominator, or total number of features?
A: For statistical smoothing, add +1 to both numerator and denominator. The ML-specific version (adding vocabulary size) is a refinement for text data. For this course, the basic +1/+1 approach is fine — call it "smoothing" rather than "Laplace smoothing" to avoid confusion.
Q: Does adding 1 to the denominator give a different result than adding vocabulary size?
A: Yes, numerically different. But for this course's statistical context, the simple +1/+1 approach is fine. Write down which approach you are using.
9.18 Key Computational Patterns — At-a-Glance Summary
This section is your exam quick-reference. Every pattern here maps to at least one exam question. Know these tables cold and you can solve the mechanical half of the paper in minutes.
9.18.1 Finding Unknown Constants
| Context | Method |
|---|---|
| Discrete RV (table with K) | |
| Continuous RV (PDF with a, c) | |
| Joint distribution (table with K) | Sum all joint probabilities = 1 |
9.18.2 Finding Mean and Variance
| Context | Mean | Variance | |
|---|---|---|---|
| Discrete | |||
| Continuous | |||
| Binomial | NP | — | NPQ |
9.18.3 Probability Keywords Translation
| Phrase | Mathematical Meaning |
|---|---|
| "At least k" | |
| "At most k" | |
| "More than k" | |
| "Less than k" | |
| "Exactly k" | |
| "Between a and b (strict)" | |
| "A or B" | (union) |
| "A and B" | (intersection) |
| "A given B" | (conditional) |
Common trap. "At least 2" means 2 or more → X ≥ 2. "More than 2" means strictly greater → X > 2 (so 3 or more). These are different. Read the wording precisely.
9.19 Exam Guidance Summary
9.19.1 Topic Distribution and Question Patterns
This pre-exam revision session covers the entire first module — descriptive statistics through random variables and basic probability distributions.
Exam note — likely question types.
- Given a dataset, compute mean, median, mode, and check symmetry.
- Given a dataset, produce the five-point summary, compute IQR, find outliers.
- Given a probability scenario (machines, gender, dice), apply total probability and Bayes theorem.
- Given a discrete RV (table or expression), find the constant, mean, variance, and specific probabilities.
- Given a continuous RV (PDF), find the constant via integration, compute mean, variance, and probabilities.
- Given binomial parameters (possibly via mean/variance), compute binomial probabilities using complement shortcuts.
- Given N and P suggesting Poisson, compute Poisson probabilities.
- Given a joint probability table, find marginals, joint probabilities, and conditional probabilities.
- Normal distribution problems require the Z-table — it should be provided.
9.19.2 Study Advice
- Most topics are straightforward if you understand the core patterns (see §9.18).
- Spend 5—10 minutes reviewing Naive Bayes and 5—10 minutes on normal distribution from the previous session.
- The tree diagram approach makes total probability and Bayes theorem mechanical — no need to memorize formulas.
- For variance: do NOT forget to subtract after computing . This is the single most common mistake on exams.
- For integration: the integrals will be simple polynomials. If a complex one appears, work up to the point you can and move on.
- For binomial: use the complement shortcut — — to save computation.
- Practice identifying which concept a problem belongs to. The problem won't tell you "use Bayes theorem" — you must recognize the pattern from the wording.
9.19.3 Calculator Policy
Calculators are normally allowed. Check the exam instructions email for which types are permitted.
9.19.4 Presentation Advice
Exam note — how to present your work.
- Write all assumptions explicitly (e.g., "assuming equal probability for male/female").
- The tree diagram is enough for Bayes theorem problems — you do not need to write raw formulas.
- Show your work step by step. Partial credit matters.
- If you cannot complete a computation (e.g., no Z-table, no calculator for ), write the setup and the substitution — leave the final arithmetic.
9.20 Key Industry Applications
- Defect analysis in manufacturing: Bayes theorem identifies which production line is most likely responsible for a defective item — exactly the two-machine example pattern from §9.10.2. Manufacturing plants use this daily to allocate maintenance resources.
- Medical testing: The colorblindness example (§9.10.3) mirrors diagnostic testing. Given a positive test result and knowing the test's accuracy and the disease's base rate, Bayes theorem computes the probability the patient actually has the condition. This is the core math behind every screening program.
- Spam classification: Naive Bayes (§9.17) is a foundational text classification algorithm. Despite neural networks dominating NLP, Naive Bayes remains in production at major email providers because it is fast, interpretable, and requires minimal training data.
- Quality control: Binomial and Poisson distributions model defect counts in manufacturing batches. A factory producing 2000 items with a known defect rate uses Poisson to set acceptable quality limits and trigger inspections when defect counts exceed thresholds.
- Risk assessment: Joint probability tables model dependent risks — used in insurance (probability of both auto and home claims), finance (correlated asset defaults), and reliability engineering (probability of multiple component failures).
Every concept in this lecture maps to a real industrial application. Bayes theorem → manufacturing and medicine. Descriptive statistics → quality control. Random variables → risk modeling. These are not academic exercises — they are the mathematical backbone of modern industry.
ISM Lecture 9 notes · Descriptive Statistics, Probability, and Random Variables
Sections Breakdown
How to classify variables as discrete numerical, continuous numerical, or categorical
Definition, computation, and when to use each measure of center
Using mean, median, and mode to detect skewness direction
Computing population and sample variance with N vs N-1
Simpler measures of spread and their robustness to outliers
The irreducible skeleton of any dataset: min, Q1, Q2, Q3, max
The 1.5×IQR fence method for objective outlier detection
Four key formulas: addition rule, complement rule, mutually exclusive, independent events
Updating probabilities given new information; P(B|A) = P(A∩B)/P(A)
Tree diagram approach unifying total probability and reverse probability
Finding constants, expectation, and variance for discrete probability distributions
PDFs, integration for constants/mean/variance, piecewise functions
Counting successes in N trials; mean = NP, variance = NPQ
Approximating binomial for large N, small P; λ = NP
Two-variable tables, marginal distributions, conditional from joint
Z-score standardization and using the Z-table
Conditional independence assumption and +1 smoothing to avoid zeros
Quick-reference tables for constants, means, variances, and keyword translation
Topic distribution, likely question types, and presentation advice
Real-world applications in manufacturing, medicine, spam filtering, QC, and risk assessment
Exam Revision Notes
Below is the distilled, exam-ready core of this lecture. Every entry is built from the full textbook notes above. Use this section for rapid review — but if something doesn't make sense, go back to the full explanation in the main content.
Data Types
Must-know: Every variable is discrete numerical (countable), continuous numerical (measurable), or categorical (a label). This classification is the first decision in any analysis — pick the wrong type and every downstream statistic is suspect.
None — this is a classification skill, not a formula.
Warning: Top pitfall: Treating numbers that are really labels as numerical. A zip code is a number but you cannot average zip codes. Always ask: does arithmetic on this number make sense?
Self-check: Is "number of cars in a parking lot" discrete or continuous? Why?
Connects to: All downstream descriptive statistics depend on correct data type classification.
Mean, Median, and Mode
Must-know: Mean is the arithmetic average (uses every value), median is the positional middle (resists outliers), mode is the most frequent value. For skewed data, median is more representative than mean.
Warning: Top pitfall: Forgetting to sort before finding the median. The median is a position-based measure — unsorted data gives a wrong answer.
Self-check: Your dataset is {4, 8, 6, 5, 8, 3, 8}. What are the mean, median, and mode?
Connects to: Symmetry and skewness uses all three centers together.
Symmetry and Skewness
Must-know: Mean = Median = Mode implies symmetry. Mean > Median > Mode implies right-skewed. Mean < Median < Mode implies left-skewed. The direction of skew is where the tail stretches.
None — this is a relationship test between the three centers.
Warning: Top pitfall: Applying the three-center test to bimodal data. With two modes, the condition cannot hold — this does not mean the data is skewed, it means the test does not apply.
Self-check: Given salaries: 30, 35, 35, 40, 40, 40, 45, 45, 200. Is this symmetric, right-skewed, or left-skewed?
Connects to: Outliers cause skew by pulling the mean away from median and mode.
Variance and Standard Deviation
Must-know: Variance = average squared deviation from mean. Standard deviation = √(variance), back in original units. Use N for population, N-1 for sample. Var(X) = E[X²] - (E[X])² — never forget the subtraction.
Warning: Top pitfall: Forgetting to square the deviations (sum of raw deviations is always zero). Also: computing E[X²] and stopping — you MUST subtract (E[X])² to get variance.
Self-check: Data: 2, 4, 6, 8, 10 (population). What is the variance?
Connects to: Standard deviation connects to the normal distribution's 68-95-99.7 rule.
Range, IQR, and Quartile Deviation
Must-know: Range = max - min (sensitive to outliers). IQR = Q3 - Q1 (resistant, covers middle 50%). QD = IQR/2. Always prefer IQR for skewed data.
Warning: Top pitfall: Confusing range and IQR. A question may ask for one specifically — read carefully.
Self-check: Dataset: 3, 7, 8, 10, 12, 15, 100. What are the range and IQR?
Connects to: IQR is the foundation of outlier detection and the box plot.
Five-Point Summary
Must-know: {min, Q1, Q2 (median), Q3, max} is the irreducible skeleton of any dataset. Always sort first. From these five numbers you compute range, IQR, and detect outliers.
No formula — sort data, then read off min, Q1, Q2, Q3, max.
Warning: Top pitfall: Forgetting to sort before picking the five values. Unsorted data gives wrong min, max, and median.
Self-check: Dataset: 12, 18, 5, 22, 7, 15, 30, 9, 25. What is the five-point summary?
Connects to: Maps directly to a box plot; feeds into IQR and outlier detection.
Outlier Detection Using IQR
Must-know: Lower fence = Q1 - 1.5×IQR. Upper fence = Q3 + 1.5×IQR. Any point outside the fences is flagged as an outlier. The 1.5 factor is convention.
Warning: Top pitfall: The factor is 1.5, not 1 — using 1× would flag too many normal points. Also: compute fences only after sorting and finding Q1, Q3.
Self-check: Given data 5,7,8,10,12,15,35 with Q1=7, Q3=15. Is 35 an outlier by the IQR method?
Connects to: Connects to box plots and five-point summary.
Probability Fundamentals
Must-know: Add for OR (union): P(A∪B) = P(A) + P(B) - P(A∩B). Subtract the overlap to avoid double-counting. Multiply for AND (intersection) when independent: P(A∩B) = P(A)×P(B). Draw a Venn diagram when stuck.
Warning: Top pitfall: Mutually exclusive (cannot happen together) and independent (no information about each other) are completely different concepts. If mutually exclusive AND both have positive probability, they cannot be independent.
Self-check: Draw one card. P(Heart OR King) = ? Show the formula and the counting approach.
Connects to: Venn diagram approach links to conditional probability and Bayes theorem.
Conditional Probability
Must-know: P(B|A) = P(A∩B)/P(A). The "given" event goes in the denominator. Conditional probability shrinks the sample space to only the condition. P(A|B) ≠P(B|A) in general — never swap without Bayes theorem.
Warning: Top pitfall: Reversing the condition — P(disease | positive test) ≠P(positive test | disease). This is the prosecutor's fallacy.
Self-check: In a class, 40% male, 60% female. 10 males and 15 females wear glasses. What is P(Male | Glasses)?
Connects to: Conditional probability is the building block of Bayes theorem.
Total Probability and Bayes Theorem
Must-know: Total probability sums all tree paths: P(B) = Σ P(A_i)×P(B|A_i). Bayes reverses the condition: P(A_i|B) = P(A_i)P(B|A_i)/P(B). Draw the tree diagram — it makes both mechanical without memorizing formulas.
Warning: Top pitfall: Using Bayes when only total probability is asked. Read the question: "what is P(defective)?" = total probability only. "Given defective, which machine?" = Bayes.
Self-check: Machine A (40% output, 0.9% defective), Machine B (60%, 0.4% defective). A defective item is found. What is P(it came from A)?
Connects to: Bayes theorem powers Naive Bayes classification and medical diagnosis.
Discrete Random Variables
Must-know: Find K via ΣP=1. Mean: E[X] = Σx·P(x). Variance: Var(X) = E[X²] - (E[X])² — do NOT stop at E[X²]. In E[X²] = Σx²·P(x), square only x, not the probability.
Warning: Top pitfall: Forgetting to subtract (E[X])² after computing E[X²]. This is the single most common exam mistake. Variance is NOT just E[X²].
Self-check: Given P(X=x) = kx for x=1,2,3. Find k, E[X], and Var(X).
Connects to: Sum-of-two-dice is the canonical discrete example; method parallels continuous RVs with integrals.
Continuous Random Variables
Must-know: Replace sum with integral. Find constant via ∫f=1, mean via ∫x·f, E[X²] via ∫x²·f. Split integrals at every breakpoint for piecewise PDFs. f(x) is a density, not a probability — P(X=x)=0 for any single point.
Warning: Top pitfall: Forgetting to split integrals for piecewise functions. If the PDF formula changes at x=1, you must integrate [0,1] and [1,∞) separately.
Self-check: Given f(x)=c·x(2-x) for 0≤x≤2. Find c, E[X], and Var(X).
Connects to: The normal distribution is the most important continuous distribution.
Binomial Distribution
Must-know: N trials, success P, failure Q=1-P. P(X=x) = C(N,x)·Pˣ·Qá´ºâ»Ë£. Mean = NP, variance = NPQ. Use complement (1-P(X<k)) to minimize computation. X ranges 0 to N (N+1 values).
Warning: Top pitfall: X ranges from 0 to N, not 1 to N. Forgetting 0 shifts everything. Also: variance is NPQ, not √(NPQ) — that's the standard deviation.
Self-check: A binomial has mean=4 and variance=2. Find N, P, and compute P(X≥2).
Connects to: Poisson is the large-N, small-P approximation of binomial.
Poisson Distribution
Must-know: Use when N>100 and NP<10. λ = NP is the single parameter — mean = variance = λ. P(X=x) = e^(-λ)·λˣ/x!. If you cannot compute e^(-λ), leave the expression — the setup earns marks.
Warning: Top pitfall: Using Poisson when N is moderate and P is not small. For N=20, P=0.3, use binomial directly. Poisson has ONE parameter — don't specify mean and variance separately.
Self-check: N=2000, P=0.001. Find P(exactly 3 successes) using Poisson approximation.
Connects to: Normal approximation to binomial is better when NP > 15.
Joint Probability Distributions
Must-know: Joint table: rows = X, columns = Y. Row sums = marginal X. Column sums = marginal Y. Comma means AND (intersection). Conditional: P(X≤1|Y≤3) = P(X≤1,Y≤3)/P(Y≤3). Sum all cells = 1 to find unknown K.
Warning: Top pitfall: Swapping which marginal is row sums (X) and which is column sums (Y). Also: comma means AND, not OR — P(X≤1, Y≤3) is intersection.
Self-check: X∈{0,1,2}, Y∈{1,...,6}. How do you find P(X+Y≤4) from the joint table?
Connects to: Joint distributions extend single-variable RVs to multivariate analysis.
Normal Distribution
Must-know: Convert to standard normal: Z = (X-μ)/σ. Use the Z-table. Without the table, write the setup and stop — partial credit. 68-95-99.7 rule: 68% within ±1σ, 95% within ±2σ, 99.7% within ±3σ.
Warning: Top pitfall: Looking up P(X<70) directly in the Z-table without computing Z first. You must standardize. Also: check whether your table gives left-tail or right-tail area.
Self-check: Scores have μ=75, σ=10. What Z-score corresponds to a score of 85? Is this above or below the mean?
Connects to: Normal approximation to binomial when NP>15 and NPQ>15.
Naive Bayes and Laplace Smoothing
Must-know: Naive Bayes multiplies P(word|class) across all features (treating them as conditionally independent). Smoothing prevents zero probabilities: add +1 to numerator and denominator. For this course, the basic +1/+1 approach is sufficient.
Warning: Top pitfall: Without smoothing, one unseen word makes the entire product zero — wiping out all other evidence. Smoothing is not optional. The naive assumption is usually false but works surprisingly well.
Self-check: Why is the independence assumption called "naive" and why does Naive Bayes still work well in practice?
Connects to: Naive Bayes builds directly on Bayes theorem from §9.10.
Was this lecture useful?
BitsNotes AI Assistant
Subject Notes AssistantConfigure AI Chat
Choose how to access the chatbotSigned in as
Powered by BitsNotes — 20 messages per day. No API key needed. Want unlimited access? Use "Bring Your Own Key" mode.
Sign in to use AI Chat
Get 20 free AI messages per day to ask questions about your lecture notes. Sign in with Google or GitHub — it takes 5 seconds.
Sign In to BitsNotesSwitch to "Bring Your Own Key" tab above for unlimited access with any OpenAI-compatible provider.