A Primer: Generating Functions: Part II: for RMO/INMO 2019

We shall now complicate the situation a little bit. Let us ask for the combinations of the symbols $\alpha_{1}, \alpha_{2}, \ldots, \alpha_{n}$ with repetitions of each symbol allowed once more in the combinations. For example, let there be only two symbols $\alpha_{1}, \alpha_{2}$. Let us look for combinations of the form:

$\alpha_{1}$, $\alpha_{2}$, $\alpha_{1}\alpha_{2}$, $\alpha_{1}\alpha_{1}$, $\alpha_{2}\alpha_{2}$, $\alpha_{1}\alpha_{1}\alpha_{2}$, $\alpha_{1}\alpha_{2}\alpha_{2}$, $\alpha_{1}\alpha_{1}\alpha_{2}\alpha_{2}$

where, in each combination, each symbol may occur once, twice, or not at all. The OGF for this can be constructed by reasoning as follows: the choices for $\alpha_{1}$ are not-$\alpha_{1}$, $\alpha_{1}$ once, $\alpha_{1}$ twice. This is represented by the factor $(1+\alpha_{1}t+\alpha_{1}^{2}t^{2})$. Similarly, the possible choices for $\alpha_{2}$ correspond to the factor $(1+\alpha_{2}t+\alpha_{2}^{2}t^{2})$. So, the required OGF is $(1+\alpha_{1}t+\alpha_{1}^{2}t)(1+\alpha_{2}t+\alpha_{2}^{2}t^{2})$

On expansion, this gives : $1+(\alpha_{1}+\alpha_{2})t+(\alpha_{1}\alpha_{2}+\alpha_{1}^{2}+\alpha_{2}^{2})t^{2}+(\alpha_{1}^{2}\alpha_{2}+\alpha_{1}\alpha_{2}^{2})t^{3}+(\alpha_{1}^{2}\alpha_{2}^{2})t^{4}$

Note that if we omit the term 1 (which corresponds to not choosing any $\alpha$), the other 8 terms correspond to the 8 different combinations listed in (*). Also, observe that the exponent r of the $t^{r}$ tells us that the coefficient of $t^{r}$ has the list or inventory of the r-combinations (under the required specification — in this case, with the restriction on repetitions of symbols) in it:

$\bf{Illustration}$

In the light of the foregoing discussion, let us now take up the following question again: in how many ways, can a total of 16 be obtained by rolling 4 dice once?; the contribution of each die to the total is either a “1” or a “2” or a “3” or a “4” or a “5” or a “6”. The contributions from each of the 4 dice have to be added to get the total — in this case, 16. So, if we write: $t^{1}+t^{2}+t^{3}+t^{4}+t^{5}+t^{6}$

as the factor corresponding to the first die, the factors corresponding to the other three dice are exactly the same. The product of these factors would be:

(*) $(t+t^{2}+t^{3}+t^{4}+t^{5}+t^{6})^{4}$

Each term in the expansion of this would be a power of t, and the exponent k of such a term $t^{k}$ is nothing but the total of the four contributions which went into it. The number of times a term $t^{k}$ can be obtained is exactly the number of times k can be obtained as a total on a throw of the four dice. So, if $\alpha_{k}$ is the coefficient of $t^{k}$ in the expansion, $\alpha_{16}$ is the answer for the above question. Further, since (*) simplifies to $(\frac{t(1-t^{6})}{1-t})^{4}$, it follows that the answer for the above question tallies with the coefficient specified in the following next question: calculate the coefficient of $t^{12}$ in $(\frac{(1-t^{6})}{(1-t)})^{4}$.6

Now, consider the following problem: Express the number $N(n,p)$ of ways of obtaining a total of n by rolling p dice, as a certain coefficient in a suitable product of binomial expansions in powers of t. [ this in turn, is related to the observation that the number of ways a total of 16 can be obtained by rolling 4 dice once is the same as the coefficient of $t^{12}$ in $(\frac{1-t^{6}}{1-t})^{4}$]:

So, we get that $N(n,p)=$ coefficient of $t^{n-p}$ in $(\frac{1-t^{6}}{1-t})^{p}$

Let us take an example from a graphical enumeration:

