7. Logic, Sets, and Counting
Total Page:16
File Type:pdf, Size:1020Kb
7. Logic, Sets, and Counting 7.3 Basic Counting Principles
Chemistry class – 13 males, 15 females Set M, set F, M F , M F , nM F , nM F
Algebra – 22 Math, 16 Physics, 7 double majors Set M, set P, M P, M P, nM P nM P
Addition Principle (for Counting)
For any two sets A and B, nA B nA nB nA B If A and B are disjoint, then nA B nA nB
According to a survey, 750 businesses offer health insurance to their employees, 640 offer dental insurance, and 280 offer both. How many offer health or dental insurance? Venn diagrams A city has two daily newspapers. A survey of 100 residents shows that 35 subscribe to the Sentinel, 60 to the Journal, and 20 to both.
A. How many subscribe to only the Sentinel? B. How many subscribe to only the Journal? C. How many subscribe to neither paper? D. Organize this information in a table. Multiplication Principle (for Counting)
A store stocks windbreaker jackets in S, M, L, and XL, and all are available in blue and red. What are the combined choices, and how many combined choices are there?
If two operations O1 and O2 are performed in order, with N1 possible outcomes of the first and N2 possible outcomes of the second, then there are
N1 N2 possible outcomes of the first followed by the second. How many ways can 3 letters and 3 numbers appear on a license plate?
4 letters and two numbers?
Suppose a university screening test is to consist of 5 questions, and the generating computer stores 5 comparable first questions, 8 second, 6 third, 5 fourth, and 10 fifth. How many different 5-question tests can be generated? How many 3-letter code words can be generated using the first 8 letters of the alphabet if:
A. No letter is repeated? B. Letters can be repeated? C. Adjacent letters cannot be alike? 7.4 Permutations and Combinations
Factorials
For n, a natural number, n! nn 1n 2⋯21 0!1 n! nn 1!
5!=
7! 6!
8! 5!
52! 5!47! Permutations
A permutation of a set of distinct objects is an arrangement of the objects in a specific order without repetition.
How many ways can 5 pictures be arranged on a wall?
Number of permutations of n objects
The number of permutations of n distinct objects without repetition, designated Pn,n , is
Pn,n nn 1⋯21 n! Permutations of n objects taken r at a time
How many ordered arrangements of 3 pictures can be formed from the 5 pictures above?
The number of permutations of n distinct objects taken r at a time, is given by
Pn,r nn 1⋯n r 1 or n! P n,r n r! Given the set A, B,C, how many permutations are there of this set taken 2 at a time? A. Using a tree diagram? B. Multiplication principle
C. Two formulas for Pn,r
Find the number of permutations of 13 objects taken 8 at a time. Combinations
A combination of n objects taken r at a time without repetition is an r-element subset of the set of n objects. The arrangement of the elements in the subset does not matter.
n Symbolism Cn,r r Combinations of n objects taken r at a time
The number of combinations of n objects taken r at a time without repetition is given by
n Cn,r = r P n,r r! n! r!n r!
From a committee of 10 people, A. How many ways can we choose a chair, vice-chair, and a secretary? B. How many ways can we choose a subcommittee of 3 people? Find the number of combinations of 13 objects taken 8 at a time.
Permutation order is vital Combination order is irrelevant
How many 5-card hands will have 3 aces and 2 kings? Serial numbers for a product are to be made using 2 letters followed by 3 numbers. If letters are selected from the first 8 letters of the alphabet with no repeats, and numbers are to be taken from the 10 digits (0-9), with no repeats, how many serial numbers are possible?
A company has 7 senior officers and 5 junior officers. How many ways can a 4-officer committee be formed composed of: A. any four officers B. 4 senior officers C. 3 seniors and a junior D. 2 seniors and 2 juniors E. at least 2 seniors 8. Probability 8.1 Sample Spaces, Events, and Probability
Theoretical approach, empirical approach
If we formulate a set S of outcomes (events) in such a way that each trial of an experiment has only one possible outcome out of a set, we call that set a sample space and each outcome, a simple outcome or simple event. An event E is defined to be any subset of S (including the empty set and the entire set). E is a simple event if it includes only one element, and a compound event if more than one.
Simple roulette wheel – 18 spaces S 1,2,3,⋯,17,18
Desired outcome: divisible by 4 E 4,8,12,16
Outcome is a prime number S 2,3,5,7,11,13,17
Outcome is the square of 4 S 16 Sample spaces A nickel and a dime are flipped. Sample space?
Possible outcomes
Number of heads
Match or Don’t match Rolling two dice
1 2 3 4 5 6 1 1,1 1,2 1,3 1,4 1,5 1,6 2 2,1 2,2 2,3 2,4 2,5 2,6 3 3,1 3,2 3,3 3,4 3,5 3,6 4 4,1 4,2 4,3 4,4 4,5 4,6 5 5,1 5,2 5,3 5,4 5,5 5,6 6 6,1 6,2 6,3 6,4 6,5 6,6
Some events:
Roll a 7 6,1,5,24,33,42,51,6
Roll 11
Sum less than 4
Sum of 12 Probability of an event Acceptable probability assignment Given a sample space
S e1,e2 ,⋯,en we assign a real number, denoted Pei , called the probability of event ei . 1. Each probability is between 0 and 1
0 Pei 1 2. Sum of all probabilities is 1.
Pe1 Pe2 ⋯ Pen 1
Tossing a coin S H,T
P H 1 P T 1 2 2
Theoretical approach
Empirical approach Probability of an event E
# favorable outcomes # possible outcomes
Given an acceptable probability assignment for simple events in sample space S, the probability of an arbitrary event E, denoted PE, is as follows: a. If E is the empty set, then PE 0. b. If E is a simple event, PE has already been assigned. c. If E is a compound event, then PE is the sum of the probabilities of the simple events in E. d. If E=S, PE 1. A nickel and a dime are flipped. Sample space S HH, HT,TH ,TT
Event ei HH HT TH TT 1 1 1 1 Pei 4 4 4 4
Probability of one head and one tail?
Probability of at least one head?
Probability of at least one head and at least one tail?
Probability of 3 heads? To find probability of an event E: 1. Setup an appropriate sample space S for the experiment. 2. Assign acceptable probabilities to each simple event in S. 3. To obtain the probability for an arbitrary event E, add the probabilities of the simple events in E.
Theoretical approach: We use assumptions and deductive reasoning to assign probabilities.
Empirical approach: We assign probabilities based on results of experiments.
Frequency f E
Relative frequency f E n
f E Empirical Probability PE lim n n Empirical Probability approximation frequency of occurrence of E PE f E total number of trials n
Equally likely assumption
In a sample space
S e1,e2 ,⋯,en with n elements, we assume that each simple event is as likely to occur as any other. Then ei P E 1 n
Rolling a prime number with die
PE Probability of an Arbitrary Event under an Equally Likely Assumption
If we assume that each simple event in simple space S is as likely to occur as any other, then the probability of an arbitrary event E in S is given by:
number of elements in E PE nE number of elements in S nS
Consider rolling two dice,
Roll 7 E16,1,5,24,33,42,51,6
PE1
Roll 11
PE2
Sum less than 4
PE3
Sum of 12 PE4 In drawing 5 cards from a 52 card deck without replacement, what is the probability of getting 5 spades?
PE
The board of regents is made up of 12 men and 16 women. If a committee of 6 is chosen at random, what is the probability that it will contain 3 men and 3 women?
PE 8.2 Union, Intersection, and Complement of Events; Odds
A B e S e A or e B
A∩B e S e A and e B
The event A or B is defined as A B
The event A and B is defined as A∩B.
Let A be the probability of rolling an odd number, and B be the probability of divisible by 3.
Probability of odd and divisible by 3?
Probability of odd or divisible by 3? Probability of a Union of Two Events
For any events A and B, PA B PA PB PA B If A and B are disjoint, then PA B PA PB
Probability of rolling a 7 or 11?
Probability of rolling less than 5 or doubles? Probability that a number 500 is exactly divisible by 3 or 4?
Complement of an Event
Suppose we divide S e1,e2 ,⋯,en into two disjoint subsets.
E ∩E' and E E' S .
Then E' is called the complement of E relative to S.
Also, PS PE E' PE PE' 1
PE 1 PE' PE' 1 PE If the probability of having a boy in a two child family is 0.75, what is the probability of 2 girls?
A shipment of 45 precision parts, including 9 that are defective, is sent to an assembly plant. The quality control division selects 10 parts at random for testing and rejects the entire shipment of 1 or more in the sample are found defective. What is the probability that the shipment will be rejected? In a group of n people, what is the probability that at least two people have the same birthday (same month/day, excluding 29 Feb) Odds PE PE Odds for E = PE 1 1 PE PE'
PE' Odds against E = PE 0 PE
Probability and Odds of rolling a 4 with one die:
1 Probability P4 6
PE Odds PE'
If the odds for an event E are a b, then the probability of E is a PE a b
If in repeated rolls of two fair dice, the odds of rolling a 5 before a 7 are 2 to 3, then the probability of rolling a 5 before a 7 is: Applications to Empirical Probability
Law of Averages The approximate empirical probability can be made as close to the actual probability as we please by making the sample size sufficiently large. From a survey of 1,000 people, it was determined that 500 people had tried a certain brand of diet soda, 600 had tried the brand of regular soda, and 200 had tried both. If a resident is selected at random, what is the (empirical) probability that: The resident has tried diet or regular soda? What are the (empirical) odds for this event?
The resident has tried one but not both? What are the (empirical) odds against this event? 8.3 Conditional Probability, Intersection, and Independence
Conditional Probability PA B
Occurrence of an event, given the occurrence of another event.
A=adult has lung cancer B=adult is a heavy smoker
What is the probability of rolling a prime number? nA PA nS
What is the probability of the number being prime if we know an odd number has occurred? nA∩B PA B nB Conditional Probability For events A and B in arbitrary sample space S, we define conditional probability of A given B by PA∩B PA B PB 0 PB
A pointer is spun once on a circular spinner with probabilities below:
ei 1 2 3 4 5 6
Pei .1 .2 .1 .1 .3 .2
A. What is the probability of landing on a prime number? B. What is the probability of landing on a prime number given it is an odd number? Suppose that past records in a large city produced the following probability data on a driver being in an accident on the last day of a Memorial Day weekend. Accident No accident Totals A A’ Rain R .025 .335 .360 No Rain R’ .015 .625 .640 Totals .040 .960 1.000
A. Find the probability of an accident, rain or no rain. B. Find the probability of rain, accident or no accident. C. Find the probability of accident and rain. D. Find the probability of accident, given rain. Intersection of Events: Product Rule
PA∩B PB ∩A PA B and PB A PB PA
Product Rule For events A and B with non-zero probabilities in a sample space S, PA∩B PAPB A PBPA B
If 60% of a department store’s customers are female and 75% of the female customers have charge accounts at the store, what is the probability that a customer selected at random is female and has a charge account? Probability Trees Two balls are drawn in succession, without replacement, from a box containing 3 blue and 2 white balls. What is the probability of drawing a white ball on the second draw? Constructing Probability Trees 1. Draw a tree diagram corresponding to all combined outcomes of the sequence of experiments. 2. Assign a probability to each branch. (Probability of event at right end of branch given the occurrence of the other events leading to it) 3. Use the results to answer various questions related to the sequence as a whole.
Computer company A subcontracts circuit board production 40% to company B, and 60% to company C. B subs 70% to D and 30% to E. Completed boards are shipped direct back to A. 1.5%, 1%, and .5% from D, E, and C, respectively prove defective in first 90 days. What is the probability of a defective board? Independent Events
Without replacement vs. with replacement Independence If A and B are events in sample space S, we say that A and B are independent iff PA B PAPB Otherwise, A and B are said to be dependent.
Thm 1 If A and B are independent events with nonzero probabilities, in a sample space S, then PA B PA and PB A PB
PA∩B PB ∩A Since PA B and PB A PB PA Testing for independence
Consider sample space of two coin tosses. S HH, HT,TH,TT and events A= head on first toss =HH, HT B= head on second toss =HH,TH
Draw a card from a deck A. E=drawn card is a spade. F=drawn card is a face card.
B. G=drawn card is a club. H=drawn card is a heart. A set of events is said to be independent if for each finite subset E1, E2 ,, En
PE1 ∩E2 ∩⋯∩En PE1 PE2 ⋯PEn
A space shuttle has 4 independent computer control systems. If the probability of failure (during flight) of any one system is 0.001, what is the probability of the failure of all four systems? 8.4 Bayes’ Formula
Probability of an earlier event, given a later event.
One urn has 3 blue and 2 white balls, a second urn has 1 blue and 3 white balls. A single fair die is rolled, and if 1 or 2 comes up, the ball is drawn from the first urn, otherwise ball is drawn from the second urn. If the drawn ball is blue, what is the probability that it came from the first urn? M c U a d N S b e M V f N
PM U
PU M Bayes’ Formula
Let U 1,U 2 ,,U n be mutually exclusive events whose union is sample space S. Let E be an arbitrary event in S such that PE 0. Then, PU ∩E PU E 1 1 PE PU ∩E 1 PU1 ∩E PU 2 ∩E⋯ PU n ∩E PEU PU 1 1 PEU1 PU1 PEU1 PU1 ⋯ PEU1 PU1
product of branch prob to E thru U PU E 1 1 sum of all branches to E Tuberculosis screening A trusted test for TB shows 8% of 1000 in a test group have TB. A new test indicates TB in 96% who have it, and in 2% who do not have it. What is the probability of a random person having it testing positive? What is the probability of a person not having it testing positive? A company produces 1000 refrigerators a week. Plant A produces 350, plant B produces 250, and plant C produces 400. Records indicate 5% from plant A, 3% from plant B, and 7% from plant C are defective. If a refrigerator is found to be defective, what is the probability it is from plant A? 8.5 Random Variable, Probability Distribution, and Expected Value
A random variable is a function that assigns a numerical value to each simple event in a sample space S.
3 coin tosses
TTT TTH THT HTT THH HTH HHT HHH px where x 0,1,2,3 Probability distribution of the random variable X Exactly 2 heads occur E THH, HTH, HHT
nE 3 p2 nS 8
The probability distribution of a random variable X, denoted by PX x px, satisfies 1. 0 px 1
2. px1 px2 ⋯ pxn 1 where x1, x2 ,⋯, xnare the values of X. Expected value of a Random Variable
n E X x p x i i i
Given the probability distribution for the random variable X, xi x1 x2 ⋯ xn pi p1 p2 ⋯ pn where pi pxi , we define the expected value of X, denoted EX , by the formula
EX x1 p1 x2 p2 ⋯ xn pn
What is the expected value of the number of dots facing up on the roll of a single die? A carton of 20 laptop batteries contains 2 dead ones. A random sample of 3 is selected from the 20 and tested. Let X be the random variable associated with the number of dead batteries found in a sample. A. Find the probability distribution of X. B. Find the expected number of dead batteries in a sample. A spinner device is numbered 0 to 5, each number is equally likely to occur. Any player who bets $1 on any given number wins $4 (and gets his bet back) if the pointer lands on the chosen number, otherwise, the $1 is lost. What is the expected value of the game? Suppose you are considering insurance on a $2000 car video system against theft. The company charges $225/year, claiming empirical probability of 0.1 that the stereo will be stolen some time during the coming year. What is the expected return to the insurance company if you take out this policy?
Consider exam scores 85, 73, 82, 65, 95, 85, 73, 75, 85, and 75.
Class average (mean)
EX Decision analysis An outdoor concert featuring a very popular musical group is scheduled for Sunday afternoon in a large open stadium. The promoter, worried about a rainout, hears from a forecaster the probability of rain is 0.24. If it does not rain, the promoter will net $100,000, if it does rain, the promoter will net $10,000. An insurance company agrees to insure the concert for $100,000 against rain at a premium of $20,000. Should the promoter buy the insurance? 11. Data Description and Probability Distributions 11.2 Measures of Central Tendency
Measures that indicate the approximate center of a distribution are called measures of central tendency.
Measures that indicate the amount of scatter about a central point are called measures of dispersion.
Mean The mean of a set of quantitative data is equal to the sum of all measurements in the data set divided by the total number of measurements in the set.
Notation: x =sample mean =population mean
n xi x1 x2 ⋯ xn i1 Mean: ungrouped data
If x1, x2 ,⋯, xn is a set of measurements, then the mean is the set of measurements is given by: n x i x x ⋯ x i1 1 2 n n n Use symbol x for sample mean or for population mean.
Find the mean for sample measurements 3, 5, 1, 8, 6, 5, 4, and 6. Mean: grouped data A data set of n measurements is grouped into k classes in a frequency table. If xi is the midpoint of the ith class interval and fi is the ith class frequency, the mean for the grouped data n x f is given by i i x f x f ⋯ x f i1 1 1 2 2 n n n n Use symbol x for sample mean or for population mean.
Note that n is the total number of measurements in all the classes, not the number of classes. Class interval Midpoint Frequency Product 299.5-349.5 324.5 1 324.5 349.5-399.5 374.5 2 749.0 399.5- 449.5 424.5 5 2122.5 449.5- 499.5 474.5 10 4745.0 499.5-549.5 524.5 21 11014.5 549.5-599.5 574.5 20 11490.0 599.5- 649.5 624.5 19 11865.5 649.5- 699.5 674.5 11 7419.5 699.5- 749.5 724.5 7 5071.5 749.5- 799.5 774.5 4 3098.0 Suppose the annual salaries of seven people in a small company are $34k, $36k, $36k, $40k, $48k, $56k, and $156k. x =
Median If the number of measurements in a set is odd, the median is the middle measurement, when the measurements are arranged in ascending or descending order.
If the number of measurements in a set is even, the median is the mean of the two middle measurements, when the measurements are arranged in ascending or descending order. Median for grouped data The median for grouped data with no classes of frequency 0 is the number such that the histogram has the same area to the left of the median as to the right of the median.
Class interval Frequency 3.5- 4.5 3 4.5-5.5 1 5.5- 6.5 2 6.5- 7.5 4 7.5-8.5 3 8.5-9.5 2 Mode The mode is the most frequently occurring measurement in the data set.
4,5,5,5,6,6,7,8,12
1,2,3,3,3,5,6,7,7,7,23
1,3,5,6,7,9,11,15,16 11.3 Measures of Dispersion
Range
The range for a set of ungrouped data is the difference between the largest and the smallest values in the data set.
The range for a frequency distribution is the difference between the upper boundary of the highest class and the lowest boundary of the lowest class. Standard Deviation: Ungrouped data
5.2, 5.3, 5.2, 5,5, 5.3
n x i x x ⋯ x x i1 1 2 n n n
n 2 xi x variance = i1 n
n 2 xi x standard deviation = i1 n Definitions: The sample variance s2 of a set of n sample
measurements x1, x2 ,⋯, xn with mean x is given by n 2 xi x i1 n 1 If x1, x2 ,⋯, xn is the whole population with mean , then the population variance 2 is given by n 2 xi i1 n The sample standard deviation s of a set of n sample measurements x1, x2 ,⋯, xn with mean x is given by n 2 xi x i1 n 1
If x1, x2 ,⋯, xn is the whole population with mean , then the population standard deviation is given by n 2 xi i1 n Find the standard deviation for the sample measurements 1,3,5,4,3
Standard Deviation: grouped data Suppose a data set of n sample measurementsis grouped into k classes in a frequency table, where xi is the midpoint and fi is the frequency of the ith class interval. Then the sample standard deviation s for the grouped data is n 2 xi x fi i1 n 1 k f where i1 i = the total number of measurements. If x1, x2 ,⋯, xn is the whole population with mean , then the population standard deviation is given by n 2 xi fi i1 n
Find the standard deviation for each set of grouped sample data: 11.4 Bernoulli Trials and Binomial Distributions
An experiment for which there are only two possible outcomes E or E’, is called a Bernoulli experiment or trial.
Jacob Bernoulli (1654-1705)
Coin flip 7 or not 7 vaccination works or not
PS p PF 1 p q
Probability of rolling a 6 with one die
Suppose a probability experiment is repeated 5x, probability of SSFFS? Bernoulli Trials A sequence of experiments is called a sequence of Bernoulli trials, or a binomial experiment if: 1. Only two outcomes are possible on each trial. 2. The probability of each success p for each trial is constant. 3. All trials are independent.
If we roll a die 5x, and define success as rolling a 1, what is the probability of SFFSS occurring?
Find the probability of the outcome FSSSF.
How many different ways can we roll exactly three 1’s?
What is the probability of rolling exactly 3 ones? Probability of x successes in n Bernoulli trials
The probability of exactly x successes in n independent repeated Bernoulli trials, with the probability of success of each trial p (and failure q), is x nx P(x successes)=Cn,x p q
What is the probability of rolling exactly two 3’s?
What is the probability of rolling at least two 3’s? Binomial Formula a b1 a b2 a b3 a b4 a b5
Binomial Formula For a natural number n, n n n1 n2 2 n a b Cn,0a Cn,1a b Cn,2a b ⋯ Cn,nb
q p3 Binomial Distribution
3 coin tosses px where x 0,1,2,3
Simple Event Probability of X 3 PX 3 x Simple Event x success in 3 trials TTT=FFF 0 TTH=FFS THT=FSF 1 HTT=SFF THH=FSS HTH=SFS 2 HHT=SSF HHH=SSS 3 Binomial Distribution
PX n x P(x successes in n trials) x nx Cn,x p q x 0,1,2,,n where p is the probability of success and q is the probability of failure on each trial.
Suppose a fair die is rolled three times; success is considered a roll of a number divisible by 3.
Probability function
x Px 0 1 2 3 Mean and Standard Deviation
Mean: np Standard Deviation: npq
Compute mean and standard deviation for previous example 11.5 Normal Distributions
1 2 2 f x ex / 2 2
Normal Curves 1. Normal curves are bell shaped and are symmetrical with respect to a vertical line. 2. The mean is at the point where the axis of symmetry intersects the horizontal axis 3. The shape of the normal curve is completely determined by its mean and standard deviation. 4. The area under this curve is 1. 5. 68.3% of the area is within 1 SD, 95.4% is within 2SD, 99.7% is within 3 SD. A manufacturing process produces light bulbs with life expectancies that are normally distributed with a mean of 500 hours and a standard deviation of 100 hours. What percentage of bulbs can be expected to last between 500 hours and 670 hours?
x z From all the light bulbs produced, what is the probability of a light bulb chosen at random lasting between 380 and 500 hours?
Normal Probability Distribution 1. Pa x b area under normal curve, a to b. 2. P x 1 3. Px c 0
What is the probability of a light bulb having a life of exactly 621 hours? Approximating a Binomial Distribution with a Normal Distribution
A credit card company claims that their card is used by 40% of the people buying gasoline in a particular city. A random sample of 20 gasoline purchasers is made.
What is the probability that 6 to 12 people in the sample use the card? What is the probability that less than 4 people in the sample use the card?
Rule of Thumb test Use of a normal distribution to approximate a binomial distribution is justified iff the interval 3 , 3 lies entirely in the interval from 0 to n. A company manufactures 50,000 ballpoint pens each day. The manufacturing process produces 50 defective pens per 1000 on the average. A random sample of 400 pens is selected from each day’s production for test. What is the probability that the sample contains:
A. At least 14 and no more than 25 defective pens? B. 33 or more defective pens?