N Selina Assignment 6 - Data 605

Noori Selina

  1. A bag contains 5 green and 7 red jellybeans. How many ways can 5 jellybeans be withdrawn from the bag so that the number of green ones withdrawn will be less than 2? - 196

Using the binomial coefficient formula =

Green Jellybeans = 5 Red Jellybeans = 7 Total jellybeans = 12

Either no green jellybeans are withdrawn or all five jellybeans withdrawn are red.

Number of ways: $ = 21 $.

Choose 4 red and 1 green jellybeans.

Number of ways: $ = 35 = 175 $.

Total number of ways to withdraw 5 jellybeans from the bag such that the number of green ones withdrawn will be less than 2:

$ 21 + 175 = 196 $ ways.

choose (7,5) + (choose (7,4) * choose(5,1))
## [1] 196
  1. A certain congressional committee consists of 14 senators and 13 representatives. How many ways can a subcommittee of 5 be formed if at least 4 of the members must be representatives?

Case 1: Choose 4 representatives and 1 senator. Case 2: Choose 5 representatives and 0 senators. Case 3: Choose 4 representatives and 1 senator. These cases represent the different combinations of representatives and senators that fulfill the requirement of having at least 4 representatives.

Case 1:

sen <- 14
rep <- 13

# the 4 representatives
rep_13_ch_4 <- factorial(13) / (factorial(4)*(factorial(13-4)))

# 1 senator
sen_14_ch_1 <- factorial(14) / (factorial(1)*(factorial(14-1)))

# multiply 
(rep_4_sen_1 <- rep_13_ch_4*sen_14_ch_1)
## [1] 10010

Case 2:

(rep_13_ch_5 <- factorial(13) / (factorial(5)*(factorial(13-5))))
## [1] 1287

adding case 1 and 2

rep_4_sen_1+rep_13_ch_5
## [1] 11297

checking in R

choose (13,5) + (choose (13,4) * choose(14,1))
## [1] 11297
  1. If a coin is tossed 5 times, and then a standard six-sided die is rolled 2 times, and finally a group of three cards are drawn from a standard deck of 52 cards without replacement, how many different outcomes are possible?
coin_outcomes <- 2
die_outcomes <- 6
total_cards <- 52

coin_outcomes_5 <- coin_outcomes ^ 5
die_outcomes_2 <- die_outcomes ^ 2
card_outcomes_3 <- factorial(total_cards) / (factorial(3) * factorial(total_cards - 3))

total_outcomes <- coin_outcomes_5 * die_outcomes_2 * card_outcomes_3

cat("Total number of different outcomes:", total_outcomes, "\n")
## Total number of different outcomes: 25459200
  1. 3 cards are drawn from a standard deck without replacement. What is the probability that at least one of the cards drawn is a 3? Express your answer as a fraction or a decimal number rounded to four decimal places.

Scenarios: All three cards drawn are 3. Two of the three drawn cards are 3 and one is something else. One of the three drawn cards is 3 and the other two are something else.

round(((choose(4,1) * choose(48,2)) + (choose(4,2) * choose(48,1)) + choose(4,3)) / choose(52,3),digits = 4)
## [1] 0.2174
  1. Lorenzo is picking out some movies to rent, and he is primarily interested in documentaries and mysteries. He has narrowed down his selections to 17 documentaries and 14 mysteries.

Step 1: How many different combinations of 5 movies can he rent?

doc <- 17
myst <- 14
Total_movie <- 31
Choose_5movie <- choose(Total_movie, 5)
cat("Number of different combinations of 5 movies Lorenzo can rent:", Choose_5movie, "\n")
## Number of different combinations of 5 movies Lorenzo can rent: 169911

Step 2: . How many different combinations of 5 movies can he rent if he wants at least one mystery? 5 scnearios: Renting 1 mystery and 4 documentaries. Renting 2 mysteries and 3 documentaries. Renting 3 mysteries and 2 documentaries. Renting 4 mysteries and 1 documentary. Renting 5 mysteries and 0 documentaries.