A $\it {graph}$ $G=G(V,F)$ is a set V of vertices a, b, c, …, together with a set $E=V \times V$ of $\it {edges}$ $(a,b), (a,a), (b,a), (c,b), \ldots$ If $(x,y)$ is considered the same as $(y,x)$, we say the graph is $\it{undirected}$. Otherwise, the graph is said to be $\it{directed}$, and we say ‘$(a,b)$ has a direction from a to b’. The edge $(x,x)$ is called a loop. The graph is said to be of order $|V|$.

If the edge-set E is allowed to be a multiset, that is, if an edge $(a,b)$ is allowed to occur more than once, (and, this may be called a ‘multiple edge’), we refer to the graph as a general graph.

If $\phi_{5}(n)$ and $\psi_{5}(n)$ denote the numbers of undirected (respectively, directed) loopless graphs of order 5, with n edges, none of them a multiple edge, find the series $\sum \phi_{5}(n)t^{n}$ and $\sum \psi_{5}(n)t^{n}$.

Applying our recently developed techniques to the above question, a graph of 5 specified vertices is uniquely determined once you specify which pairs of vertices are ‘joined’. Suppose we are required to consider only graphs with 4 edges. This would need four pairs of vertices to be selected out of the total of $5 \choose 2$ equal to 10 pairs that are available. So selection of pairs of vertices could be made in $10 \choose 4$ ways. Each such selection corresponds to one unique graph, with the selected pairs being considered as edges. More informally, having selected a certain pairs of vertices, imagine that the vertices are represented by dots in a diagram and join the vertices of each selected pair by a running line. Then, the “graph” becomes a “visible” object. Note that the number of graphs is just the number of selections of pairs of vertices. Hence, $\phi_{5}(4)=10 \choose 4$.

Or, one could approach this problem in a different way. Imagine that you have a complete graph on 5 vertices — the “completeness” here means that every possible pair of vertices has been joined by an edge. From the complete graph which has 10 edges, one has to choose 4 edges — any four, for that matter — in order to get a graph as required by the problem.

On the same lines for a directed graph, one has a universe of 10 by 2, that is, 29 edges to choose from, for, each pair x,y gives rise to two possible edges $(x,y)$ and $(y,x)$. Hence,

$\psi_{5}(4)=20 \choose 4$.

Thus, the counting series for labelled graphs on 5 vertices is $1 + \sum_{p=1}^{10} {10 \choose p}t^{p}$
and the counting series for directed labelled graphs on 5 vertices is
$1+ \sum_{p=1}^{20}{20 \choose p}t^{p}$.

Finally, the OGF for increasing words on an alphabet ${a,b,c,d,e}$ with $a is

$(1+at+a^{2}t^{2}+\ldots)(1+bt+b^{2}t^{2}+\ldots)(1+ct+c^{2}t^{2}+\ldots)\times (1+dt+d^{2}t^{2}+\ldots)(1+et+e^{2}t^{2}+\ldots)$

The corresponding OE is $(1+t+t^{2}+t^{3}+\ldots)^{5}$ which is nothing but $(1-t)^{-5}$ (this explains the following problem: Verify that the number of increasing words of length 10 out of the alphabet $\{a,b,c,d,e \}$ with $a is the coefficient of $t^{10}$ in $(1-t)^{-5}$ ).

We will continue this detailed discussion/exploration in the next article.

Until then aufwiedersehen,
Nalin Pithwa

More tough combinatorics tutorial for RMO: continued

Practice. Practice. Practice.

1) In how many ways, can a total of 16 be obtained by rolling 4 dice once?

2) Calculate the coefficient of $t^{12}$ in $(\frac{1-t^{6}}{1-t})^{4}$.

3) Observe the identity of answers to Problem 1 and 2. If you think it is a mere coincidence, experiment with other numbers in place of 16 and 4. If you do not think it is a mere coincidence, explain it and go to Problem 4. If you cannot explain its identity, experiment with other numbers.

4) Express the number $N(n,p)$ of ways of obtaining a total of n by rolling p dice, as a certain coefficient in a suitable product of binomial expansion in powers of t. If you cannot do this problem, go to problem 3.

5) Verify that the number of increasing words of length 10 out of the alphabet $(a,b,c,d,e)$ with $a is the coefficient of $t^{10}$ in $(1-t)^{-5}$. Try to explain why this is so.

