## Analytical Solution

In order to solve this problem analytically, you must find the probability that each possible number of hermits will be infected. There will be at least two infected (one gets the disease and visits another) and at most six infected (all get visited without anyone getting visited twice).

Look at each case separately:

# of infected hermits
explanation
probability

0

0

1/5 = 0.2000

# 3

##### For three hermits to be infected, the second hermit must have visited one of the four non-immune hermits. Then, the third hermit must visit another hermit (two of which are immune). If he visits one of the two immune hermits, only three will be infected.
(4/5)(2/5) = 8/25 = 0.3200

# 4

##### For four hermits to be infected, the second hermit must have visited one of the four non-immune hermits. Then, the third hermit must have visited one of the three remaining non-immune hermits. Then that hermit must visit one of the three immune hermits.
(4/5)(3/5)(3/5) = 36/125 = 0.2880

# 5

##### For five hermits to be infected, the second hermit visited one of four non-immune hermits, the third hermit visited one of three non-immune hermits, the fourth visited one of two non-immune hermits and the fifth visited one of four immune hermits.
(4/5)(3/5)(2/5)(4/5) = 96/625 = 0.1536

# 6

##### For all the hermits to be infected, the second hermit visited one of four non-immune hermits, the third hermit visited one of three non-immune hermits, the fourth visited one of two non-immune hermits, and the fifth visited the last non-immune hermit
(4/5)(3/5)(2/5)(1/5) = 24/625 = 0.0384

Now check these answers. Remember, the total probability of all possibilities must equal 1.

##### Total probability = 0 + 0 + (1/5) + (8/25) + (36/125) + (96/625) + (24/625) = (125/625) + (200/625) + (180/625) + (96/625) + (24/625) = 625/625 = 1

As you can see, these numbers do check out. Now we find the expected value, E(x), by multiplying each value by its respective probability and adding them all together:

##### E(x) = 0(0) + 1(0) + 2(1/5) + 3(8/25) + 4(36/125) + 5(96/625) + 6(24/625) = 0 + 0 + (2/5) + (24/25) + (144/125) + (480/625) + (144/625) = (250/625) + (600/625) + (720/625) + (480/625) + (144/625) = (2194/625) = 3.5104

Thus, by averaging all the trials from your model, you should get something near 3.5104 as your answer.

## Questions:

1. Should the average of the trials from your model be exactly 3.5104?

2. Does an expected value of 3.5104 mean that we expect 3 whole hermits and only part of a fourth hermit to get sick each time?

3. What is the expected value of this problem if there are 4 hermits?

4. What is the expected value if there are 7 hermits?