This is a graded in-class assignment. Show all your work in R Markdown files. Submit compiled HTML files only.

Question 1

Suppose drawing two cards from a deck and tossing two coins. Answer the following questions.

  1. What is the experiment?

    The experiment is “drawing two cards from a deck and tossing two coins”.

  2. What is “getting two heads and two aces or one head one tail one queen one king”? Pick one (Event / Outcome / Sample Space)

    Event.

  3. Give an example of two mutually exclusive events.

    Event A: Jack of Spades / Queen of Hearts / Heads / Heads Event B: Ace of Clubs / Ace of Diamonds / Tails / Tails

  4. What is the probability of getting one head and one tail (in any order) and getting two Jacks?

    #It can be either HT or TH so probability of the coins is 1/2
    #Getting the first Jack has probability of 4/52
    #Getting the second Jack has probability of 3/51
    1/2*4/52*3/51
    ## [1] 0.002262443
  5. How many different outcomes can there be? Assume ordering is important (e.g. HT and TH are different outcomes).

    #Two outcomes per coin
    #52 outcomes for the first card draw
    #51 outcomes for the second card draw
    #Multiplication rule
    2*2*52*51
    ## [1] 10608

Question 2

In how many ways can you arrange the letters of “COMPUTERLAB”?

  1. Any order.

    #Permutation rule
    #11 characters no repetitive letters
    factorial(11)
    ## [1] 39916800
  2. Vowels together?

    #4 vowels, 7 consonants
    #Assume all vowels are a single "letter". So 8 characters.
    #But vowels permutate within the single "letter".
    #Multiplication rule
    factorial(7+1)*factorial(4)
    ## [1] 967680
  3. Vowels in alphabetical order?

    #We start with all the permutations 11!
    #For any permutation there can be only one ordering of vowels.
    #For instance COMPUTERLAB is not valid but CAMPETORLUB is valid
    #So remove invalid permutations with division
    factorial(11)/factorial(4)
    ## [1] 1663200
  4. There should be no consecutive vowels?

    #There are 7 consonants, 4 vowels.
    # Assume Xs are consonants and .s are potent vowel places.
    # .X.X.X.X.X.X.X.
    #Consonants can permutate in any order so 7! there
    #8 places for vowels but only 4 vowels.
    # So it is a permutation of 4 out of 8 places.
    factorial(7)*(factorial(8)/factorial(8-4))
    ## [1] 8467200

Question 3

In how many ways can you arrange the letters of “HETEROSKEDASTICITY”?

# 18 characters.
# 7 vowels, 11 consonants
# 3 Es, 3 Ts, 2 Is, 2 Ss
  1. Any order.

    #By the formula of permutation with repetitive letters
    #Assign the value to all_perms object
    all_perms<-factorial(18)/(factorial(3)*factorial(3)*factorial(2)*factorial(2))
    all_perms
    ## [1] 4.446093e+13
  2. Vowels together?

    #Assume all vowels are single "character" again. So 12 characters
    (factorial(11+1)/(factorial(3)*factorial(2)))*(factorial(7)/(factorial(3)*factorial(2)))
    ## [1] 16765056000
  3. Vowels in alphabetical order?

    #Same as the last question. But be careful about identical vowels.
    all_perms/(factorial(7)/(factorial(3)*factorial(2)))
    ## [1] 105859353600
  4. There should be no consecutive vowels?

    #Same as the last question. But be careful about identical vowels.
    
    (factorial(11)/factorial(3)*factorial(2))*(factorial(12)/factorial(12-7))/(factorial(3)*factorial(2))
    ## [1] 4.425975e+12

Question 4

Suppose you are putting the top 16 football teams in 4 groups evenly (each group should consist of 4 teams). In how many different ways can you arrange the teams?

#It is either a chain of combinations or just grouping combination
choose(16,4)*choose(12,4)*choose(8,4)
## [1] 63063000

Question 5

There are 20 people; 10 from Ankara, 10 from Istanbul.

  1. Suppose you want to form a group of 5 people with at least 1 person from Ankara and Istanbul. In how many ways can you form such a group?

    #Calculate as if no rules. It is the combination of 20 to 5.
    #Then remove the combinations of all Ankara or all Istanbul people
    choose(20,5) - choose(10,5) - choose(10,5)
    ## [1] 15000
  2. In how many ways can you form a group of 3 people from Istanbul and 4 people from Ankara?

    #Simply separate combinations with multiplication rule.
    choose(10,3)*choose(10,4)
    ## [1] 25200