More Examples
More Examples
Example. An infection spreads among the squares of an n×n grid in the following manner:
every second any square adjacent to at least two infected squares becomes infected itself.
(Two squares are called adjacent if they share a common edge.) Prove that the whole board
cannot be infected if initially there are at most n-1 many infected squares. Can it be done
beginning with exactly n infected squares
Solution If initially n squares are infected, then it is possible that the infection spreads over
the whole grid. For instance, consider the situation where the diagonal squares are
infected initially. Next we shall show that the whole grid can’t be affected if initially there
are at most n-1 many infected squares
Our invariant here is the total perimeter of the infected squares (not counting borders
between two adjacent infected squares). When a square is infected by the given rules, the
total perimeter cannot increase: the newly infected square is adjacent to at least 2 already
infected squares, so we lose at least 2 borders and gain at most 2. Initially, this perimeter is
at most 4(n − 1). Hence we cannot end with the entire grid being infected, because for that
the total perimeter needs to be increased to 4n, which cannot happen.
The above diagram shows what will be the possible contributions of one particular newly
affected square (the central one). Note that for none of them the newly affected central
square increases the perimeter of the infected region
Example. Five hundred people attend a party in a mansion with many rooms. Each minute
somebody walks from one room into a different room with at least as many people. Prove
that eventually all the people will be gathered in one room
This result seems intuitively plausible. The heavily populated rooms will get even more
popular, while the rooms with few people will come to have even fewer, so we should
expect that the outcome is for all people to be in one room. But how to make this rigorous?
A numerical monovariant is the key
Solution For each room, consider the square of the number of people in that room. Let the
sum of these squares be S. We claim that S increases with each move. To see this, suppose
that a person from a room with n people walks into a room with m ≥ n people. Then the
squares of the populations of these rooms change from n^2 and m^2 to (n−1)^2 and
(m+1)^2, respectively, while all the other rooms remain passive, so the net change in S is
[(n − 1)^2 + (m + 1)^2] − [n^2 + m^2] = 2(m − n) + 2 > 0. Thus S always increases
Page 1 of 4
.
Now, there are nitely many possible distributions of the 500 people among the various
rooms, so there are nitely many possible values of S. This means that S cannot increase
forever. But as long as at least two rooms have people in them, our operation can be
performed and S will increase. Therefore the process must terminate, implying all the
people will be in the same room
Example. The integers 1, ... , n are arranged in any order. In one step, you may switch any
two neighbouring integers. Prove that you can never reach the initial order after an odd
number of steps
Solution Let us label the integers as a_1, a_2, …, a_n. For each pair (i, j) where 1 ≤ i < j ≤ n,
we de ne d_{i, j} to be 1 if a_i < a_j and 0 otherwise. Thus, S = ∑ d_{i, j} equals the sum of
all ordered pairs of indices such that i < j and a_i < a_j. Now observe what happens if you
switch two neighbouring integers, say a_k and a_(k+1). Consider all possible scenario
i. If neither among i, j equal k or k+1 then d_{i, j} does not change
ii. If i=k and j=k+1 then d_{i, j} switches its value (0 to 1 or 1 to 0
When exactly one among i, j equal to k or k+1, we shall use the idea that the role of a_i and
a_j in the sum ∑ d_{i, j} has been swapped
iii. If i=k+1, and j>k+1 then new d_{i, j} = old d_{k, j}. Better write d’_{k+1, j} = d_{k, j}
iv. If i=k, and j>k+1 then d’_{i, j} = d’_{k, j} = d_{k+1, j}
v. If i<k and j=k then d’_{i, j} = d’_{i, k} = d_{i, k+1}
vi. If i<k and j=k+1 then d’_{i, j} = d’_{i, k+1} = d_{i, k}
Example. To each vertex of a regular pentagon an integer is assigned, such that the sum of
all ve numbers is positive. If three consecutive vertices are assigned the numbers x, y, z
respectively, and y < 0, then the following operation is allowed: x, y, z are replaced by x+y,
-y, z+y respectively. Such an operation is performed repeatedly as long as at least one of
the ve numbers is negative. Determine whether this procedure necessarily comes to an
end after a nite number of steps
Solution Consider f(x_1, …, x_5) = ∑ (x_(i+1) − x_(i-1))^2. (Indices are mod 5, i.e. x_0=x_5,
x_6 = x_1.) Suppose x_3 < 0 and hence we change the numbers X = (x_1, x_2, x_3, x_4, x_5)
to Y = (x_1, x_2+x_3, −x_3, x_4+x_3, x_5). Note that S = x_1+…+x_5 is invariant, and hence
positive at every step. Now observe tha
f(Y) − f(X) = … = 2x_3(x_1+…+x_5) = 2x_3 S < 0.
Thus f strictly decreases at each step, and it takes only non-negative integer values. So the
number of steps must be nite
Alternate Solution Consider the scary monovariant given in Arthur Engel’s book
Page 2 of 4
fi
fi
fi
fi
fi
fi
.
fi
fi
.
Example. Let S be a set of points in the plane such that each point in S is a midpoint of two
other points in S. Show that S must be an in nite set
Solution. Let, if possible, S be nite. Setup a coordinate system. Now consider the points
which are rightmost (i.e. those points which have a maximal x-coordinate). Among these,
consider the topmost point (which have the largest y-coordinate among these points), let
us call this P. Now P must be the midpoint of a segment joining two points, say A and B.
Since P has a maximal x-coordinate, it follows that none of A and B can lie on its right side.
This forces A and B to lie on the line x = c where c is the x-coordinate of P. But then one of
these points A and B will lie above P, contradicting the maximality of the y-coordinate of P
(among all points of S lying on that line x = c)
Example. Show that for every n > 1, the number 2^n -1 is not a multiple of n
Solution. Let, if possible, let n > 1divide 2n − 1. Note that n cannot be even, since then it
won’t divide the odd number 2n − 1. Consider a prime p that divides n . Since p is odd,
Fermat’s theorem tells us that 2p−1 = 1 (mod p) . Thus, p | 2n − 1 and p | 2p−1 − 1 , which
implies p | gcd(2n − 1, 2p−1 − 1) = 2gcd(n,p−1) − 1. (Not familiar with this result? see below.
So for any prime p dividing n , we have shown that p ∣ 2gcd(n,p−1) − 1 . Now among all
prime divisors of n, take p to be the minimum one. The minimality of p implies that gcd(n,
p − 1) = 1, because each prime that divides p − 1 is less than p and hence cannot divide n.
Therefore, p divides 2gcd(n,p−1) − 1 = 21 − 1 = 1, which is a contradiction
Page 3 of 4
fi
?
fi
.
Example. Rooks are placed on the n×n chessboard satisfying the following condition: If the
square (i, j) is free, then at least n rooks are on the i-th row and j-th column together. Show
that there are at least n 2 /2 rooks on the board
Solution. The board has n rows and n columns. Among the rows and columns combined,
consider one with the minimal number of rooks. W.l.o.g. suppose that it is a row. Now if
this minimal row has at least n/2 rooks, then the conclusion follows (why?)
Suppose not. Let, if possible, this row have k rooks where k < n /2. Consider the n − k
empty squares in this row. In each of their column, we must have at least n − k rooks (due
to the given condition). What about the remaining columns? Each of them must have at
least k rooks (since k is the minimal number of rooks in any row/column).
Therefore, the total number of rooks in the board is at least (n − k)2 + k 2 . It remains to
show that (n − k)2 + k 2 ≥ n 2 /2. It follows from the inequality 2(a 2 + b 2 ) ≥ (a + b)2 .
Example. We call a polynomial f (x) having integer coef cients to be primitive if the gcd of
the coef cients of f (x) is 1. Show that product of two primitive polynomials is also a
primitive polynomial
Solution. Let f (x) = ∑k≥0 ak x k and g(x) = ∑k≥0 bk x k be two primitive polynomials. If the
product f (x)g(x) is not primitive, there must be a prime p which is a common divisor of all
its coef cients. But p can not divide all the coef cients of either f (x) or g(x) (otherwise they
would not be primitive). Let r be the minimum index such that ar is not divisible by p and
let s be the minimum index such that bs is not divisible by p. Now consider the term x r+s in
the product. Its coef cient (which can be 0 as well) must be of the form
ar bs + ar+1bs−1 + ar+2 bs−2 + ⋯ + ar−1bs+1 + ar−2 bs+2 + ⋯
Note that the rst term in the above sum is not divisible by p, while each of the remaining
terms are, so the entire sum cannot be divisible by p . But by our assumption all the
coef cients in the product f (x)g(x) must be divisible by p. Thus we get a contradiction
Page 4 of 4
fi
fi
fi
fi
fi
.
fi
fi
.