Processing math: 76%

1. There are 540 identical plastic chips numbered 1 through 540 in a box. What is the probability of reaching into the box and randomly drawing the chip numbered 505? Express your answer as a fraction or a decimal number rounded to four decimal places.

chips<-round(1/540,4)
chips
## [1] 0.0019

2. Write out the sample space for the given experiment. Separate your answers using commas. When deciding what you want to put into a salad for dinner at a restaurant, you will choose one of the following extra toppings: asparagus, cheese. Also, you will add one of following meats: eggs, turkey. Lastly, you will decide on one of the following dressings: French, vinaigrette. (Note: Use the following letters to indicate each choice: A for asparagus, C for cheese, E for eggs, T for turkey, F for French, and V for vinaigrette.)

toppings<-c('A','C')
meats<-c('E','T')
dressings<-c('F','V')

combinations<-function(a,b,c){
  for(i in a){
    for(j in b) {
      for(k in c) {
        vect<-paste0(c(i,j,k), collapse=",")
        print(vect)
      }
    }
  }
}

combinations(toppings,meats,dressings)
## [1] "A,E,F"
## [1] "A,E,V"
## [1] "A,T,F"
## [1] "A,T,V"
## [1] "C,E,F"
## [1] "C,E,V"
## [1] "C,T,F"
## [1] "C,T,V"

3. A card is drawn from a standard deck of 52 playing cards. What is the probability that the card will be a heart and not a face card? Write your answer as a fraction or a decimal number rounded to four decimal places.

There are 10 heart not face cards out of 52.

round(10/52,4)
## [1] 0.1923

4. A standard pair of six-sided dice is rolled. What is the probability of rolling a sum less than 6? Write your answer as a fraction or a decimal number rounded to four decimal places.

i<-0
j<-0
for(dice1 in 1:6){
  for(dice2 in 1:6){
    if(sum(dice1,dice2)<6){
      i<-i+1
    }
    j<-j+1
  }
}
probability<-round(i/j,4)
probability
## [1] 0.2778

5. A pizza delivery company classifies its customers by gender and location of residence. The research department has gathered data from a random sample of 2001 customers. The data is summarized in the table below.

Gender and Residence of Customers
,Males, Females
Apartment, 233, 208
Dorm, 159, 138
With Parent(s), 102, 280
Sorority/Fraternity House, 220, 265
Other, 250, 146

What is the probability that a customer is male? Write your answer as a fraction or a decimal number rounded to four decimal places.

P(Male|TotalGender)=P(Male)/P(TotalGender)

probability<-round(sum(233,159,102,220,250)/2001,4)
probability
## [1] 0.4818

6. Three cards are drawn with replacement from a standard deck. What is the probability that the first card will be a club, the second card will be a black card, and the third card will be a face card? Write your answer as a fraction or a decimal number rounded to four decimal places.

the first card will be a club = (13/52)

the second card will be a black card = (26/52)

the third card will be a face card = (12/52)

probability<-round((13/52)*(26/52)*(12/52),4)
probability
## [1] 0.0288

7. Two cards are drawn without replacement from a standard deck of 52 playing cards. What is the probability of choosing a spade for the second card drawn, if the first card, drawn without replacement, was a heart? Write your answer as a fraction or a decimal number rounded to four decimal places.

P1 = the probability of choosing a heart for the first card drawn = (13/52)

P2 = the probability of choosing a spade for the second card drawn = (13/51)

without replacement conditional probability rule: P=(P1P2)/P1

probability<-round(((13/52)*(13/51))/(13/52),4)
probability
## [1] 0.2549

8. Two cards are drawn without replacement from a standard deck of 52 playing cards. What is the probability of choosing a heart and then, without replacement, a red card? Write your answer as a fraction or a decimal number rounded to four decimal places.

the probability of choosing a heart = (13/52)

the probability of choosing a red card = (25/51)

probability<-round((13/52)*(25/51),4)
probability
## [1] 0.1225

9. There are 85 students in a basic math class. The instructor must choose two students at random.

Students in a Basic Math Class
Males Females
Freshmen 12 12
Sophomores 19 15
Juniors 12 4
Seniors 7 4

What is the probability that a junior female and then a freshmen male are chosen at random? Write your answer as a fraction or a decimal number rounded to four decimal places.

probability<-round((4/85)*(12/84),4)
probability
## [1] 0.0067

10. Out of 300 applicants for a job, 141 are male and 52 are male and have a graduate degree.

