1. 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.
The first step to soving the problem us to find out how many marbles we have in total.
# We have 54 red marbles, 9 white marbles, and 75 blue marbles.
red_marbles <- 54
white_marbles <- 9
blue_marbles <- 75
# Find the sum of all marbles.
total_marbles <- red_marbles + white_marbles + blue_marbles
total_marbles
## [1] 138
Now that we know we have a total of 138 marbles, what is the probability that the marble we pick from the box is red? Similarly, what is the probability that the marble we pick from the box is blue?
There are 54 red marbles, so the probability of picking a red marble from the box is: \(\frac{54}{138}\)
There are 75 blue marbles, so the probability of picking a blue marble from the box is: \(\frac{75}{138}\)
So what is the probability that the marble we pick is either red or blue?
# To find the probability of picking either a red or blue marble,
# we need to sum their individual probabilities.
probability_red_or_blue <- round((54 + 75) / total_marbles, 4)
probability_red_or_blue
## [1] 0.9348
Answer: The probability of picking either a red or blue marble is 0.9348.
2. 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.
# First sum the total number of golf balls.
total_number_of_golf_balls <- 19 + 20 + 24 + 17
total_number_of_golf_balls
## [1] 80
We have a total of 80 golf balls, and 20 red golf balls, so what is the probability that we end up with a red golf ball?
# We have 20 red balls, therefore the probability is as follows:
round(20 / total_number_of_golf_balls, 4)
## [1] 0.25
Answer: The probability that we end up with a red golf ball is 0.25.
3. 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 a decimal number rounded to four decimal places.
# Find out how many people there are in total.
total_people <- sum(81, 116, 215, 130, 129, 228, 79, 252, 97, 72)
# Remove males living with their parents from the total number of people.
total_people_less_males_living_with_parents <- total_people - 215
# To find the probability that a customer is not male or does not live with their parents, we divide
# the total number of people minus males living with their parents by the total number of people.
probability <- round(total_people_less_males_living_with_parents / total_people, 4)
probability
## [1] 0.8463
Answer: The probability that a customer is not male or does not live with their parents is 0.8463.
4. Determine if the following events are independent: Going to the gym. Losing weight.
Answer: I would say that these are dependent events as going to the gym often results in losing weight.
5. 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?
# We can use R's choose() function to solve this problem. The choose() function calculates
# the number of sets with x elements that can be chosen from a set with k.
vegetables <- choose(8, 3)
condiments <- choose(7, 3)
tortilla <- choose(3, 1)
# Multiply the results to find the total number of possible combinations.
total_number_of_combinations <- vegetables * condiments * tortilla
total_number_of_combinations
## [1] 5880
Answer: 5880 different veggie wraps can be made.
6. Determine if the following events are independent. Jeff runs out of gas on the way to work. Liz watches the evening news.
Answer: These are independent events as Jeff running out of gas on the way to work has no relation to Liz watching the evening news.
7. 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?
appointment_possibilities <- choose(14, 8) * factorial(8)
appointment_possibilities
## [1] 121080960
Answer: There are 121080960 different ways the members of the cabinet can be appointed.
8. 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.
# Define the jellybeans.
red <- 9
orange <- 4
green <- 9
# Calculate the total number of combinations related to withdrawing 4 jellybeans.
total_jellybeans <- sum(red, orange, green)
total_combinations <- choose(total_jellybeans, 4)
# Calculate the possible combinations of withdrawing each jellybean.
red_choice <- choose(red, 0)
orange_choice <- choose(orange, 1)
green_choice <- choose(green, 3)
# Calculate the probability.
probability <- round((red_choice * orange_choice * green_choice) / total_combinations, 4)
probability
## [1] 0.0459
Answer: 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, is 0.0459.
9. Evaluate the following expression: \(\frac{11!}{7!}\)
answer <- factorial(11) / factorial(7)
answer
## [1] 7920
Answer: 7920
10. Describe the complement of the given event - 67% of subscribers to a fitness magazine are over the age of 34.
Answer: The complement of this event is that 33% of subscribers to a fitness magazine are under the age of 34.
11. If you throw exactly three heads in four tosses of a coin you win $97. If not, you pay me $30.
Step 1. Find the expected value of the proposition. Round your answer to two decimal places.
probability_of_winning <- pbinom(3, 4, 0.5) - pbinom(2, 4, 0.5)
probability_of_losing <- 1 - probability_of_winning
expected_value <- round((97 * probability_of_winning) - (30 * probability_of_losing), 4)
expected_value
## [1] 1.75
Answer: The expected value of the proposition is 1.75.
Step 2. If you played this game 559 times how much would you expect to win or lose? (Losses must be entered as negative.)
559 * 1.75
## [1] 978.25
Answer: If I played this game 559 times I would expect to win $978.25.
12. Flip a coin 9 times. If you get 4 tails or less, I will pay you $23. Otherwise you pay me $26.
Step 1. Find the expected value of the proposition. Round your answer to two decimal places.
probability_of_winning <- pbinom(4, 9, 0.5)
probability_of_losing <- 1 - probability_of_winning
expected_value <- round((23 * probability_of_winning) - (26 * probability_of_losing), 4)
expected_value
## [1] -1.5
Answer: The expected value of the proposition is -1.5.
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
## [1] -1491
Answer: If I played this game 994 times I would expect to lose $1491.00.
13. The sensitivity and specificity of the polygraph has been a subject of study and debate for years. A 2001 study of the use of polygraph for screening purposes suggested that the probability of detecting a liar was .59 (sensitivity) and that the probability of detecting a “truth teller” was .90 (specificity). We estimate that about 20% of individuals selected for the screening polygraph will lie.
# Probability of detecting a liar (sensitivity).
probability_detecting_liar <- 0.59
# Probability of not detecting a liar.
probability_not_detecting_liar <- 1 - probability_detecting_liar
# Probability of detecting a truth teller (specificity).
probability_detecting_truth_teller <- 0.90
# Probability of not detecting a truth teller.
probability_not_detecting_truth_teller <- 1 - probability_detecting_truth_teller
# Probability that the test subject is a liar.
probability_liar <- 0.2
# Probability that the test subject is a truth teller.
probability_truth_teller <- 1 - probability_liar
Condition <- c('Positive', 'Negative', 'Total')
results_table <- data.frame(Condition)
results_table$`Lie` <- c(probability_detecting_liar * probability_liar,
probability_not_detecting_liar * probability_liar,
probability_detecting_liar * probability_liar + probability_not_detecting_liar * probability_liar)
results_table$`Truth` <- c(probability_not_detecting_truth_teller * probability_truth_teller,
probability_detecting_truth_teller * probability_truth_teller,
probability_detecting_truth_teller * probability_truth_teller + probability_not_detecting_truth_teller * probability_truth_teller)
results_table$Total <- results_table$`Lie` + results_table$`Truth`
results_table
## Condition Lie Truth Total
## 1 Positive 0.118 0.08 0.198
## 2 Negative 0.082 0.72 0.802
## 3 Total 0.200 0.80 1.000
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.)
actual_liar <- round((probability_liar * probability_detecting_liar) /
((probability_liar * probability_detecting_liar) +
(probability_truth_teller * probability_not_detecting_truth_teller)), 4)
actual_liar
## [1] 0.596
Answer: The probability that an individual is actually a liar given that the polygraph detected him/her as such is 0.596.
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.)
truth_teller <- round((probability_truth_teller * probability_detecting_truth_teller) /
((probability_truth_teller * probability_detecting_truth_teller) +
(probability_liar * probability_not_detecting_liar)), 4)
truth_teller
## [1] 0.8978
Answer: The probability that an individual is actually a truth-teller given that the polygraph detected him/her as such is 0.8978.
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.
\(P(LiarOrIdentifiedAsLiar) = P(liar) + (P(liar) * (1 - P(sensitivity))) = 0.2 + (0.2 * (1 - 0.59))\)
liar_or_identified_as_liar <- round(probability_liar + (probability_liar * (1 - probability_detecting_liar)), 2)
liar_or_identified_as_liar
## [1] 0.28
Answer: The probability that a randomly selected individual is either a liar or was identified as a liar by the polygraph is 0.28.