BEE31702 ENGINEERING MATHEMATICS V CHAPTER 1: RANDOM VARIABLES LECTURERS: Dr. Chew Chang Choon (Coordinator) PM Dr. Muhammad Ramlee Bin Kamarudin Dr. Nor Surayahani Binti Suriani Dr. Nordiana Azlin Binti Othman Dr. Suhaila Sari Dr. Suhaila binti Sari Ts. Shamsul Bin Mohamad 1 CONTENTS 1. Introduction 2. Random variables (RV) 3. Discrete random variables: i. Probability density function (PDF) ii. Cumulative distribution function (CDF) iii. Mean, variance and standard variation 4. Continuous random variables i. Probability density function (PDF) ii. Cumulative distribution function (CDF) iii. Mean, variance and standard variation 2 1. INTRODUCTION ROLE OF STATISTICS AND PROBABILITY • What do engineers do? – An engineer is someone who solves problems of interest to society with the efficient application of scientific principles by: • Refining existing products • Designing new products or processes Statistics & Probability 4 WHAT IS PROBABILITY? • Why we learn probability? – Nothing in life is certain. In everything we do, we gauge the chances of successful outcomes, from business to engineering to medicine to the weather • In situation in which one of a number of possible outcomes may occur, the theory of probability produces methods for quantifying the chances or the likelihood associated with various outcomes. • It provides a bridge between descriptive and inferential statistics. 5 WHAT IS STATISTICS? • To guess is cheap. To guess wrongly is expensive - Chinese proverb • Statistics is the scientific application of mathematical principles to the collection, analysis, and presentation of data: – at the foundation of all of statistics is data 6 PROBABILISTIC VS STATISTICAL REASONING • Suppose I know exactly the proportions of car makes in Malaysia. Then I can find the probability that the first car I see in the street is a Proton. This is probabilistic reasoning as I know the population and predict the sample. • Now suppose that I do not know the proportions of car makes in Malaysia, but would like to estimate them. I observe a random sample of cars in the street and then I have an estimate of the proportions of the population. This is statistical reasoning 7 2. RANDOM VARIABLES (RV) TERMINOLOGY • Random variables (RV): – Assumes any of several different values as a result of some random event or experiment – Denoted by a capital letter such as X,Y and Z • Population: – A group of individuals of items that share one or more characteristics from which data can be gathered and analyzed • Sample: – A subset of the population – Elements are selected intentionally as a representation of the population being studied 9 TERMINOLOGY • Sample space: – The set of all possible outcome or events of an experiment – Denoted by S • Sample size: – The number of items in a sample • Random sample: – The sample selected in a way that allows every member of the population to have the same chance of being chosen 10 BASIC CONCEPTS • Use graphs and numerical measures to describe data sets which were usually samples • We measured “how often” using: Relative frequency = f/n • As n gets larger, Sample And “How often” = Relative frequency Population Probability 11 BASIC CONCEPTS • An experiment is the process by which an observation (or measurement) is obtained • An event is an outcome of an experiment, usually denoted by a capital letter: – The basic element to which probability is applied – When an experiment is performed, a particular event either happens, or it doesn’t! • Experiment: Record an age – Event X: person is 30 years old – Event Y: person is older than 65 • Experiment: Toss a die – Event A: observe an odd number – Event B: observe a number greater than 2 12 BASIC CONCEPTS • Two events are mutually exclusive if, when one event occurs, the other cannot, and vice versa • Experiment: Toss a die Not Mutually Exclusive – A: observe an odd number – B: observe a number greater than 2 – C: observe a 6 B and C? Mutually B and D? – D: observe a 3 Exclusive 13 BASIC CONCEPTS • Simple event, Ei: – An event that cannot be decomposed – Denoted by E with a subscript – Each simple event will be assigned a probability, measuring “how often” it occurs • Sample space, S: – The set of all simple events of an experiment 14 SIMPLE EVENT, SAMPLE SPACE • Experiment – tossing a die • Simple events: • Sample space: 15 EVENT, SIMPLE EVENT • An event is a collection of one or more simple events • The die toss: – A: an odd number – B: a number > 2 16 PROBABILITY OF AN EVENT • The probability of an event A measures “how often” A will occur. We write P(A) • Suppose that an experiment is performed n times. The relative frequency for an event A is: = • If we let n get infinitely large: = lim → 17 PROBABILITY OF AN EVENT • P(A) must be between 0 and 1: – If event A can never occur, P(A) = 0. – If event A always occurs when the experiment is performed, P(A) = 1 • The sum of the probabilities for all simple events in S equals 1 • The probability of an event A is found by adding the probabilities of all the simple events contained in A 18 FINDING PROBABILITIES • Probabilities can be found using: – Estimates from empirical studies – Common sense estimates based on equally likely events. • Examples: – Toss a fair coin P(Head) = 1/2 – Suppose that 90% of the Malaysia population has black hair. Then for a person selected at random, P(Black hair) = .90 19 USING SIMPLE EVENTS • The probability of an event A is equal to the sum of the probabilities of the simple events contained in A • • If the simple events in an experiment are equally likely, you can calculate = = 20 EXAMPLE 1 • Toss a fair coin twice. What is the probability of observing at least one head? 21 SOLUTION 1 1st Coin 2nd Coin Ei P(Ei) H HH 1/4 P(at least 1 head) T HT 1/4 = P(E1) + P(E2) + P(E3) H = 1/4 + 1/4 + ¼ H TH 1/4 T TT 1/4 T = 3/4 22 EXAMPLE 2 • The sample space of throwing a pair of dice is 23 SOLUTION 2 Event Simple events Probability Dice add to 3 (1,2), (2,1) 2/36 Dice add to 6 (1,5), (2,4), (3,3), (4,2), (5,1) 5/36 Red die show 1 (1,1), (1,2), (1,3), (1,4), (1,5), (1,6) 6/36 Green die show 1 (1,1), (2,1), (3,1), (4,1), (5,1), (6,1) 6/36 24 EXAMPLE 3 • An experiment of tossing a fair coin three times. Let X will be a random variable of getting head. Find the probability of getting head by using probability distribution function (PDF) table, graph and equation. 25 SOLUTION 3 PDF table HHH HHT HTH THH HTT 1/8 1/8 1/8 1/8 1/8 x 3 2 2 2 1 THT 1/8 1 TTH 1/8 1 TTT 1/8 0 P(x = 0) = P(x = 1) = P(x = 2) = P(x = 3) = 1/8 3/8 3/8 1/8 x p(x) 0 1/8 1 3/8 2 3 3/8 1/8 PDF graph Probability Histogram for x PDF equation 26 RANDOM VARIABLES TYPES • Discrete random variables have a countable number of outcomes – Examples: Dead/alive, treatment/placebo, dice, counts • Continuous random variables have an infinite continuum of possible values – Examples: blood pressure, weight, the speed of a car, the real numbers from 1 to 6 27 3. DISCRETE RANDOM VARIABLES PROBABILITY DISTRIBUTION FOR A DISCRETE RV • A probability distribution for a discrete random variable is a complete set of an possible outcomes and their possibilities of occurring X, representing Possible values of X Number of dots appear when tossing a die 1, 2, 3, 4, 5, 6 Number of books in the bag 0, 1, 2, 3, 4, 5 Number of male students in a class 15, 16, 17, 22 29 PROBABILITY DISTRIBUTION FUNCTION (PDF) FOR A DISCRETE RV • Theory 1 – The Probability Distribution Function (PDF) of a discrete random variable X is described as the function P(X=x) = P(x) which is satisfied: 0≤ ( )≤1 =1 = ( = ) 30 EXAMPLE 4 • Consider the table as follows: • From the table of probability distribution function, proof that the distribution is a probability distribution function(PDF) of discrete variable then find the probability of: – P(X<2) – P(X≤2) – P(X≥1) x P(x) 0 1/8 1 3/8 2 3/8 3 1/8 31 SOLUTION 4 • For P(X<2): ꞊ P(X=0) + P(X=1) ꞊ 1/8 + 3/8 ꞊ 4/8 ꞊ 1/2 x P(x) 0 1/8 1 3/8 2 3/8 3 1/8 • For P(X≤2): ꞊ P(X=0) + P(X=1) + P(X=2) ꞊ 1/8 + 3/8 + 3/8 ꞊ 7/8 32 SOLUTION 4 • For P(X≥1): ꞊ P(X=1) + P(X=2) + P(X=3) ꞊ 3/8 + 3/8 + 1/8 ꞊ 7/8 x P(x) 0 1/8 1 3/8 2 3/8 3 1/8 33 CUMULATIVE DISTRIBUTION FUNCTION (CDF) OF DISCRETE RV • Theory 2 – The Cumulative Distribution Function (CDF) of a discrete RV X is described as the function: = ≤ = ( = ) which satisfies: • F(x) is an increase function: = 1 , which is the maximum value is 1 – lim → = 0 , which is the minimum value is 0 – lim → 34 CUMULATIVE DISTRIBUTION FUNCTION (CDF) OF DISCRETE RV • Theory 3 – The CDF of a discrete RV X can be calculated by using the following formulas: ≤ = > < =1− = ≤ −1 = −1 = ≤ = ≤ − ( − 1) = − + ( ) ≤ < < < = = − − < ≤ = − ( ) + − ( ) − ( ) *f(r) = f(r)- f(r-1) *f(s) = f(s)- f(s-1) 35 EXAMPLE 5 • Customers purchase a particular make of automobile with a variety of options. The probability distribution function of the number of options selected is: X 7 P(X = x) 0.11 8 9 10 11 12 13 0.10 0.22 0.23 0.12 0.13 0.09 • Find the CDF of X, then by using the CDF, find the probability: – Exactly ten number of options was selected – More than nine number of options was selected – Between eight and twelve number of options was selected 36 SOLUTION 5 • Find the CDF of X: = ( ≤ ) X 7 8 9 10 11 12 13 P(X = x) 0.11 0.10 0.22 0.23 0.12 0.13 0.09 7 = ≤7 = = 7 = 0.11 8 = ≤8 = =7 + = 8 = 0.11 + 0.10 = 0.21 9 = ≤9 = =7 + =8 + = 9 = 0.11 + 0.10 + 0.22 = 0.43 10 = 0.66 11 = 0.78 12 = 0.91 13 = 1 X 7 8 9 10 11 12 13 P(X = x) 0.11 0.10 0.22 0.23 0.12 0.13 0.09 F(x) 0.11 0.21 0.43 0.66 0.78 0.91 1 37 SOLUTION 5 • Probability of exactly ten number of options was selected: X 7 8 9 10 11 12 = = = 10 = − ( − 1) P(X = x) 0.11 0.10 0.22 0.23 0.12 13 0.13 0.09 10 − (9) = 10 = 0.23 X 7 8 9 10 11 12 13 P(X = x) 0.11 0.10 0.22 0.23 0.12 0.13 0.09 F(x) 0.11 0.21 0.43 0.66 0.78 0.91 1 38 SOLUTION 5 • Probability of more than nine number of options was selected: X 7 8 9 10 11 12 13 > =1− ( ) P(X = x) 0.11 0.10 0.22 0.23 0.12 0.13 0.09 > 9 = 1 − (9) > 9 = 1 − 0.43 = 0.57 • Probability of between eight and twelve number of options was selected: < < = − 12 − − ( ) 8< < 12 = 8 − (12) 8< < 12 = 0.91 − 0.21 − 0.13 = 0.57 39 EXAMPLE 6 • Suppose X denotes the number of telephone receivers in a single family residential house. From an examination of the phone subscription records of 1000 residence in a city, the following probability function of X is obtained: 0.17, 0.23, = 0.2, 0, = 0, 1 = 2, 3 =4 ℎ • Find the CDF of X, then by using the CDF, calculate the value of – – – ( < 3) (1 ≤ < 4) (0 < ≤ 4) 40 SOLUTION 6 • Find the CDF of X: = ( ≤ ) 0 = ≤0 = = 0 = 0.17 1 = ≤1 = =0 + 0.17, 0.23, = 0.2, 0, = 0, 1 = 2, 3 =4 ℎ = 1 = 0.17 + 017 = 0.34 2 = 0.57 3 = 0.8 4 =1 41 SOLUTION 6 • Calculate the value of <3 = ≤3−1 = 3−1 = 2 = 0.57 0.17, 0.23, = 0.2, 0, = 0, 1 = 2, 3 =4 ℎ • Calculate the value of 1≤ <4 = 4 − 1 + 1 − 4 = 1 − 0.34 + 0.17 − 0.2 = 0.63 • Calculate the value of < 0< ≤ = ≤4 = − ( ) 4 − 0 = 1 − 0.17 = 0.83 42 EXPECTED VALUE, VARIANCE AND STANDARD DEVIATION • All probability distributions are characterized by an expected value (mean), a variance (standard deviation squared) and standard deviation • The expected value of a discrete RV is defined as its weighted average over all possible outcomes, with the weight for each outcome being the relative frequency or probability associated with the outcome • Theory 4 – Expected value (mean), µ @ E(X) of discrete RV: = ℎ ℎ + , , = + ( ) 43 EXPECTED VALUE, VARIANCE AND STANDARD DEVIATION • The variance of a discrete RV is defined as the weighted average of the squared differences between each possible outcome and the average value of the outcomes, with the weights being the probabilities associated with each of the outcomes • Theory 5 – Variance, of discrete RV: , Var aX + b = + 44 EXPECTED VALUE, VARIANCE AND STANDARD DEVIATION • Theory 6 – The standard deviation, of the probability distribution of a discrete RV is the square root of the variance: 45 EXAMPLE 7 • The discrete RV X has range space {1,2,3,4,5} and its CDF takes the value as follows: – Tabulate the probability distribution function – Compute the mean and variance 46 SOLUTION 7 • Tabulate the probability distribution function: ≤ = = = CDF = − ( − 1) 1 +5∗1 =1 = 1 − 0 = − 0 = 0.12 50 = 2 = 0.28 − 0.12 = 0.16 = 3 = 0.48 − 0.28 = 0.2 = 4 = 0.72 − 0.48 = 0.24 = 5 = 1 − 0.72 = 0.28 47 SOLUTION 7 • Compute the mean and variance: = = = = 1 ∗ 0.12 + 2 ∗ 0.16 + 3 ∗ 0.2 + 4 ∗ 0.24 + 5 ∗ 0.28 = 3.4 = 1 ∗ 0.12 + 2 ∗ 0.16 + 3 ∗ 0.2 + 4 ∗ 0.24 + 5 ∗ 0.28 = 13.4 = 13.4 − 3.4 = 1.84 48 EXAMPLE 8 • A random variable Y has the following probability distribution: y -2 0 2 P(Y = y) k 1-2k k – Show that Var(Y)=8k – If given k=1/3, find mean and variance 49 SOLUTION 8 • Show that Var(Y)=8k: = = = (−2) ∗ = (−2) ∗ y -2 0 2 P(Y = y) k 1-2k k +0 ∗ 1 − 2 +0 ∗ 1 − 2 +2 ∗ +2∗ =8 =0 =8 −0 =8 50 SOLUTION 8 • If given k=1/3, find mean and variance: = = = y -2 0 2 P(Y = y) k=1/3 1-2k=1/3 k=1/3 1 1 1 = (−2) ∗ + 0 ∗ + 2 ∗ = 0 3 3 3 1 1 1 8 = (−2) ∗ + 0 ∗ + 2 ∗ = = 2.66 3 3 3 3 = 2.66 − 0 = 2.66 51 EXAMPLE 9 • The following table lists the probability distribution of the number of student taken course per semester in science centre: x 3 4 5 6 7 P(x) 0.37 0.26 0.18 0.11 0.08 • Calculate the mean and standard deviation for this probability distribution 52 SOLUTION 9 • Calculate the mean for this probability distribution: = = x 3 4 5 6 7 P(x) 0.37 0.26 0.18 0.11 0.08 = 3 ∗ 0.37 + 4 ∗ 0.26 + 5 ∗ 0.18 + 6 ∗ 0.11 + 7 ∗ 0.08 = 4.27 53 SOLUTION 9 • Calculate the standard deviation for this probability distribution: = x 3 4 5 6 7 P(x) 0.37 0.26 0.18 0.11 0.08 = 3 ∗ 0.37 + 4 ∗ 0.26 + 5 ∗ 0.18 + 6 ∗ 0.11 + 7 ∗ 0.08 = 19.87 = 19.87 − 4.27 = 1.64 = 1.64 = 1.28 54 EXAMPLE 10 • Let the probability distribution function of X be defined by: – Find – Calculate mean and variance – Find the value of E(2X-9) and Var(3X+10) 55 SOLUTION 10 • Find ≤3 = 3 =P X=1 +P X=2 +P X=3 2 2 2 = + + = 0.875 64 64 64 56 SOLUTION 10 • Calculate mean and variance = 1∗ = 2 2 2 2 2 2 1 +2∗ +3∗ +4∗ +5∗ +6∗ +7∗ = 1.985 64 64 64 64 64 64 64 = 2 2 2 2 2 2 1 1 ∗ +2 ∗ +3 ∗ +4 ∗ +5 ∗ +6 ∗ +7 ∗ = 5.728 64 64 64 64 64 64 64 = 5.728 − 1.985 = 1.78 57 SOLUTION 10 • Find the value of E(2X-9) 2 −9 =2 − 9 = 2 1.985 − 9 = −5.03 58 SOLUTION 10 • Find the value of Var(3X+10) 3 + 10 = 3 + 10 = 9 1.78 + 0 = 16.02 59 4. CONTINUOUS RANDOM VARIABLES (RV) CONTINUOUS RV • A random variable that can take any numeric value within a range of value. The range may be infinite or bounded at either both ends. X, representing Possible values of X The height of the students 150cm <X<170cm The weight of the students 45kg<X<85kg The time to complete a quiz 5 minutes to 10 minutes 61 PROBABILITY DENSITY FUNCITON (PDF) FOR CONTINUOUS RV • Theory 7 – Properties of the Probability Density Function (PDF) of Continuous RV 62 EXAMPLE 11 • Let X be a continuous RV of X with probability density function (PDF) • Show that the function is the PDF of X 63 SOLUTION 11 • Show that the function is the PDF of X ( ) = 2 = 2 2 1 =1 0 64 EXAMPLE 12 • The continuous RV of X has the probability distribution function: • Find – The value of k – P(0.5<X<1) – P(X>0.25) 65 SOLUTION 12 • Find the value of k: ( ) = 2 ( − ) = 2 2 − 2 3 1 =1 0 =3 66 SOLUTION 12 • Find P(0.5<X<1), k=3 6( − ) = . 6 6 − 2 3 1 = 0.5 0.5 • Find P(X>0.25), k=3 6( − . ) 6 6 = − 2 3 1 = 0.84 0.25 67 CUMULATIVE DISTRIBUTION FUNCTION OF CONTINUOUS RV • Theory 8 – The CDF of a continuous RV X is described as the function = ≤ = ( ) −∞< <∞ • F(x) is an increase function: =1 – lim → =0 – lim → 68 CUMULATIVE DISTRIBUTION FUNCTION OF CONTINUOUS RV • The CDF of a continuous RV X can be calculated by using the following formulas: ≤ = ( ) – > =1− ≤ =1− ( ) – < ≤ = ≤ ≤ = ≤ < = < < = − ( ) – 69 EXAMPLE 13 • The continuous RV of X has the probability distribution function • Find the CDF of X. By using it, calculate – P(X<0.5) – P(X>=0.8) – P(0.5<=X<0.8) 70 SOLUTION 13 • Find the CDF of X, k=3: = ≤ = < 0, 0< ( ) = ( ) −∞< <∞ =0 < 1, = ( ) + ( ) =0+ ( ) + ( ) + (6 − 6 ) =3 −2 (6 − 6 ) > 1, = ( ) =0+ + 0 =1 = 3 0, < 0 − 2 ,0 ≤ 1, ≥ 1 <1 71 SOLUTION 13 • P(X<0.5): ≤ = ( ) = 3 0.5 = 3(0.5) −2 0.5 = 0.5 0, < 0 − 2 ,0 ≤ 1, ≥ 1 <1 • P(X>=0.8): ≤ = ( ) ≥ 0.8 = 1 − ≤ 0.8 = 1 − 0.8 = 1 − 3 0.8 − 2 0.8 = 0.104 • P(0.5<=X<0.8): < ≤ = 0.5 ≤ < 0.8 = = 3 0.8 − 2 0.8 ≤ ≤ = ≤ < = < < = − ( ) − = 0.8 − 0.5 − 3 0.5 − 2 0.5 = 0.396 72 EXPECTED VALUE, VARIANCE, AND STANDARD VARIATION • Theory 9 – Expected value, µ @ E(X) of continuous RV • Theory 10 – Variance, of continuous RV • Theory 11 – The standard deviation, of the probability distribution of a continuous RV is the square root of the variance 73 EXAMPLE 14 • Let X be a continuous RV of X with probability density function (p.d.f) • Find the mean and variance of X 74 SOLUTION 14 • Mean and variance of X: = = = 1 2 = − 2 3 . . = = .2 2 = 3 .2 = 2 4 1 2 = = 0.66 0 3 1 1 = = 0.5 0 2 1 = 18 75 CHAPTER 1 FINISHED