Step 1. What is the probability that a randomly chosen applicant has a graduate degree, given that they are male? Enter your answer as a fraction or a decimal rounded to four decimal places.

Step 2. If 102 of the applicants have graduate degrees, what is the probability that a randomly chosen applicant is male, given that the applicant has a graduate degree? Enter your answer as a fraction or a decimal rounded to four decimal places.

Step 1 - P(MaleGrad|Male)=P(MaleGrad)/P(Male)=(52/300)/(141/300)=52/141

Step 2 - P(Male|TotalGrad)=P(Male)/P(TotalGrad)=(52/300)/(102/300)=52/102

# step 1
probability1<-round(52/141,4)
probability1
## [1] 0.3688
# step 2
probability2<-round(52/102,4)
probability2
## [1] 0.5098

11. A value meal package at Ron’s Subs consists of a drink, a sandwich, and a bag of chips. There are 6 types of drinks to choose from, 5 types of sandwiches, and 3 types of chips. How many different value meal packages are possible?

drink<-c(6)
sandwich<-c(5)
chips<-c(3)

count<-0
combinations<-function(a,b,c){
  for(i in 1:a){
    for(j in 1:b) {
      for(k in 1:c) {
        count<-count+1
      }
    }
  }
  print(paste("Possible different value meal = ",count))
}

combinations(drink,sandwich,chips)
## [1] "Possible different value meal =  90"

12. A doctor visits her patients during morning rounds. In how many ways can the doctor visit 5 patients during the morning rounds?

Formula: P(n)=n!

patients<-5
print(paste("Possible ways can the doctor visit patients = ",factorial(patients)))
## [1] "Possible ways can the doctor visit patients =  120"

13. A coordinator will select 5 songs from a list of 8 songs to compose an event’s musical entertainment lineup. How many different lineups are possible?

Permutation Formula: P(n,k)=n!/(nk)!

songs<-5
total_songs<-8
print(paste("Lineups for ",songs," out of ",total_songs," songs = ",factorial(total_songs)/factorial(total_songs - songs)))
## [1] "Lineups for  5  out of  8  songs =  6720"

14. A person rolls a standard six-sided die 9 times. In how many ways can he get 3 fours, 5 sixes and 1 two?

fours<-3
sixes<-5
two<-1
dice_rolled_9_times<-9
print(paste("Ways to get ",fours," fours, ",sixes," sixes and ",two," two = ",factorial(dice_rolled_9_times)/(factorial(fours)*factorial(sixes)*factorial(two))))
## [1] "Ways to get  3  fours,  5  sixes and  1  two =  504"

15. How many ways can Rudy choose 6 pizza toppings from a menu of 14 toppings if each topping can only be chosen once?

Combination Formula: P(n,k)=n!/k!(nk)!

toppings<-6
total_toppings<-14
print(paste("Ways to choose ",toppings," toppings from a menu of ",total_toppings," toppings = ",factorial(total_toppings)/(factorial(toppings)*factorial(total_toppings - toppings))))
## [1] "Ways to choose  6  toppings from a menu of  14  toppings =  3003"

16. 3 cards are drawn from a standard deck of 52 playing cards. How many different 3-card hands are possible if the drawing is done without replacement?

cards<-3
total_cards<-52
print(paste("Possible ways to draw",cards,"cards from",total_cards,"cards (without replacement) = ",round(factorial(total_cards)/(factorial(cards)*factorial(total_cards - cards)))))
## [1] "Possible ways to draw 3 cards from 52 cards (without replacement) =  22100"

17. You are ordering a new home theater system that consists of a TV, surround sound system, and DVD player. You can choose from 12 different TVs, 9 types of surround sound systems, and 5 types of DVD players. How many different home theater systems can you build?

TVs<-12
surround_sound_systems<-9
DVD_players<-5

count<-0
combinations<-function(a,b,c){
  for(i in 1:a){
    for(j in 1:b) {
      for(k in 1:c) {
        count<-count+1
      }
    }
  }
  print(paste(count, "home theater systems can be built with",TVs,"TVs,",surround_sound_systems,"surround_sound_systems and",DVD_players,"DVD_players"))
}

combinations(TVs,surround_sound_systems,DVD_players)
## [1] "540 home theater systems can be built with 12 TVs, 9 surround_sound_systems and 5 DVD_players"

18. You need to have a password with 5 letters followed by 3 odd digits between 0 - 9 inclusively. If the characters and digits cannot be used more than once, how many choices do you have for your password?

