Answer: u(n)=8000−3n⋅2
Step-by-step explanation:
Let i(n) be the number of infected people and u(n) the number of uninfected people, both on the n-th day.
Let x(n) be the number of people who got infected on the n-th day. The relation between i(n) and x(n) is given by:
i(n)=i(n−1)+x(n)
Let's assume the stranger leaves before the next day.
Taking the day the stranger arives as the 0-th day and assuming he infects two people on that day, then
i(0)=x(0)=2
u(0)=8000−2=7998
The two people infected now will also infect two other people, meaning that:
x(1)=2i(0)=4
i(1)=i(0)+x(1)=6
u(1)=7998−x(1)=7994=8000−i(1)
Some more relations become clear:
u(n)=u(n−1)−x(n)
u(n)=8000−i(n)
As every person infects two people per day, then
x(n)=2i(n−1)
Therefore
i(n)=i(n−1)+2i(n−1)=3i(n−1)
This a recurrence relation for the number of infected people at a given day:
i(n)={3i(n−1)
if n is not equal to 2
if n=0
Implies
i(1)=3i(0)=6=31⋅2
i(2)=3i(1)=18=32⋅2
i(3)=3i(2)=54=33⋅2
Analogously, we can figure out that
i(n)=3n⋅2
Hence the number of uninfected people on day n is
u(n)=8000−3n⋅2