## Exercise 1.16

My general hint for this exercise is that you can express these probabilities in terms of fractions where the denominator expresses the total number of possible license plates and the numerator expresses the number of license plates which satisfy the desired condition.

The total number of license plates can be expressed as the number of 2 letter license plates, plus the number 3 letter license plates, plus the number of 4 letter license plates, plus the number of 5 letter license plates.

## Exercise 1.44

It will be useful to note the following coding technique. Suppose we have a vector `x`

with 5 components like below

`x <- c(1, 4, 4, 3, 2)`

We might like to check whether any component of `x`

has a certain value, such as 2. That is, we want to know if component 1 or component 2 or component 3 or component 4 or component 5 has the value 2. The logical operation of *or* can be expressed with two vertical bars `||`

. Our question in code is then as follows.

`if (x[1] == 2 || x[2] == 2 || x[3] == 2 || x[4] == 2 || x[5] == 2) 1 else 0`

`## [1] 1`

We see of course that the output is 1 since `x`

contains 2 in its last component. On the other hand, the following code with 3 in the last component instead will print 0.

```
x <- c(1, 4, 4, 3, 3)
if (x[1] == 2 || x[2] == 2 || x[3] == 2 || x[4] == 2 || x[5] == 2) 1 else 0
```

`## [1] 0`

By the way, R has a built in tool which gives a much cleaner way of expressing this. The `%in%`

command can be used:

`if (2 %in% x) 1 else 0`

`## [1] 0`

## Exercise 2.5

The statement \(A\) implies \(B\) means that if event \(A\) occurs, then event \(B\) occurs. In a Venn diagram, you can express this idea by drawing one of these sets inside the other. I’ll leave it as part of the exercise for you to decide which set goes inside.