letters<-5
total_letters<-26
digits<-3
total_digits<-10
print(paste("Password with",letters,"letters with",digits,"digits = ",(factorial(total_letters)/factorial(total_letters - letters))*(factorial(total_digits)/factorial(total_digits - digits))))
## [1] "Password with 5 letters with 3 digits =  5683392000"

19. Evaluate the following expression.

9P4 9P4 = Permutation(9,4)

permutation<-factorial(9)/factorial(9-4)
permutation
## [1] 3024

20. Evaluate the following expression.

11C8 11C8 = Combination(11,8)

combination<-factorial(11)/(factorial(8)*factorial(11-8))
combination
## [1] 165

21. Evaluate the following expression.

12P8/12C4�812𝐶𝐶4

permutation=function(a,b){factorial(a)/factorial(a-b)}
combination=function(a,b){factorial(a)/(factorial(b)*factorial(a-b))}
eval<-permutation(12,8)/combination(12,4)
eval
## [1] 40320

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

cabinets<-7
candidates<-13
permutation=function(a,b){factorial(a)/factorial(a-b)}
permutation(candidates,cabinets)
## [1] 8648640

23. In how many ways can the letters in the word ‘Population’ be arranged?

word<-c('Population')
total_letters<-nchar(word)
repeated_p<-2
repeated_o<-2

print(paste("Ways to arrange the word '",word,"' =",factorial(total_letters)/(factorial(repeated_p)*factorial(repeated_o))))
## [1] "Ways to arrange the word ' Population ' = 907200"

24. Consider the following data:

x 5 6 7 8 9
𝒑𝒑(𝒙𝒙) 0.1 0.2 0.3 0.2 0.2

Step 1. Find the expected value E( X ). Round your answer to one decimal place.

Step 2. Find the variance. Round your answer to one decimal place.

Step 3. Find the standard deviation. Round your answer to one decimal place.

Step 4. Find the value of P(X >= 9). Round your answer to one decimal place.� ê 9). Round your answer to one decimal place.

Step 5. Find the value of P(X <= 7). Round your answer to one decimal place.

Step 1 - E(x) = sum(x*p(x))

Step 2 - Var(x) = sum((x^2 - E(x))^2 * px)

Step 3 - SD(x) = sqrt(Var(x))

Step 4 - E(x) = sum((x>=9)*p(x))

Step 5 - E(x) = sum((x<=7)*p(x))

x<-c(5,6,7,8,9)
px<-c(0.1,0.2,0.3,0.2,0.2)

# step 1
print(paste("E(x) = ",round(sum(x*px),1)))
## [1] "E(x) =  7.2"
# step 2
print(paste("Var(x) = ",round(sum((x - sum(x*px))^2 * px),1)))
## [1] "Var(x) =  1.6"
# step 3
print(paste("SD(x) = ",round(sqrt(sum((x - sum(x*px))^2 * px)),1)))
## [1] "SD(x) =  1.2"
# step 4
print(paste("E(x) = ",round(sum((x>=9)*px),1)))
## [1] "E(x) =  0.2"
# step 5
print(paste("E(x) = ",round(sum((x<=7)*px),1)))
## [1] "E(x) =  0.6"

25. Suppose a basketball player has made 188 out of 376 free throws. If the player makes the next 3 free throws, I will pay you $23. Otherwise you pay me $4.

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

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

Step 1 - E(x) = sum(xp(x)^3 + x(1-p(x)^3))

Step 2 - E1(x) = 994 * E(x)

x1<-23
x2<--4
px<-188/376

# step 1
print(paste("E(x) = ",round(sum(x1*px^3 + x2*(1-px^3)),2)))
## [1] "E(x) =  -0.62"
# step 2
print(paste("994 * E(x) = ",994 * round(sum(x1*px^3 + x2*(1-px^3)),2)))
## [1] "994 * E(x) =  -616.28"

26. Flip a coin 11 times. If you get 8 tails or less, I will pay you $1. Otherwise you pay me $7.

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

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

Step 1 - E(x) = sum(xp(x)^3 + x(1-p(x)^3))

Step 2 - E1(x) = 615 * E(x)

x1<-1
x2<--7
n<-11
k<-8
val<-0

for(i in 1:k){
  val<-val+(factorial(n)/(factorial(i)*factorial(n-i)))
}

px<-val/2^11
# step 1
print(paste("E(x) = ",round(sum(x1*px + x2*(1-px)),2)))
## [1] "E(x) =  0.73"
# step 2
print(paste("E(x) = ",round(615*sum(x1*px + x2*(1-px)),2)))
## [1] "E(x) =  451.64"