6) A child has a store of toy letters consisting of 4 A's, 3 B's, and 2 E's. (6a) How many different increasing four-letter words (given A<B<E) can it make? The child does not worry about the meanings of the words. (6b) Show that there exists a bijection between the set of increasing four-letter words of all possible lengths and the set of terms of the expansion $(1+A+A^{2}+A^{3})(1+B+B^{2}+B^{3})(1+E+E^{2})$. (6c) Can you obtain the answer to (6a) as certain numerical coefficient in a suitable expansion of products?

7) The Parliament of India, in which there are n parties represented, wants to form an all-party committee (meaning, a committee in which there is at least one member from each party) of $r \geq n$ members. Assuming (a) that there exist sufficient members available for the committee in each party and (b) that the members of each party are indistinguishable among themselves(!), find the number of distinct ways of forming the committee. Show that this number may be expressed as a suitable coefficient in the binomial expansion of $(1-t)^{n-r}$

8) Find the number N of permutations of the multiset $(a,a,b,b,b)$ taken three at a time. If you have to express N as the coefficient $t^{3}$ or $t^{3}/3!$ or $3!t^{3}$ (the choice is yours) in the expansion of one of
8a) $(1+t)^{2}(1+t)^{3}$
8b) $(1+t)^{-2}(1+t)^{-3}$
8c) $(1+t+t^{2})(1+t+t+t^{2})$
8d) $(1+t+\frac{t^{2}}{2!})(1+t+\frac{t^{2}}{2!}+\frac{t^{3}}{3!})$

which one would you choose? Can you justify your choice without using the value of N?

9) A family of 3, another family of 2, and two bachelors go for a joy ride in a giant wheel in which there are three swings A, B, C. In how many ways can they be seated in the swings (assuming there are sufficient number of seats in each swing) if the families are to be together? List all the ways.

10) n lines in a plane are in general position, that is, no two are parallel and no three are concurrent. What is the number of regions into which they divide the plane?

11) If $(a_{n})$ is a sequence of numbers satisfying $a_{n}-na_{n-1}=-(a_{n-1}-(n-1)a_{n-2})$, find $a_{n}$, given that $a_{0}=1$ and $a_{1}=0$.

12) If $a_{n}$ is the number of ways in which we can place parentheses to multiply the n numbers $x_{1}, x_{2}, \ldots, x_{n}$ on a calculator, find $a_{n}$ in terms of the $a_{k}$‘s where $k=1,2, \ldots, (n-1)$.

13) A graph $G=G(V,E)$ is a set V of vertices a, b, c, $\ldots$, together with a set $E=V \times V$ of edges $(a,b), (a,a), (b,a), (c,b), \ldots$. If $(x,y)$ is considered the same as $(y,x)$, we say this graph is undirected. Otherwise, the graph is said to be directed, and we say ‘(a,b) has a direction from a to b’. The edge $(x,x)$ is called a loop. The graph is said to be of order $|V|$.

If the edge-set E is allowed to be a multiset, that is, if an edge $(a,b)$ is allowed to occur more than once (and this may be called a ‘multiple edge’), we refer to the graph as a general graph.

$\phi_{5}(n)$ and $\psi_{5}(n)$ denote the numbers of undirected (respectively,directed) loopless graphs of order 5, with n edges, none of them a multiple edge, find the series $\sum \phi_{5}(n) t^{n}$ and $\sum \psi_{5}(n) t^{n}$.

Cheers,
Nalin Pithwa.

Eight digit bank identification number and other problems of elementary number theory

Question 1:

Consider the eight-digit bank identification number $a_{1}a_{2}\ldots a_{8}$, which is followed by a ninth check digit $a_{9}$ chosen to satisfy the congruence

$a_{9} \equiv 7a_{1} + 3a_{2} + 9a_{3} + 7a_{4} + 3a_{5} + 9a_{6} + 7a_{7} + 3a_{8} {\pmod {10}}$

(a) Obtain the check digits that should be appended to the two numbers 55382006 and 81372439.

(b) The bank identification number $237a_{4}18538$ has an illegitimate fourth digit. Determine the value of the obscured digit.

Question 2:

(a) Find an integer having the remainders 1,2,5,5 when divided by 2, 3, 6, 12 respectively (Yih-hing, died 717)

(b) Find an integer having the remainders 2,3,4,5 when divided by 3,4,5,6 respectively (Bhaskara, born 1114)

(c) Find an integer having remainders 3,11,15 when divided by 10, 13, 17, respectively (Regiomontanus, 1436-1476)

Question 3:

Question 3:

