Prove that if fewer than $n$ students in class are initially infected, the whole class will never be completely infected.

You solved your own problem! Consider the length of the boundary. If there are $<n$ infected squares initially, then the length is at most $4(n-1)$. It cannot increase, but if we end up with all squares infected the boundary would be length $4n$.

In the diagram below consider what happens when square $b$ becomes infected. In the first case we get new boundary above and below it (because $a,c$ are uninfected), but we lose the boundary on either side of $b$, so there is no net change.

In the second case, we have a net loss of 2 (we lose three sides of boundary and only gain 1). In the third case we have a net loss of 4.

So in all cases, we cannot increase the total length of boundary - we must lose at least 2 and can gain at most 2.

enter image description here


Theorem: If fewer than $n$ students in class are initially infected, the whole class will never be completely infected.

Proof: by induction. We define perimeter of an infected set of students as the number of edges with infection on exactly one side. We let $x$ denote the size of the perimeter.

Let $P(k)$ be the proposition that after $k$ discrete time-steps, the perimeter is less than $4n$.

Base Case: $P(0)$ is true.

This is trivially true since the perimeter could not have possible changed after $0$ discrete time-steps. The perimeter of the infected region remains to be $x$.

Inductive Step: for all nonnegative integers, we must show that $P(k)\Rightarrow P(k+1)$

We assume that $P(k)$ is true for purposes of induction. So, this means that we are assuming that the perimeter of the infeted region is at most $x$ after $k$ steps.

At step $k + 1$, the perimeter of the infected region can only change in two ways. Since each newly infected square is adjacent to at least two previously infected squares, each newly infected square can either:

lose at least two edges from the perimeter of the infected region, or add at most two edges to the perimeter. Therefore, the perimeter of the infected region cannot increase.

So, we have shown that for all nonnegative integers, $k$, $P(k)\Rightarrow P(k+1)$

Q.E.D.