27. If you draw two clubs on two consecutive draws from a standard deck of cards you win $583. Otherwise you pay me $35. (Cards drawn without replacement.)

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

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

Step 1 - E(x) = sum(xp(x) + x(1-p(x)))

Step 2 - E1(x) = 632 * E(x)

x1<-583
x2<--35
px<-(13/52)*(12/51)
  
# step 1
print(paste("E(x) = ",round(sum(x1*px + x2*(1-px)),2)))
## [1] "E(x) =  1.35"
# step 2
print(paste("E(x) = ",round(632*1.35,2)))
## [1] "E(x) =  853.2"

28. A quality control inspector has drawn a sample of 10 light bulbs from a recent production lot. If the number of defective bulbs is 2 or less, the lot passes inspection. Suppose 30% of the bulbs in the lot are defective. What is the probability that the lot will pass inspection? (Round your answer to 3 decimal places)

n<-10
k<-2

print(paste("P(x) = ",round(pbinom(k, size = n, prob = 0.3),3)))
## [1] "P(x) =  0.383"

29. A quality control inspector has drawn a sample of 5 light bulbs from a recent production lot. Suppose that 30% of the bulbs in the lot are defective. What is the expected value of the number of defective bulbs in the sample? Do not round your answer.

n<-5
print(paste("P(x) = ", n*0.3))
## [1] "P(x) =  1.5"

30. The auto parts department of an automotive dealership sends out a mean of 5.5 special orders daily. What is the probability that, for any day, the number of special orders sent out will be more than 5? (Round your answer to 4 decimal places)

Poisson’s distribution: for k=5: p(k)=(λ^k⋅e^(−λ))/k!

for k>5: ppois(k, λ, lower.tail = FALSE)

# for k=5: round(((5.5)^5*exp(-5.5))/factorial(5),4)
# for k>5 (this will answer the question above):
round(ppois(5, 5.5, lower.tail = FALSE),4)
## [1] 0.4711

31. At the Fidelity Credit Union, a mean of 5.7 customers arrive hourly at the drive-through window. What is the probability that, in any hour, more than 4 customers will arrive? (Round your answer to 4 decimal places)

round(ppois(4, 5.7, lower.tail = FALSE),4)
## [1] 0.6728

32. The computer that controls a bank’s automatic teller machine crashes a mean of 0.4 times per day. What is the probability that, in any 7-day week, the computer will crash no more than 1 time? (Round your answer to 4 decimal places)

# λ = 0.4 times/day * 1 day * 7 times
round(ppois(1, 0.4*1*7, lower.tail = TRUE),4)
## [1] 0.2311

33. A town recently dismissed 8 employees in order to meet their new budget reductions. The town had 6 employees over 50 years of age and 19 under 50. If the dismissed employees were selected at random, what is the probability that more than 1 employee was over 50? Write your answer as a fraction or a decimal number rounded to three decimal places.

Hypergeometric distribution: phyper(q, m, n, k, lower.tail = TRUE, log.p = FALSE)

employees_over_50<-6
employees_under_50<-19
dismissed<-8
df<-data.frame(employees_over_50, employees_under_50,dismissed)
q<-1
prob_more_than_1_over_50<-round(phyper(q, df$employees_over_50, df$employees_under_50, df$dismissed, lower.tail=FALSE),3)
cbind(df, prob_more_than_1_over_50)
##   employees_over_50 employees_under_50 dismissed prob_more_than_1_over_50
## 1                 6                 19         8                    0.651

34. Unknown to a medical researcher, 10 out of 25 patients have a heart problem that will result in death if they receive the test drug. Eight patients are randomly selected to receive the drug and the rest receive a placebo. What is the probability that less than 7 patients will die? Write your answer as a fraction or a decimal number rounded to three decimal places.

patients_with_heart_problem<-10
patients_with_no_heart_problem<-25-10
selection<-8
df<-data.frame(patients_with_heart_problem, patients_with_no_heart_problem, selection)
q<-6 # < 7
prob_less_than_7_patients<-round(phyper(q, df$patients_with_heart_problem, df$patients_with_no_heart_problem, df$selection, lower.tail=TRUE),3)
cbind(df, prob_less_than_7_patients)
##   patients_with_heart_problem patients_with_no_heart_problem selection
## 1                          10                             15         8
##   prob_less_than_7_patients
## 1                     0.998