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
print(round(1/540,4))
## [1] 0.0019
  1. 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 forcheese, 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')
sample_space <-c ('')
for (t in Toppings){
    for (m in Meats){
      for (d in Dressings){
        # print(paste0(t,m,d),sep=",")
        if (sample_space==''){
          sample_space = paste0(t,m,d)
        }
        else{
          sample_space = paste(sample_space,paste0(t,m,d),sep=",")
        }
        
      }
    }
}
print(sample_space)
## [1] "AEF,AEV,ATF,ATV,CEF,CEV,CTF,CTV"
  1. 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. Nbr of Cards: 52 Nbr of Hearts: 13 Nbr of non-FC Hearts: 10
# Total# of cards =52 (sample space)
card_deck <- 52
# Total# of hearts =13
hearts <- 13
# Total# of noc-face hearts =10
non_face_hearts <- 10
round(non_face_hearts/card_deck,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.

library(mosaic)
## Loading required package: dplyr
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
## Loading required package: lattice
## Loading required package: ggformula
## Loading required package: ggplot2
## 
## New to ggformula?  Try the tutorials: 
##  learnr::run_tutorial("introduction", package = "ggformula")
##  learnr::run_tutorial("refining", package = "ggformula")
## Loading required package: mosaicData
## Loading required package: Matrix
## 
## The 'mosaic' package masks several functions from core packages in order to add 
## additional features.  The original behavior of these functions should not be affected by this.
## 
## Note: If you use the Matrix package, be sure to load it BEFORE loading mosaic.
## 
## Attaching package: 'mosaic'
## The following object is masked from 'package:Matrix':
## 
##     mean
## The following objects are masked from 'package:dplyr':
## 
##     count, do, tally
## The following objects are masked from 'package:stats':
## 
##     binom.test, cor, cor.test, cov, fivenum, IQR, median,
##     prop.test, quantile, sd, t.test, var
## The following objects are masked from 'package:base':
## 
##     max, mean, min, prod, range, sample, sum
dice <- expand.grid(1:6, 1:6)
dice$total = dice$Var1 + dice$Var2
sum_less_than_6 <- filter(dice, dice$total < 6)
round(count(sum_less_than_6)/count(dice), 4)
##        n
## 1 0.2778
  1. 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

Residence(types) 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.

male_customers <- c(233, 159, 102, 220, 250)
female_customers <- c(208, 138, 280, 265, 146)
round(sum(male_customers)/sum(male_customers+female_customers), 4)
## [1] 0.4818
  1. 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.
club_card <- round(13/52,4)
black_card <- round(26/52,4)
face_card <- round(12/52,4)

print(paste("probability of 1st card is club : ",club_card))
## [1] "probability of 1st card is club :  0.25"
print(paste("probability of 2nd card is balck card : ",black_card))
## [1] "probability of 2nd card is balck card :  0.5"
print(paste("probability of 3rd card is face card : ",face_card))
## [1] "probability of 3rd card is face card :  0.2308"
round(club_card * black_card * face_card, 4)
## [1] 0.0288
  1. 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.
heart_card <- round(13/52,4)
club_card <- round(13/51,4)
round((heart_card*club_card)/ heart_card, 4)
## [1] 0.2549
  1. 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.
heart_card_09 <- 13/52
red_card_09 <- 25/51

round(heart_card_09 * red_card_09, 4)
## [1] 0.1225
  1. There are 85 students in a basic math class. The instructor must choose two students at random.

Students in a Basic Math Class

Student(types) Males Females
Freshmen 12 12
Sophomores 19 15
Juniors 12 4
Seniors 7 4
total_juniors_female <-4
total_freshmen_female <-12
total_students <- (12+12+19+15+12+4+7+4)

juniors_female_odds = round(total_juniors_female/total_students,4)
freshmen_female_odds = round(total_freshmen_female/total_students,4)

print(paste(round(juniors_female_odds*freshmen_female_odds,4)))
## [1] "0.0067"
  1. 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.

round(52/141, 4)
## [1] 0.3688

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.

round(52/102, 4)
## [1] 0.5098
  1. 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?
subs_drinks <- c('D1','D2','D3','D4','D5','D6')
subs_sandwiches <- c('S1','S2','S3','S4','S5')
subs_chips <- c('C1','C2','C3')

TotalMealCounter <- 0
for (d in subs_drinks){
  for (s in subs_sandwiches){
    for (c in subs_chips){
      TotalMealCounter <- TotalMealCounter +1
    }
  }
}

print(TotalMealCounter)
## [1] 90
  1. A doctor visits her patients during morning rounds. In how many ways can the doctor visit 5 patients during the morning rounds?
factorial(5)
## [1] 120
  1. 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 <- function(n,r){
  return(factorial(n)/(factorial(n-r)))
}

print(Permutation(8,5))
## [1] 6720
  1. A person rolls a standard six-sided die 9 times. In how many ways can he get 3 fours, 5 sixes and 1 two?
totaldie_roll <- 9
fours <- 3
sixes <- 5
twos <- 1

print(paste0("The number of ways to get 3 fours, 5 sixes and 1 two with six sided die being rolled 9 times is ",factorial(totaldie_roll)/(factorial(fours)*factorial(sixes)*factorial(twos))))
## [1] "The number of ways to get 3 fours, 5 sixes and 1 two with six sided die being rolled 9 times is 504"
  1. How many ways can Rudy choose 6 pizza toppings from a menu of 14 toppings if each topping can only be chosen once?
pizzaToppingCombination <- function(n,r){
  factorial(n)/(factorial(n-r)*factorial(r))
} 
print(pizzaToppingCombination(14,6))
## [1] 3003
  1. 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?
cardCombination <- function(n,r){
  factorial(n)/(factorial(n-r)*factorial(r))
}
print(cardCombination(52,3))
## [1] 22100
  1. 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?
TV <- 12
Sound <-9
DVD <- 5

prod(c(TV, Sound, DVD))
## [1] 540
  1. 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?
pwdCmbn <- function(n,r){
  factorial(n)/factorial(n - r)
}
print((pwdCmbn(26,5)*pwdCmbn(5,3)))
## [1] 473616000
  1. Evaluate the following expression \(_{9}P_{4}\)
PermutationFn <- function(n,r){
  return(factorial(n)/(factorial(n-r)))
}

print(PermutationFn(9,4))
## [1] 3024
  1. Evaluate the following expression \(_{11}C_{8}\)
CombinationFn <- function(n,r){
  factorial(n)/(factorial(n-r)*factorial(r))
}
print(CombinationFn(11,8))
## [1] 165
  1. Evaluate the following expression \(\frac{_{12}P_{8}}{_{12}C_{4}}\)
print(PermutationFn(12,8)/CombinationFn(12,4))
## [1] 40320
  1. 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?
PermutationFn(13,7)
## [1] 8648640
  1. In how many ways can the letters in the word ‘Population’ be arranged?
# letters occurenrces (p-2, o-2), p and o occuring 2 times
print(factorial(10)/(factorial(2)*factorial(2)))
## [1] 907200
  1. Consider the following data:
x 5 6 7 8 9
p(x) 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.

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

df_data <- data.frame(x,p_of_x)
print(df_data)
##   x p_of_x
## 1 5    0.1
## 2 6    0.2
## 3 7    0.3
## 4 8    0.2
## 5 9    0.2
Exp_Val<- sum(df_data$x * df_data$p_of_x)
print(Exp_Val)
## [1] 7.2

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

var_x <- sum((df_data$x - Exp_Val)^2 * df_data$p_of_x)
print(paste0("The variance is ",round(var_x,1),"."))
## [1] "The variance is 1.6."

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

sd_x <- round(sqrt(var_x),1)
print(paste0("The standard deviatio is: ",sd_x))
## [1] "The standard deviatio is: 1.2"

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

x_9_plus <- round(sum((x>=9) * p_of_x),1)
print(x_9_plus)
## [1] 0.2

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

x_7_less <- round(sum((x<=7) * p_of_x),1)
print(x_7_less)
## [1] 0.6
  1. 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.

total <- 188
attempt <- 376
val_prop <- dbinom(3,size = 3,total/attempt) *23 + (1-dbinom(3,size = 3,total/attempt))*-4
print(round((val_prop),2))
## [1] -0.62

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

print(round((val_prop),2)*994)
## [1] -616.28
  1. 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.

val_prop_coin <- pbinom(8, size = 11, prob = .5) * 1 + pbinom(8, size = 11, prob = .5, lower.tail = F) * -7
print(round(val_prop_coin, 2))
## [1] 0.74

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

print(round(val_prop_coin*615),2)
## [1] 454
  1. 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.
first_club <- 13/52
second_club <- 12/51
both_club <- first_club * second_club
no_club <- 1 - both_club

print(paste0("The value is ", round(both_club * 583 + no_club * -35,2),"."))
## [1] "The value is 1.35."

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

print(round(both_club * 583 + no_club * -35,2)*632)
## [1] 853.2
  1. 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)
pass_inspection<- pbinom(2, size = 10, prob = .3)

print(round(pass_inspection,3))
## [1] 0.383
  1. 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.
#sample bulb 5
# 30 percentile 0.3
print(5*.3)
## [1] 1.5
  1. 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)
auto_ppois <- (round(ppois(5, 5.5, lower.tail = FALSE),4))
print(auto_ppois)
## [1] 0.4711
  1. 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)
credit_ppois <-(round(ppois(4, 5.7, lower.tail = FALSE),4))
print(credit_ppois)
## [1] 0.6728
  1. 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)
comp_ppois <-round(ppois(1, 0.4*7, lower.tail = TRUE),4)
print(comp_ppois)
## [1] 0.2311
  1. 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.
town_phyper <- round(phyper(1, 6, 19, 8, lower.tail = FALSE),3)
print(town_phyper)
## [1] 0.651
  1. 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.
med_rsrch_phyper <- round(phyper(6, 10, 15, 8),3)
print(med_rsrch_phyper)
## [1] 0.998