### A box contains 54 red marbles, 9 white marbles, and 75 blue marbles. If a marble is randomly selected from the box,what is the probability that it is red or blue? Express your answer as a fraction or a decimal number rounded to four decimal places.

p.red<-54/(54+9+75)
p.blue<-75/(54+9+75)

p.red_or_blue <- p.red + p.blue
round(p.red_or_blue,4)
##  0.9348

### You are going to play mini golf. A ball machine that contains 19 green golf balls, 20 red golf balls, 24 blue golf balls, and 17 yellow golf balls, randomly gives you your ball. What is the probability that you end up with a red golf ball? Express your answer as a simplified fraction or a decimal rounded to four decimal places.

p.red<-20/(19+20+24+17)
round(p.red,4)
##  0.25

### A pizza delivery company classifies its customers by gender and location of residence. The research department has gathered data from a random sample of 1399 customers. The data is summarized in the table below. What is the probability that a customer is not male or does not live with parents? Write your answer as a fraction or decimal number rounded to four decimal places.

males<-(81+116+215+130+129)
females<-(228+79+252+97+72)
living_with_parents<-215+252
not_living_with_parents<-(81+228+116+79+130+97+129+72)
females_not_living_with_parents<-(228+79+97+72)
p.female_or_not_living_with_parents<-(females+not_living_with_parents-females_not_living_with_parents)/1399
round(p.female_or_not_living_with_parents,4)
##  0.8463

### Determine if the following events are independent. Going to the gym. Losing weight. Answer: A) Dependent B) Independent

The 2 events should be dependent because the conditional probability of losing weight when going to the gym is expected to be different from the unconditional probability of losing weight. Since one event has an impact on the probability of the other, they are not independent.

### A veggie wrap at City Subs is composed of 3 different vegetables and 3 different condiments wrapped up in a tortilla. If there are 8 vegetables, 7 condiments, and 3 types of tortilla available, how many different veggie wraps can be made?

(no.of.wraps<-3*choose(8,3)*choose(7,3))
##  5880

### Determine if the following events are independent. Jeff runs out of gas on the way to work. Liz watches the evening news. Answer: A) Dependent B) Independent

These 2 events are independent because their conditional probability should be the same as their unconditional probability, because the occurence of one does not impact the occurrence of the other.

### The newly elected president needs to decide the remaining 8 spots available in the cabinet he/she is appointing. If there are 14 eligible candidates for these positions (where rank matters), how many different ways can the members of the cabinet be appointed?

Since the rank matters, that means this is a permutation as opposed to a combination. n = 14 and r = 8.

(factorial(14)/factorial(6))
##  121080960

### A bag contains 9 red, 4 orange, and 9 green jellybeans. What is the probability of reaching into the bag and randomly withdrawing 4 jellybeans such that the number of red ones is 0, the number of orange ones is 1, and the number of green ones is 3? Write your answer as a fraction or a decimal number rounded to four decimal places.

The probability is equal to the number of ways in which 1 jellybean can be chosen from the 4 orange jellybeans, and 3 jellybeans can be chosen from the 9 green jellybeans, divided by the number of ways in which 4 jellybeans can be chosen from total of 22 jellybeans.

round(((choose(9,0)*choose(4,1)*choose(9,3))/choose(22,4)),4)
##  0.0459

### Evaluate the following expression. 11! / 7!

(factorial(11)/factorial(7))
##  7920

### Describe the complement of the given event. 67% of subscribers to a fitness magazine are over the age of 34.

The complement is: 33% of subscribers to a fitness magazine are 34 years or below.

### Step 1. Find the expected value of the proposition. Round your answer to two decimal places.

Since the order does not matter, this is a combination problem. The number of ways in which you can get exactly 3 heads in 4 coin tosses is 4!/3! i.e. 4 The total number of combinations is 2 ^ 4 = 16

(exp.value<-(4/16*97-12/16*30))
##  1.75

### Step 2. If you played this game 559 times how much would you expect to win or lose? (Losses must be entered negative.)

559*1.75
##  978.25

### Step 2. If you played this game 994 times how much would you expect to win or lose? (Losses must be entered as negative.)

(994*1.5)
##  1491

I’d expect to win \$1,491, if I played this game 994 times

### a. What is the probability that an individual is actually a liar given that the polygraph detected him/her as such? (Show me the table or the formulaic solution or both.)

$$P(Liar|PolygraphLiar)=P(Liar \cap PolygraphLiar)/P(PolygraphLiar$$

p(Liar)=0.2 Therefore p(TruthTeller)=1-0.2=0.8

p(PolygraphLiar|Liar)=0.59 Therefore p(PolygraphLiar and Liar)=0.20.59=0.118 Therefore p(PolygraphTruthTeller and Liar)=0.20.41=0.082

p(PolygraphTruthTeller|TruthTeller)=0.90 Therefore p(PolygraphTruthTeller and TruthTeller)=0.90.8=0.72 Therefore p(PolygraphLiar and TruthTeller)=0.10.8=0.08

p.liar<-0.2
p.poly.liar.and.liar<-0.118
p.poly.liar.and.truthteller<-0.08

(p.liar.given.poly.liar<-p.poly.liar.and.liar/(p.poly.liar.and.liar+p.poly.liar.and.truthteller))
##  0.5959596

### b. What is the probability that an individual is actually a truth-teller given that the polygraph detected him/her as such? (Show me the table or the formulaic solution or both.)

p.truthteller<-0.8
p.poly.truthteller.and.truthteller<-0.72
p.poly.truthteller.and.liar<-0.082

(p.truthteller.given.poly.truthteller<-p.poly.truthteller.and.truthteller/(p.poly.truthteller.and.truthteller+p.poly.truthteller.and.liar))
##  0.8977556

### 3 c. What is the probability that a randomly selected individual is either a liar or was identified as a liar by the polygraph? Be sure to write the probability statement.

This is equal to probability that the individual is a liar + probability that the polygraph detected the individual to be a liar - probability that the individual is a liar and the polygraph detected the individual to be a liar

p.poly.liar<-(p.poly.liar.and.liar+p.poly.liar.and.truthteller)

(p.liar.or.poly.liar=p.liar+p.poly.liar-p.poly.liar.and.liar)
##  0.28