mysteries <- 14
documentaries <- 17

mysteries_1_documentaries_4 <- choose(mysteries, 1) * choose(documentaries, 4)
mysteries_2_documentaries_3 <- choose(mysteries, 2) * choose(documentaries, 3)
mysteries_3_documentaries_2 <- choose(mysteries, 3) * choose(documentaries, 2)
mysteries_4_documentaries_1 <- choose(mysteries, 4) * choose(documentaries, 1)
mysteries_5_documentaries_0 <- choose(mysteries, 5) * choose(documentaries, 0)

total_combinations <- mysteries_1_documentaries_4 + mysteries_2_documentaries_3 + mysteries_3_documentaries_2 + mysteries_4_documentaries_1 + mysteries_5_documentaries_0
  1. In choosing what music to play at a charity fund raising event, Cory needs to have an equal number of symphonies from Brahms, Haydn, and Mendelssohn. If he is setting up a schedule of the 9 symphonies to be played, and he has 4 Brahms, 104 Haydn, and 17 Mendelssohn symphonies from which to choose, how many different schedules are possible? Express your answer in scientific notation rounding to the hundredths place.
brahms <- 4
haydn <- 104
mendelssohn <- 17

total_schedules <- choose(brahms, 3) * choose(haydn, 3) * choose(mendelssohn, 3)

formatted_result <- format(total_schedules, scientific = TRUE, digits = 2)

cat("Total number of different schedules possible:", formatted_result, "\n")
## Total number of different schedules possible: 5e+08
  1. An English teacher needs to pick 13 books to put on his reading list for the next school year, and he needs to plan the order in which they should be read. He has narrowed down his choices to 6 novels, 6 plays, 7 poetry books, and 5 nonfiction books. Step 1: If he wants to include no more than 4 nonfiction books, how many different reading schedules are possible? Express your answer in scientific notation rounding to the hundredths place.
novels <- 6
plays <- 6
poetry <- 7
non_fiction <- 5
total <- novels + plays + poetry + non_fiction

result <- choose(total, 13) - choose(5, 5) * choose(total - 5, 8)
formatted_result <- format(result, scientific = TRUE, digits = 2)

cat("Total number of different reading schedules possible:", formatted_result, "\n")
## Total number of different reading schedules possible: 2.4e+06

Step 2:

If he wants to include all 6 plays, how many different reading schedules are possible? Express your answer in scientific notation rounding to the hundredths place.

plays <- 6
total <- 6 + 6 + 7 + 5

result <- choose(plays, 6) * choose(total - plays, 7)
formatted_result <- format(result, scientific = TRUE, digits = 2)

cat("Total number of different reading schedules possible:", formatted_result, "\n")
## Total number of different reading schedules possible: 3.2e+04
  1. Zane is planting trees along his driveway, and he has 5 sycamores and 5 cypress trees to plant in one row. What is the probability that he randomly plants the trees so that all 5 sycamores are next to each other and all 5 cypress trees are next to each other? Express your answer as a fraction or a decimal number rounded to four decimal places.
sycamores<-5
cypress<-5
total_tree<-10

(tree10choose5<-choose(10,5)) #finding all outcomes
## [1] 252
  1. If you draw a queen or lower from a standard deck of cards, I will pay you $4. If not, you pay me $16. (Aces are considered the highest card in the deck.) Step 1: Find the expected value of the proposition. Round your answer to two decimal places. Losses must be expressed as negative values.
cards <- 52
queen_lower <- 44
pay_qn_lower <- 4
if_not <- 16

expected_value <- round((pay_qn_lower * queen_lower / cards) - (if_not * ((cards - queen_lower) / cards)), 2)
expected_value
## [1] 0.92

Step 2: If you played this game 833 times how much would you expect to win or lose? Round your answer to two decimal places. Losses must be expressed as negative values.

games_played <- 833
expected_value_per_game <- 0.92

total_expected_value <- round(games_played * expected_value_per_game, 2)
total_expected_value
## [1] 766.36