Let $t_{n}$ denote the nth triangular number. For which values of n does $t_{n}$ divide $t_{1}^{2} + t_{2}^{2} + \ldots + t_{n}^{2}$

Hint: Because $t_{1}^{2}+t_{2}^{2}+ \ldots + t_{n}^{2} = t_{n}(3n^{3}+12n^{2}+13n+2)/30$, it suffices to determine those n satisfying $3n^{3}+12n^{2}+13n+2 \equiv 0 {\pmod {2.3.5}}$

Question 4:

Find the solutions of the system of congruences:

$3x + 4y \equiv 5 {\pmod {13}}$
$2x + 5y \equiv 7 {\pmod {13}}$

Question 5:

Obtain the two incongruent solutions modulo 210 of the system

$2x \equiv 3 {\pmod 5}$
$4x \equiv 2 {\pmod 6}$
$3x \equiv 2 {\pmod 7}$

Question 6:

Use Fermat’s Little Theorem to verify that 17 divides $11^{104}+1$

Question 7:

(a) If $gcd(a,35)=1$, show that $a^{12} \equiv {\pmod {35}}$. Hint: From Fermat’s Little Theorem, $a^{6} \equiv 1 {\pmod 7}$ and $a^{4} \equiv 1 {\pmod 5}$

(b) If $gcd(a,42) =1$, show that $168=3.7.8$ divides $a^{6}-1$
(c) If $gcd(a,133)=gcd(b,133)=1$, show that $133| a^{18} - b^{18}$

Question 8:

Show that $561|2^{561}-1$ and $561|3^{561}-3$. Do there exist infinitely many composite numbers n with the property that $n|2^{n}-2$ and $n|3^{n}-3$?

Question 9:

Prove that any integer of the form $n = (6k+1)(12k+1)(18k+1)$ is an absolute pseudoprime if all three factors are prime; hence, $1729=7.13.19$ is an absolute pseudoprime.

Question 10:

Prove that the quadratic congruence $x^{2}+1 \equiv 0 {\pmod p}$, where p is an odd prime, has a solution if and only if $p \equiv {pmod 4}$.

Note: By quadratic congruence is meant a congruence of the form $ax^{2}+bx+c \equiv 0 {\pmod n}$ with $a \equiv 0 {\pmod n}$. This is the content of the above proof.

More later,
Nalin Pithwa.

Some basics of Number Theory for RMO: part III: Fermat’s Little Theorem

Fermat’s Little Theorem:

The fact that there are only a finite number of essentially different numbers in arithmetic to a modulus m means that there are algebraic relations which are satisfied by every number in that arithmetic. There is nothing analogous to these relations in ordinary arithmetic.

Suppose we take any number x and consider its powers $x, x^{2}, x^{3}, \ldots$. Since there are only a finite number of possibilities of these to the modulus m, we must eventually come to one which we have met before, say $x^{h} \equiv x^{k} {\pmod m}$, where $k . If x is relatively prime to m, the factor $x^{k}$ can be cancelled, and it follows that $x^{l} \equiv 1 {\pmod m}$, where $l \equiv {h-k}$. Hence, every number x which is relatively prime to m satisfies some congruence of this form. The least exponent l for which $x^{l} \equiv 1 {\pmod m}$ will be called the order of x to the modulus m. If x is 1, its order is obviously 1. To illustrate the definition, let us calculate the orders of a few numbers to the modulus 11. The powers of 2, taken to the modulus 11, are

2, 4, 8, 5, 10, 9, 7, 3, 6, 1, 2, 4, $\ldots$

Each one is twice the preceding one, with 11 or a multiple of 11 subtracted where necessary to make the result less than 11. The first power of 2 which is $\equiv 1$ is $2^{10}$, and so the order of $2 \pmod {11}$ is 10. As another example, take the powers of 3:

3, 9, 5, 4, 1, 3, 9, $\ldots$

The first power of 3 which is equivalent to 1 is $3^{5}$, so the order of $3 \pmod {11}$ is 5. It will be found that the order of 4 is again 5, and so also is that of 5.

It will be seen that the successive powers of x are periodic; when we have reached the first number l for which $x^{l} \equiv 1$, then $x^{l+1} \equiv x$ and the previous cycle is repeated. It is plain that $x^{n} \equiv 1 {\pmod m}$ if and only if n is a multiple of the order of x. In the last example, $3^{n} \equiv 1 {\pmod 11}$ if and only if n is a multiple of 5. This remains valid if n is 0 (since 3^{0} = 1), and it remains valid also for negative exponents, provided $3^{-n}$, is interpreted as a fraction (mod 11) in the way explained earlier (an earlier blog article).

