📖 Chapter 2 of 12 · AI for New Learner- Senior 1 · Class 9
Chapter 2: The Maths AI Needs
In this chapter
- Reyansh from Surat starts a school AI club.
- Mean, median, mode — and when each one lies.
- Standard deviation — how spread-out is your data?
- Variance — the secret behind almost every AI model.
- Sub-group fairness — why one mean can hide bias.
The Big Idea
Every AI prediction is a maths operation in disguise. To debug AI, you must SEE the maths. This chapter teaches just enough statistics to read what an AI is really doing. Mean, median, spread — three numbers that summarise any Indian dataset, from cricket scores to mandi prices.
Did you know?
When Indian banks reject a loan, they often use statistics — the average income of your area, the spread of your credit history. Knowing maths gives you the power to ASK why, and demand fairness under the DPDP Act 2023.
Builder Profile: Reyansh
Surat, Gujarat · Reyansh, age 14
Reyansh started his school’s first AI Club last year — with three friends and a borrowed laptop. They meet every Saturday in the library. Their first project: analyse the canteen menu prices and predict if a snack is ‘overpriced’.
They collected 50 snack prices, computed the mean and median, and found the spread. The median was Rs 25 but the mean was Rs 38 — because of two very expensive Rs 200 sandwiches! Reyansh learned a powerful lesson: a single number can LIE about the data.
Now his club has 22 members. They have built three small AI tools for the school. Reyansh says, “You don’t need a coaching class to start. You need curiosity, a free laptop, and three friends who say YES.”
⊕ MATH MINUTE Mean vs Median — Why AI Cares
MEAN: add all, divide by count — sensitive to outliers. MEDIAN: the middle value when sorted — resistant to outliers. If 9 people earn Rs 100 and 1 earns Rs 10,000, the mean is Rs 1090 (misleading!) but the median is Rs 100 (truer). Choosing the right one matters in AI.
mean = sum ÷ n • median = middle(sorted)
💻 CODE LAB Python statistics — Three Lines
import statistics
scores = [82, 75, 91, 88, 95, 100, 22]
print('Mean:', statistics.mean(scores))
print('Median:', statistics.median(scores))
print('Stdev:', round(statistics.stdev(scores), 2))
# Mean: 79.0 Median: 88 Stdev: 26.55
# Big gap between mean & median = an outlier (22)!
⊕ MATH MINUTE Standard Deviation in 3 Steps
STEP 1: find the mean. STEP 2: for each value, square its difference from the mean. STEP 3: take the mean of those squares, then the square root. Small stdev = data bunched up; big stdev = data spread out. AI uses this to decide if it can TRUST its predictions.
stdev = √( mean( (x − mean)² ) )
WHY THIS MATTERS
Niramai’s cancer-screening AI uses stdev on thermal patterns. Low stdev across the breast = uniform temperature = healthy. High stdev = a hot spot = possible tumour. The maths you just learned literally helps save Indian lives.
⚠ COMMON MISTAKE
✗ Mistake: Reporting only the MEAN. Two classes can both average 70 — but one has everyone at 70 (no spread, all learning) and another has half at 95 and half at 45 (huge spread, some kids left behind!).
✓ Fix: ALWAYS report mean AND stdev together. In real AI papers you will see ‘accuracy 87.3% ± 2.1%’. The ± is the stdev — it tells you how confident the result is. No stdev = result is suspect.
✍ WORKED EXAMPLE Are These Marks ‘Average’?
Problem: Section A has 7 students who scored 65, 70, 72, 75, 78, 80, 95 in maths. Compute mean, median, stdev, then say whether reporting only the mean would be fair.
- Sort the data: 65, 70, 72, 75, 78, 80, 95.
- Mean = (65+70+72+75+78+80+95) ÷ 7 = 535 ÷ 7 = 76.43.
- Median = middle of 7 sorted = 4th value = 75.
- Stdev: differences from mean squared, averaged (÷6 for sample), square-rooted ≈ 9.6.
- Mean 76.4 vs median 75 — close. But stdev 9.6 is high, and one student scored 95, pulling the mean up. Saying ‘class average is 76’ is fair, but the spread shows one student is far above the rest.
Show answer
✓ Answer: Mean = 76.43, Median = 75, Stdev = 9.6. Always report all three together.
Solved illustrations
1. When should I use the median instead of the mean?
Show answer
Answer: Use MEDIAN when there are outliers (extreme values). Income, house prices, exam ranks — all have outliers. Use MEAN only when data is smooth, like daily temperatures in a single month.
2. What is variance — and why does AI use it?
Show answer
Answer: Variance = stdev squared. It is the ‘spread’ before you take the square root. Almost every AI learning algorithm tries to MINIMISE the variance of its mistakes. So variance is literally the thing AI is fighting.
3. Can two datasets have the same mean but be totally different?
Show answer
Answer: YES. Class A: [70, 70, 70, 70, 70] — mean 70, stdev 0. Class B: [40, 50, 70, 90, 100] — mean 70, stdev 24. Same mean, completely different stories. NEVER trust a single number to describe data.
4. What is sub-group fairness in AI?
Show answer
Answer: An AI may have 90% accuracy OVERALL but only 60% for, say, women, or rural users. The OVERALL mean HIDES the bias. Indian regulators are starting to require AI to report accuracy BY sub-group.
5. How do I tell if a dataset has outliers?
Show answer
Answer: Quick test: compare mean and median. If they are very different, you have outliers. Another test: count values more than 2× stdev away from the mean. Those are usually outliers worth investigating.
Questions — Chapter 2
A. Compute (show working)
- Find mean and median of: [40, 55, 60, 70, 100].
- A class has marks [80, 80, 80, 80, 80, 80, 5]. Mean? Median? Which describes the class better?
- Mean = 75, stdev = 0. What does this tell you about the data?
- Compute the stdev of [10, 20, 30]. (Use the population formula: divide by n.)
B. Short answers
- An app reports ‘accuracy: 90%’. Why must you ask ‘stdev?’ too?
- When would you prefer median over mean? Give an Indian example.
- Why must AI report performance for sub-groups (gender, region, age)?
- Write 3 lines of Python that compute mean and median of [82, 75, 91, 88, 95].
Ship-It Challenge
Collect heights of 10 friends. Compute mean, median, stdev. Plot them on graph paper!
Check your understanding — Chapter 2
Tap an answer to check it instantly. These are for practice — nothing is saved or sent.
Q1. When should you use the median instead of the mean?
- Never
- When the data has outliers (extreme values) like income, house prices or exam ranks
- Only for temperatures
Show answer
B. When the data has outliers (extreme values) like income, house prices or exam ranks
Q2. Can two datasets have the same mean but be totally different?
- No, same mean means same data
- Yes — [70,70,70,70,70] and [40,50,70,90,100] both have mean 70 but very different spread
- Only if they have different lengths
Show answer
B. Yes — [70,70,70,70,70] and [40,50,70,90,100] both have mean 70 but very different spread
Q3. What is sub-group fairness in AI?
- Making all groups the same size
- An AI may be 90% accurate overall but only 60% for women or rural users — the overall mean hides the bias
- A way to speed up training
Show answer
B. An AI may be 90% accurate overall but only 60% for women or rural users — the overall mean hides the bias
Q4. Why must an AI paper report stdev, not just the mean?
- To look impressive
- Because the spread (stdev) tells you how confident/consistent the result is — 'accuracy 87.3% ± 2.1%'
- Stdev is not needed
Show answer
B. Because the spread (stdev) tells you how confident/consistent the result is — 'accuracy 87.3% ± 2.1%'