CSE416 Module I Probability and RVs
CSE416 Module I Probability and RVs
Shooter 1 0
2 1
2
3
4
5
1 2 1
2 2
3 3
4 4
5 5
With each trial the probability of hitting target increases due to human learning curve over
time/trials
Hence probability of hitting 4 when 10th trial is done is dependent upon probability of 9th trial
But after, say 100000 trials, the probability of hitting 4 will become independent of previous
trial. But, Why?
What we have learned from dart hitting game?
This is also known as Posterior probability formula (Or Bayesian Approach) – used in
NLP Algorithms
Example showing application of Baye’s Theorem
Suppose a face recognition tool is being tested in a traffic stop to automatically detect if
a person driving a four-wheeler is wearing a seat-belt or not
Let is name events as
• A Person is not wearing seat-belt B App has detected – Not wearing seat-belt
Now let’s understand the Bayesian approach
P(A | B) = P(B | A) P(A)
P(B)
P(A | B) = Probability of person actually not wearing seat-belt (hypothesis A being true), when app has given a
positive result (given that evidence B is true) Removing false positive i.e. app detects that a person is not
wearing a seat-belt but he was wearing it
P(B | A) = Probability of app has given a positive result (evidence B being true) given that person is also not wearing
seat-belt (given that hypothesis A is true) Removing false negative i.e. person was not wearing seat-belt but he
was detected as having wearing it
P(A) = Probability that person is not wearing seat-belt (irrespective of whether app detects it or not) – this
may contain false negative i.e. person was not wearing seat-belt but he was detected as having wearing it
P(B) = Probability of app detecting that person is not wearing a seat-belt (irrespective of whether he is
wearing or not wearing a seat-belt) – this may contain false positives i.e. app detects that a person is not
wearing a seat-belt but he was wearing it
Understanding Bayesian Approach - Calculations
(Source: Https://[Link]/chapter1/1_4_5_solved3.php)
Box contains 4 coins out of which 3 are regular coins and 1 is fake coin with two heads
A coin is picked at random and tossed
What is the probability that Heads will show up? What if there
It depends upon which coin is selected regular (say C1) and fake (say C2) are 2 coins
out of which
Random experiment has two steps 1) Selecting a coin 2) Tossing it one is
Probability that regular coin is selected ¾ fake coin is selected ¼ regular other
If regular coin is selected, Probability of getting Heads = ½ is fake?
If fake coin is selected, Probability of getting Heads = 1
Probability of Getting Heads = (Regular Coin is selected & Tossed to get Heads) or (Fake coin
is selected & Tossed to get Heads)
P(H) = P(C1) P(H I C1) +P(C2) P(H I C2) = ¾ X ½ + ¼ X 1
Note:
(1)“A” Has Occurred
(2) To find probability of any of Ei when A has occurred
Question from previous year exams
Discreet Continuous
Probability Distribution Probability Distribution
When Random Variable “X” When Random Variable “X”
is discrete is continuous
Note Students are requested to remember equation number (1) and (2) for calculation of E(X) and Var(X) for
discrete probability distribution
Application of two properties of discrete probability
distribution
X is a discrete random variate having probability mass function:
x 0 1 2 3 4 5 6 7
P (X=x) 0 k 2k 2k 3k k2 2k2 7k2 +k
(i) Calculate k
(ii) Find P(X<6)
(i) Properties of a Discrete Probability Distribution
(i) 0 ≤ P(A) ≤ 1
(ii) ∑ P(x) = 1
∑ P(x) = 0+k+2k+2k+3k+k2+2k2+7k2+k = 10k2 + 9k (=1 by property ii)
So,10k2 + 9k = 1, if we solve this equation we get k = 1/10 OR k = -1
By property (i) k = 1/10
(ii) Now P(x < 6) = P(x=1) + P(x=2) + P(x=3) + P(x=4) + P(x=5)
= k2 + 8k = 8(1/10) + (1/10)2 = 0.81
NOTE Also you can calculate Mean (Expected Value) & Variance
Continuous Probability Distribution
Probability distribution wherein the variables are continuous random variables is
called Continuous Probability Distribution.
Variable x is continuous it can assume infinite number of values
We can not draw any particular distribution table for a continuous probability
distribution.
Due to this reason the probability mass function P(x) can not be defined in the
same manner as that we did in case of discrete probability distribution.
In this case we introduce a function f(x) called probability density function
such that it satisfies the two conditions:
Properties of Probability Density Function: If f(x) is a probability
density function of a continuous random variable X which is defined
on (-∞, +∞), then:
f (x) ≥ 0 for all x
+∞
∫f(x) dx = 1 (It means Area of Curve under whole distribution = 1)
Expected value and Variance of Continuous
Probability Distribution
If X is a continuous random variable with a Probability Density
Function (pdf) = f(x) defined on (-∞, +∞), then:
Variance of X =
Note Students are requested to remember equation number (3) (4) and (5) for
calculation of E(X) and Var(X) for continuous probability distribution
Example
Literature Source: [Link]
_Probability_(Kuter)/4%3A_Continuous_Random_Variables/4.2%3A_Expected_Value_and_Variance_of_Continuous_Random_Variables
Determine E(X) and V(X), use equations (3), (4) and (5) given in slide no. 27
Expected Value of X
Example (From Mid term Exams)
(a) Let X be a continuous RV with density function
(i) Find k
(ii) Compute E(X) and Var(X)
Hint: In this case, to find the value of k, use the property i.e.
Then use the following equations to find E(X) and Var(X)
(b) Define Probability mass Function (PMF) and Probability Density Function (PDF). List their
properties
CSE416 Applied Probability and Statistics
Module I: Probability and RVs
Topic: Binomial Distribution
- Poisson Distribution
• First defined by French Mathematician SD Poisson (1781-1840)
• Same as above. Only exception:
• Parameter = λ (Average probability of occurrence of event)
• Where, λ = Expected value of random variable x
• Based on frequentist approach i.e. expected occurrences in the past
• No. of occurrences can be from 0 to infinity (theoretically)
• Talks about rare events (either p or q is very small)
Examples – Binomial Distribution
First defined by Swiss Mathematician Jacob Bernoulli (1654 - 1705)
Parameters = n, p
Where n = number of trials (each trials are independent)
p = probability of success
q = 1 – p is probability of failure (Either success or failure)
For Example) Probability of passing an examination is 0.6. If 10 students appeared
in the examination. The consider the Random variable X:
• Random Variable X = No. of students appearing in the examination
• Finite or fixed number of trials = Finite (n=10)
• Each trial is independent of other = Yes
• There are only two possible outcomes (which are mutually exclusive, either success or
failure) = Yes
• Is it a rare event (either p or q is very small)= No, it is not a rare event since probability of
passing the examination is 60%
Binomial Distribution B (n, p)
Let X be a discrete random variable. Let X ~ B(n, p) i.e. X follows a
binomial distribution. Then its probability mass function (PMF) is
defined as
Problem,: 5% of Deepavali fairy lights manufactured by a company are defective. The company's
Quality Control Manager is quite concerned and therefore randomly selects samples 100 bulbs
coming off of the assembly line. Let X denote the number in the sample that are defective. What is
the probability that the sample contains at most three defective bulbs?
Solving using Binomial Distribution: P(X≤3) = P(X=0)+P(X=1)+P(X=2)+P(X=3)
= 100C0 (0.05)0(0.95)100 + 100C1 (0.05)1(0.95)99+ 100C2 (0.05)20.95)98 + 100C3 (0.05)3(0.95)97
No. of returns 0 1 2 3 4 5 6
No. of stores 4 14 23 23 18 9 9
P (400<X<600) =
The lifetime of an electronic component follows exponential distribution with mean life
expectancy of 500 hours. Find the probability that a randomly selected component of
this type exceeds its expected lifetime.
Hint As E(X) = 1/λ Hence λ = 1/E(X) = 1/500 = 0.002
So, f(x) = λe – λx = 0.002 e – 0.002 x
Examples
Literature Source: [Link]
Consider a scenario where the waiting time for a customer to complete a
transaction at a bank's ATM follows an exponential distribution with a scale
parameter (λ) of 5 minutes. We want to find the probability that a customer will take
less than 3 minutes to complete the transaction.
Suppose the claims at a life insurance company's 24-hour call centre occur at a 4-
per-hour rate. What is the probability that the next call arrives after more than 2
hours?
CSE416 Applied Probability and Statistics
Module I: Probability and RVs
Topic: Gamma Distribution
Properties:
and so on
Hence, a Gamma function extends the factorial function (n!) from positive
integers to real and complex numbers
Gamma distribution Γ(α, β)
If X is a continuous random variable which follows an Gamma Distribution with shape parameter
α>0 and rate parameter β>0 i.e.
X ~ Γ(α, β),
then the PDF of X is defined as:
Properties
E(X) = α/β
Var(x) = α/β2
Note
(i) Transformation of Gamma Distribution to Exponential Distribution: If we let α = 1, then
“Gamma Distribution” transforms to “Exponential Distribution”
(ii) Approximation of Gamma Distribution to Normal Distribution: As the shape parameter (𝛼) and
rate parameter (β) become larger in a gamma distribution, the distribution becomes more oncentrated
around its mean, the mean and variance increase, and its shape approaches that of a normal
distribution (bell-shaped).
(iii) Approximation to Erlang distribution: If shape parameter is a positive integer then Gamma
distribution transforms to Erlang distribution
Gamma Distribution Γ(α, β) Example
Suppose we have to model the time until an event occurs, especially when the event is part of a
process that happens at a constant rate (Poisson process), such as waiting times, and the life
span of Mechanical parts. Then this can be modelled using a Gamma Distribution
Gamma Distribution often involves waiting times for multiple events, like a call center getting
calls or a process completing tasks. using shape (α) and rate (β) parameters to find
probabilities, such as the chance of waiting less than 5 minutes for the 3rd call when calls
arrive at 2 per minute
The probability of waiting for 10 minutes for my order in a restaurant, if I am fourth in line?
Gamma Distribution - Examples
Source: [Link]
A server receives requests at an average rate of 2 per minute (λ=2). We want
to find the probability that the time to receive the third request (α=3) is less
than 5 minutes (x=5).
CSE416 Applied Probability and Statistics
Module I: Probability and RVs
Topic: Uniform Distribution
E(X) = (a + b)/2
Var (X) = (b – a)2/12
where - ∞ ≤ x ≤ ∞
µ = Mean of the normal distribution
σ = Standard deviation of the normal distribution
Here
E(X) = µ
Var(X) = σ2
Normal Distribution Curve
Mean = μ
Highest
Standard deviation = σ
Frequency
Area= 68.2%
34.1% 34.1%
13.6% 13.6%
95.4%
μ
μ – 3σ μ – 2σ μ–σ μ+σ μ + 2σ μ + 3σ
Normal Distribution – Example
Marks scored by students
Average Marks = 65
Standard deviation of marks = 10 Highest
Total Students = 100 Frequency
68.2%
34.1% 34.1%
13.6% 13.6%
95.4%
65
65–30 65–20 65–10 65+10 65+20 65+ 30
Normal Distribution
Normal distribution presents a continuous bell shaped
normal distribution curve. It associates with continuous
variables such as height, weight, age etc.
There is only one maximum peak
The normal curve is symmetric over y axis
The height of the normal distribution is maximum at its
Mean. Here Mean, Median and Mode coincides with each
other. Thus for normal distribution Mean = Mode = Median
Area of total curve = 1
Numerical Example
The height distribution of a group of 1000 men is normal with mean height 64.5” and
standard deviation 4.5”
(i) Find the number of men whose height is less than 69” but greater than 55.5”
(ii) Find number of men whose height is greater than 50??? (Conversion to Standard
Normal Distribution or determine Z Score)
Average height = 64.5”
Standard deviation of marks = 4.5”
Total Men = 1000
34.1% 34.1%
13.6% 13.6%
2.15% 2.15%
64.5
?? ?? 64.5–4.5 64.5+4.5 ?? ??
Conversion of Normal Distribution N (µ, σ2)
to Standard Normal Distribution N(0, 1)
For the conversion, following transformation is applied
Z = (X – µ)
σ
This is referred to as Z-score
Here E(X) = 0
Var(X) = 1
Standard Normal Distribution Curve N(0, 1)
Mean = 0
Highest
Standard deviation = 1
Frequency
Area= 68.2%
34.1% 34.1%
13.6% 13.6%
95.4%
0
-3 -2 -1 1 2 3
Additional Questions
The average number of acres burned by forest and range fires in a large New Mexico county is 4,300 acres per year,
with a standard deviation of 750 acres. The distribution of the number of acres burned is normal. What is the
probability that between 2,500 and 4,200 acres will be burned in any given year?
Numerical example from exams
The average number of acres burned by forest and range fires in a large New Mexico
county is 4,300 acres per year, with a standard deviation of 750 acres. The distribution of
the number of acres burned is normal. What is the probability that between 2,500 and
4,200 acres will be burned in any given year?
Solution:
Mean 𝜇 = 4300, SD 𝜎 = 750.
We want 𝑃(2500 ≤ 𝑋 ≤ 4200) for 𝑋 ∼ 𝑁(𝜇, 𝜎2)
Compute Z Score by using formula
Z = (X – µ)
σ
𝑧1 = 2500 − 4300 = -2.4
750
𝑧2 = 4200 − 4300 = -0.133
750
Using the table P(2500 ≤ 𝑋 ≤ 4200) = P(-2.4 ≤Z ≤-0.133) = 0.4401 or 44.01%
Numerical for Module I
X 2 3 4 5 6 7 8 9 10 11 12
P(X) 1/36 2/36 3/36 4/36 5/36 6/36 5/36 4/36 3/36 2/36 1/36
E(X) = ∑ X.P(X)
Var(X) = E(X2) – [E(X)]2
Where E(X2)= ∑ (X2.P(X))
Example Literature Source;
Fundamentals of Mathematical Statistics (Second Edition) by SC Gupta and VK Kapoor. Publisher Sultan Chand &Sons
Page 5.8, Example 5.4) An experiment consists of three independent tosses of a fair coin. Let:
X = The number of heads, Y = The number of head runs, Z = The length of head runs, a head run being defined
as consecutive occurrence of at least two heads, its length then being the number of heads occurring together in
three tosses of the coin.
Find the probability function of (i) X, (ii) Y, (iii) Z, (iv) X+Y and (v) XY
X 0 1 2 3 Y 0 1 Z 0 1 2 3
P(X) 1/8 3/8 3/8 1/8 P(Y) 5/8 3/8 P(Z) 5/8 0 2/8 1/8
U = X+Y 0 1 2 3 4 V=XY 0 1 2 3
P(U) 1/8 3/8 1/8 2/8 1/8 P(V) 5/8 0 2/8 1/8
Numerical for Module I
Literature Source;
Fundamentals of Mathematical Statistics (Second Edition) by SC Gupta and VK Kapoor. Publisher Sultan Chand &Sons
Page 5.13, Example 5.5) The diameter of an electric cable, say X is assumed to be a continuous random variable
with pdf: f(x) = 6x(1 – x), 0 ≤x ≤ 1
(i) Check that f(x) is a p.d.f. (ii) Determine b such that P(X<b) = P(X>b) (ii) Find E(X) and Var(X)
Hint:
Page 5.15, Example 5.10) A continuous RV X has a pdf, f(x) = kx2 (1 – x3), 0 ≤ x ≤ 1 and k is a constant
(i) Find the value of k (iii) Using this value of k, find E(X) and Var(X)
Numerical for Module I
Literature Source;
Fundamentals of Mathematical Statistics (Second Edition) by SC Gupta and VK Kapoor. Publisher Sultan Chand &Sons
(i) Find the value of a (ii) Using this value of a Find P(X≤1.5), E(X) and Var(X)
Page 5.18, Eg. 5.13) Find E(X) and Var(X) where X is a continuous RV with p.d.f.
Page 5.21, Eg. 5.19) Suppose that life in hours of a certain part of radio tube is a continuous RV X with PDF:
Page 5.23, Eg. 5.21) The amount of bread (in hundreds of pounds) x, that a certain bakery is able to sell in a day is
found to be numerical valued random phenomenon, with PDF
Page 5.24, Eg. 5.22) The kms X in thousands of kms which car owners get with a certain type of tyre is a random
variable having PDF
Find the probabilities that one of these tyres will last (i) At most 10,000 kms (ii) between 16000 to 24000 kms
Find the expected life (in kms) of that tyre
Numerical for Module I
Literature Source;
Fundamentals of Mathematical Statistics (Second Edition) by SC Gupta and VK Kapoor. Publisher Sultan Chand &Sons
P. 8.5, Eg. 8.1) Ten coins are thrown simultaneously. Fiind the probability of getting at least
seven heads
P. 8.5, Eg. 8.2) A and B play a game for which their chances of winning are in the ratio of
3:1. Find A’s chance of winning at least three games out of the five games played
P. 8.6, Eg. 8.3) A cofee connoisseur claims that he can distinguish between a cup of
instant coffee and a cup of percolator coffee 7%% of the time. It is agreed that his clain will
be accepted if he correctly identifies at least 5 of the 6 cups. Find his chances of having
the claim (i) accepted (ii) rejected, when he does have to ability he claims
P. 8.7, Eg. 8.6) A departmental store in a wrokds has 10 machines which nay need
adjustment from time to time during the day. Three of these machines are old, each
having a probability of 1/11 of needing adjustment during the day, and seven are new
having corresponding probabilities of 1/21. Assuming that no machine needs adjustment
twice on the same day, find the probabilities that on a particular day: (i) just 2 old and no
new machines need adjustment (ii) If just two machines need adjustment, they are of
same type
Numerical for Module I
Literature Source;
Fundamentals of Mathematical Statistics (Second Edition) by SC Gupta and VK Kapoor. Publisher Sultan Chand &Sons
P. 8.35, Eg. 8.32) A manufacturer of cotter pins knows that 5% of his product is defective. If
he sells cotter pins in boxes of 100 and guarantees that not more than 10 pins will be
defective, what is the approximate probability that a box will fail to meet the required
guaranteed quality?
P. 8.36, Eg. 8.35) A manufacturer, who produces medicine bottles, find out that 0.1% of the
bottles are defective. The bottles are packed in boxes containing 500 bottles. A drug
manufacturer buys 100 boxes from the producer of bottles. Using Poisson distribution, find
how many boxes will contain: (i) No defective (ii) at least two defectives[Given e-0.5 = 0.6065)
P. 8.38, Eg. 8.40 Suppose that the number of telephone calls coming into a telephone
exchange between 10 AM to 11 AM, say X is a random variable with Poisson distribution
with parameter 2. Similarly, the number of calls arriving between 11 AM and 12 Noon, say Y,
has a Poisson distribution with parameter 6. If X and Y are independent, what is the
probability that more than 5 calls come in between 10 AM to 12 noon?
P. 8.38, Eg. 8.42) If X is a Poisson variate with parameter λ such that
P(X=2)=9P(X=4)+90P(X=6). Find (i) λ (ii) E(X)
Fit a Poisson distribution to the following
X 0 1 2 3 4
f 192 100 24 3 1
Numerical – Normal Distribution
P. 9.15 Eg 9.3) X is normally distributed with mean of X is 12 and S.D. 4 (a) Find the probability
of the following: (i) P (X≥20) (ii) P(X≤20) (iii) P(0≤X ≤12) (iv) Find k if P(X>k) = 0.25
P. 9.16 Eg 9.4) X is normally distributed with mean 30 and S.D. 5. Find the probability (i)
P(26≤X≤40) (ii) P(X≥45) and (iii) | X – 30 | > 5
P. 9.17 Eg 9.5) The mean yield for one-acre plot is 662 kg with s.d. 32 kg. Assuming normal
distribution, how many one-acre plot in a batch of 1000 plots will have yield of (i) over 700 kg (ii)
below 650 kg
Literature Source: Probability and Statistics by Dr. Hari Arora (Katson Books)
A sample of 100 dry battery cells tested to find the length of life produced the following results:
Mean = 12 hours, standard deviation = 3 hours
Assuming that the data is normally distributed, what percentage of battery cells are expected to
have life: (a) More than 15 hours (b) less than 6 hours © between 10 and 14 hours (Ans (a)
15.87 (b) 2.28 (c) 47.74)
Assuming that the diameters of 1000 brass plugs taken consecutively from a machine form a
normal distribution with mean 0.7515 cm and standard deviation of 0.002 cm. Find the number of
plugs likely to be rejected if the approved diameter is 0.752 ± 0.004 cm (Ans: 52)
Numerical – Bayes' Theorem
Literature Source: Probability and Statistics by Dr. Hari Arora (Katson Books)
Three urns contain 6 red, 4 black; 4 red, 6 black, and 5 red, 5 black balls respectively.
One of the urns is selected at random and a ball is drawn out of it. If the ball drawn is red
find the probability that it is drawn from the first urn (Ans: 2/5)
An insurance company insured 2000 scooter drivers, 4000 car drivers and 6000 truck
drivers. The probability of an accident involving a scooter driver, car driver and a truck
driver is 0.01, 0.03 and 0.15 respectively. One of the insured person meets with an
accident. What is the probability that he is a scooter driver? (Ans: 1/52)
A company has two plants to manufacture scooters, Plant I manufactures 70% of the
scooters and Plant II manufactures 30%. At Plant I, 80% of the scooters are rated as of
standard quality and at Plant II, 90% of the scooters are rated as of standard quality. A
scooter is chosen at random and is found to be of standard quality. What is the probability
that it has come from Plant II? (Ans: 27/83)
By examining the chest X-ray, the probability that a person is diagnosed with TB when he
is actually suffering from it is 0.99. The probability that the doctor incorrectly diagnoses as
person to be having TB, on the basis of X-ray reports, is 0.001. In a certain city, 1 in 1000
persons suffers from TB. A person is selected at random and is diagnosed to have TB.
What is the chance that he actually has TB? (Ans: 110/221)
References
References
Fundamentals of Mathematical Statistics by SC Gupta and VK
Kapoor. Publisher Sultan Chand and Sons
89