In fact, the negative powers of 3 (mod 11) are obtained by prolonging the series backwards, and the table of powers of 3 to the modulus 11 is:

$\begin{array}{cccccccccccccc} n & = & \ldots & -3 & -2 & -1 & 0 & 1 &2 & 3 & 4 & 5 & 6 & \ldots \\ 3^{n} & \equiv & \ldots & 9 & 5 & 4 & 1 & 3 & 9 & 5 & 4 & 1 & 3 & \ldots \end{array}$

Fermat discovered that if the modulus is a prime, say p, then every integer x not congruent to 0 satisfies

$x^{p-1} \equiv 1 {\pmod p}$….call this as equation A.

In view of what we have seen above, this is equivalent to saying that the order of any number is a divisor of $p-1$. The result A was mentioned by Fermat in a letter to Frenicle de Bessy of 18 October 1640, in which he also stated that he had a proof. But, as with most of Fermat’s discoveries, the proof was not published or preserved. The first known proof seems to have been given by Leibniz (1646-1716). He proved that $x^{p} \equiv x {\pmod p}$, which is equivalent to A, by writing x as a sum $1+ 1 + 1 + \ldots + 1$ of x units (assuming x positive), and then expanding $(1+1+ \ldots + 1)^{p}$ by the multinomial theorem. The terms $1^{p} + 1^{p} + \ldots + 1^{p}$ give x, and the coefficients of all the other terms are easily proved to be divisible by p.

Quite a different proof was given by Ivory in 1806. If $x \not\equiv 0 {\pmod p}$, the integers

$x, 2x, 3x, \ldots, (p-1)x$

are congruent in some order to the numbers

$1, 2, 3, \ldots, p-1$.

In fact, each of these sets constitutes a complete set of residues except that 0 (zero) has been omitted from each. Since the two sets are congruent, their products are congruent, and so

$(x)(2x)(3x) \ldots ((p-1)x) \equiv (1)(2)(3)\ldots (p-1){(\pmod p)}$

Cancelling the factors 2, 3, ….(p-1), as is permissible we obtain the above relation A.

One merit of this proof is that it can be extended so as to apply to the more general case when the modulus is no longer a prime.

The generalization of the result A to any modulus was first given by Euler in 1760. To formulate it, we must begin by considering how many numbers in the set 0, 1, 2, …, (m-1) are relatively prime to m. Denote this number by $\phi(m)$. When m is a prime, all the numbers in the set except 0 (zero) are relatively prime to m, so that $\phi(p) = p-1$ for any prime p. Euler’s generalization of Fermat’s theorem is that for any modulus m,

$x^{\phi(m)} = 1 {\pmod m}$…relation B

provided only that x is relatively prime to m.

To prove this, it is only necessary to modify Ivory’s method by omitting from the numbers $0, 1, 2, \ldots, (m-1)$ not only the number 0, but all numbers which are not relatively prime to m. These remain $\phi(m)$ numbers, say

$a_{1}, a_{2}, \ldots, a_{\mu}$, where $\mu = \phi(m)$.

Then, the numbers

$a_{1}x, a_{2}x, \ldots, a_{\mu}x$

are congruent, in some order, to the previous numbers, and on multiplying and cancelling $a_{1}, a_{2}, \ldots, a_{\mu}$ (as is permissible) we obtain $x^{p} \equiv 1 {\pmod m}$, which is relation B.

To illustrate this proof, take $m=20$. The numbers less than 20 and relatively prime to 20 are :

1, 3, 7, 9, 11, 13, 17, 19.

So that $\phi(20) = 8$. If we multiply these by any number x which is relatively prime to 20, the new numbers are congruent to the original numbers in some other order. For example, if x is 3, the new numbers are congruent respectively to

$3, 9, 1, 7, 13, 19, 11, 17 {\pmod 20}$;

and the argument proves that $3^{8} \equiv 6561$.

Reference:

1. The Higher Arithmetic, H. Davenport, Eighth Edition.
2. Elementary Number Theory, Burton, Sixth Edition.
3. A Friendly Introduction to Number Theory, J. Silverman

Shared for those readers who enjoy expository articles.

Nalin Pithwa.