Unit 3 : Math For A.I.
How are Math and AI related?
Math is the study of patterns
▪ To solve the puzzles, you identify an order/arrangement in the list of numbers or the
images.
This arrangement is called a pattern.
▪ These patterns exist all around us.
▪ We have patterns in numbers, images, and language.
Ask learners if they can identify any patterns around themselves.
AI is a way to recognize patterns
● AI can learn to recognize patterns, like human beings.
● AI can see patterns in different types of data - numbers, images, and speech and text. ▪
Math is the study of patterns
▪ AI is a way to recognize patterns in order to take decisions
▪ AI needs Math to study and recognize patterns in order to take decisions
Say “Just like we can recognize patterns in numbers, words, pictures, etc., AI can also
recognize similar patterns.”
Hence,
Can you identify any pattern in the image given below?
Understanding math will help us to better understand AI and its way of working, but what
kind of math is needed for AI?
Let us take a look!
AI uses Math for:
Statistics (Exploring data): Example – What is the middle value of the data? Which is the
most common value in the data?
▪ Calculus (training and improving AI model): Example – which line is more slanted?
Which figure covers more area?
▪ Linear Algebra (finding out unknown or missing values): Example – How many plants
are there in total? How many cars are there in a city?
▪ Probability (predicting different events): Example – what will be the possible results of a
coin toss? Will it rain tomorrow?
Introduction to Probability and Statistics
Part 1: Statistics Basics
Definition of Statistics:” - Statistics is used for collecting, exploring, and analyzing the
data. It also helps in drawing conclusions from data in drawing conclusions from data.”
▪ Data is collected from various sources.
▪ Data is explored and cleaned to be used.
▪ Analysis of data is done to understand it better.
▪ Conclusions and decisions can be made from the data.
Applications of Statistics:
1. Predict the performance of sports teams
2. It can be used to find out specific things such as:
the reading level of students
the opinions of voters
the average weight of a city’s resident
Probability
1. Mean (Average)
Definition: The mean is the sum of all data points divided by the total number of
data points.
Formula: Mean = (Sum of all values) / (Number of values)
Example:
- Data: {5, 10, 15, 20, 25}
- Sum = 5 + 10 + 15 + 20 + 25 = 75
- Number of values = 5
Mean = 75 / 5 = 15.
2. Median
Definition: The median is the middle value in a sorted data set.
Steps to Find Median:
1. Arrange data in ascending order.
2. If odd, median = middle value.
3. If even, median = average of two middle values.
Examples:
- Odd Data Set: {3, 7, 10, 15, 20}
Median = 10 (middle value).
- Even Data Set: {2, 4, 6, 8}
Median = (4 + 6) / 2 = 5.
3. Mode
Definition: The mode is the most frequently occurring value in the data set.
Examples:
- Data: {1, 2, 2, 3, 4}
Mode = 2 (occurs twice).
- Data: {5, 7, 7, 8, 8, 9}
Modes = 7 and 8 (bimodal).
Comparison Table
Measure Definition Example
Mean Average of all values {2, 4, 6} → Mean =
12/3 = 4
Median Middle value of sorted {1, 3, 5} → Median = 3
data
Mode Most frequent value {2, 3, 3, 4} → Mode = 3
Part 2: Probability Basics
1. What is Probability?
Probability is a way to tell us how likely something is to happen. For example – When a coin
is tossed, there are two possible results or outcomes:
heads (H) or tails (T) The probability equation defines the likelihood of the happening
of an event. It is the ratio of favorable outcomes to the total favorable outcomes. The
probability formula can be expressed as,
Probability can be expressed in the following ways:
▪ Certain events: An event will happen without a doubt
▪ Likely events: The probability of one event is higher than the probability of another event
▪ Unlikely events: One event is less likely to happen than another event
▪ Impossible events: There's no chance of an event happening
▪ Equal Probability events: Chances of each event happening is same
The probability of an event occurring is somewhere between impossible and certain.
• If an event is certain or sure to happen, it will have a probability of 1.
For example, the probability that it will rain in the state of Florida at least once in a specific
year is 1.
• If an event will never happen or is impossible, it will have a probability of 0.
For example, the probability that you can pick a red ball from a bag containing only
blue balls is 0.
Formula: P(E) = (Number of favorable outcomes) / (Total number of outcomes)
Examples of Probability Experiments:
- Tossing a coin.
- Rolling a die.
- Drawing cards from a deck.
2. Examples of Probability
Example 1: Tossing a Coin
Experiment: Toss a single coin.
Sample Space (S): {Heads (H), Tails (T)}
Probability of Getting Heads: P(H) = 1/2
Interactive Question: What is the probability of getting at least one head when two
coins are tossed?
Answer: Sample Space = {HH, HT, TH, TT}
P(At least 1 Head) = 3/4.
Example 2: Rolling a Die
Experiment: Roll a standard six-sided die.
Sample Space (S): {1, 2, 3, 4, 5, 6}
Probability of Rolling a 4:
P(4) = 1/6
Interactive Question: What is the probability of rolling an even number?
Answer: Favorable Outcomes = {2, 4, 6}
P(Even) = 3/6 = 1/2.
Example 3: Drawing a Card
Experiment:
Draw one card from a standard 52-card deck.
Sample Space (S): 52 cards.
Probability of Getting a King: P(King) = 4/52 = 1/13
Interactive Question: What is the probability of drawing a red card?
Answer: Red cards = 26
P(Red) = 26/52 = 1/2.
Exercise:
2 mark question
1) A bag contains 5 red balls, 3 blue balls, and 2 green balls. A ball is drawn at random.
Calculate the probability of drawing a blue ball.
2) Two dice are rolled. Find the probability that the sum of the numbers on the dice is 7.
3) A box contains 4 red marbles, 5 blue marbles, and 3 green marbles. Two marbles are
drawn at random without replacement. Calculate the probability that both marbles are
blue.
4) In a game, a spinner with 6 equal sections (numbered 1 to 6) is spun twice. Find the
probability that the sum of the numbers spun is less than 7.
5) A card is drawn from a standard deck of 52 cards. Find the probability that the card
drawn is a face card (jack, queen, or king).
4 marks question
1) A bag contains 3 red balls, 4 blue balls, and 5 green balls. If a ball is drawn at random
from the bag, what is the probability that it is not blue?
2) The heights (in cm) of students in a class are recorded as follows: 160, 165, 170, 155,
175. Calculate the median height.
3) A fair six-sided die is rolled. What is the probability of rolling a number less than 4?
4) The following data represents the ages (in years) of students in a class: 14, 15, 16,
14, 17, 15, 16, 15, 14, 17, 16, 15. Calculate the mode of the ages.
5) Two cards are drawn at random without replacement from a deck of 52 cards. What
is the probability that the first card drawn is a heart and the second card drawn is a
diamond?
Answers/ Solutions
2- mark question
1) A bag contains 5 red balls, 3 blue balls, and 2 green balls. A ball is drawn at random.
Calculate the probability of drawing a blue ball.
ANS: 3/10
2) Two dice are rolled. Find the probability that the sum of the numbers on the dice is 7.
ANS: 1/6
3) A box contains 4 red marbles, 5 blue marbles, and 3 green marbles. Two marbles are
drawn at random without replacement. Calculate the probability that both marbles are
blue.
ANS: 5/33
4) In a game, a spinner with 6 equal sections (numbered 1 to 6) is spun twice. Find the
probability that the sum of the numbers spun is less than 7.
ANS: 5/12
5) A card is drawn from a standard deck of 52 cards. Find the probability that the card
drawn is a face card (jack, queen, or king).
ANS: 12/52
4 marks question
1) A bag contains 3 red balls, 4 blue balls, and 5 green balls. If a ball is drawn at random
from the bag, what is the probability that it is not blue?
ANS: the probability that a ball drawn is not blue is 2/3
2) The heights (in cm) of students in a class are recorded as follows: 160, 165, 170, 155,
175. Calculate the median height.
ANS: 165
3) A fair six-sided die is rolled. What is the probability of rolling a number less than 4?
ANS: the probability of rolling a number less than 4 is ½
4) The following data represents the ages (in years) of students in a class: 14, 15, 16,
14, 17, 15, 16, 15, 14, 17, 16, 15. Calculate the mode of the ages.
ANS: Since 15 appears most frequently, the mode of the data set is 15.
5) Two cards are drawn at random without replacement from a deck of 52 cards. What
is the probability that the first card drawn is a heart and the second card drawn is a
diamond?
ANS: the probability that the first card drawn is a heart and the second card drawn is a
diamond is13/204.