---
title: "Counting Method Examples"
author: "Original version by Prof Wagaman, slightly modifed by Prof Leise"
output: pdf_document
---

> Remember: You should save the file after you open it somewhere you like and keep saving your work as you go! Feel free to work with a neighbor or make notes on scratch paper. Solutions will go live after the class period. 

### Helpful R Commands For Counting

R can help with permutation and combination calculations. Though sometimes the numbers get so big the computations fail, and then you can swap to looking at the natural log or log base 10 of the value of interest instead. All these commands can be run just in R. On a graphing calculator, the combination function is usually found under the MATH then PRB menu option as nCr.    

* choose(n,r) counts combinations of r objects from n objects 

* prod(n:m) computes the product of values from n to m

* prod(n:(n-r+1)) counts permutations of r objects from n objects 

* factorial(n) computes n!  

* lfactorial(n) computes the natural logarithm of the factorial of n, for when n is large and the factorial computation fails

* lchoose(n,r) computes the natural logarithm of choose(n,r), for when the choose computation fails

For multinomial coefficients, do a succession of choose arguments. For example, if I want to take 9 people and split them into a group of 2, 3, and 4, I could do choose(9,2) times choose(7,3) times choose(4,4). The last one isn't really needed because it will be 1. 

### Counting Tryouts
1. A small college has a soccer team that only plays eight games during its season. In how many ways can the team end its season with 5 wins, 2 loses, and 1 tie?

```{r}

```

2. The soccer team is made up of 25 students, of whom 15 are lowerclassmen and 10 are upperclassmen. If the coach wants to split the team in two (groups of 12 and 13) for an exercise, in how many ways can this be done so that the group of 12 is half lowerclassmen and half upperclassmen? 

```{r}

```

3. The soccer team is doing a fundraiser where they are selling t-shirts. 6 t-shirt designs are available on 8 different colors with 4 sizes (S,M,L,XL). How many possible different t-shirts could be ordered?  

```{r}

```

4. As part of the fundraiser, 142 tickets are sold for a chance to win 3 prizes. The prizes are distinct (grand prize, runner-up prize 1, runner-up prize 2). In how many ways can the prizes be distributed to ticketholders, assuming tickets can only win once?

```{r}

```


### Student Organizations

A student organization with 80 members (20 first-year, 20 sophomores, 20 juniors, 20 seniors, and assume equal split between male/female) has elections coming up. The open positions are for President, Vice President, Treasurer, and Secretary. An individual cannot hold more than one position. Assuming that everyone is equally likely to win any position...

1. What is the probability that the four open positions are filled by a first-year, sophomore, junior, and senior? (No repeats within a class.) 

```{r}

```

2. What is the probability that the four open positions are filled by 2 first-years and 2 seniors?

```{r}

```

3. What is the probability that all positions are won by seniors? 

```{r}

```

After the elections, the organization decides to send a delegation to student government to ask for more funding. The delegation can consist of 6 members, and officers can be delegates. Assuming 6 delegates are sent, randomly chosen from the group...

4. What is the probability that no first-years are among the delegates? 

```{r}

```

5. What is the probability that the delegation consists of 3 juniors or seniors and 3 lowerclassmen? 

```{r}

```

6. What is the probability that the delegation consists of 2 juniors, 1 senior, and 3 lowerclassmen? 

```{r}

```


