Chapter 8 | Advanced Counting Techniques¶
Recurrence Relations¶
Definition
A recurrence relation for a sequence \(\{a_n\}\) is an equation that express \(a_n\) in terms of one or more of the previous terms of the sequence.
- A sequence is called a solution of recurrence relation if its term satisfy the recurrence relation.
- A particular solution needs some initial conditions.
Actually, there are many recurrence relations that don't have a solution. But for some certain cases, we have some methods to obtain the solutions. Here we only focus the following form of recurrence relations:
Definition
A linear homogeneous recurrence relation of degree \(k\) with constant coeffieients is a recurrence relation of the form
where \(c_i \in \mathbb{R}\) and \(c_k \neq 0\).
Example
- \(a_n = a_{n - 1} + a_{n - 2}^2\) is not linear.
- \(a_n = 2a_{n - 1} + 1\) is not homogeneous.
- \(a_n = na_{n - 1}\) has no constant coefficients.
Now we discuss the solution for it. First we define characteristic equation by
and the roots \(r_i\) are called the characteristic roots.
degree \(k = 2\)
Theorem
Let \(c_1\) and \(c_2\) be real numbers. Suppose that the characteristic equation
-
has two distinct roots \(r_1\) and \(r_2\). Then the solution is of the form
\[ a_n = \alpha_1 r_1^n + \alpha_2 r_2^n,\ \ \text{ where $\alpha_1$ and $\alpha_2$ are constants}. \] -
has only one root \(r_0\). Then the solution is of the form
\[ a_n = \alpha_1 r_0^n + \alpha_2 n r_0^n,\ \ \text{ where $\alpha_1$ and $\alpha_2$ are constants}. \]
Example
Find the solution of \(a_n = a_{n - 1} + 2a_{n - 2}\) with intial conditions \(a_0 = 2\) and \(a_1 = 7\).
Solution.
The charateristic equation is \(r^2 - r - 2 = 0\) and the roots are \(r = 2\) and \(r = -1\). The general solution is
Substitue initial condition, we have \(\alpha_1 = 3\) and \(\alpha_2 = -1\).
Thus the solution is \(a_n = 3 \cdot 2^n - (-1)^n\).
Find the solution of \(a_n = 6a_{n - 1} - 9a_{n - 2}\) with intial conditions \(a_0 = 1\) and \(a_1 = 6\).
Solution.
The charateristic equation is \(r^2 - 6r + 9 = 0\) and the root is \(r = 1\). The general solution is
Substitue initial condition, we have \(\alpha_1 = 1\) and \(\alpha_2 = 1\).
Thus the solution is \(a_n = 3^n + n \cdot 3^n\).
degree \(k\)
Theorem
Let \(c_1, \dots, c_k\) be real numbers. Suppose that the characteristic equation
-
has \(k\) distinct roots \(r_1, \dots, r_k\). Then the solution is of the form
\[ a_n = \alpha_1 r_1^n + \alpha_2 r_2^n + \cdots + \alpha_k r_k^n,\ \ \text{ where $\alpha_i$ are constants}. \] -
has \(t\) distinct roots \(r_1, \dots, r_t\) with multiplicitiese \(m_1, \dots, m_t\). Then the solution is of the form
\[ \begin{aligned} a_n &= (\alpha_{1, 0} + \alpha_{1, 1}n + \cdots + \alpha_{1, m_1} n^{m_1 - 1}) r_1^n \\ &+ (\alpha_{2, 0} + \alpha_{2, 1}n + \cdots + \alpha_{2, m_2} n^{m_2 - 1}) r_2^n \\ &+ \cdots \\ &+ (\alpha_{t, 0} + \alpha_{t, 1}n + \cdots + \alpha_{t, m_t} n^{m_t - 1}) r_t^n \\ \end{aligned} ,\ \ \text{ where $\alpha_{ij}$ are constants}. \]
Example
Find the solution of \(a_n = 6a_{n - 1} - 11a_{n - 2} + 6a_{n - 3}\) with intial conditions \(a_0 = 2\), \(a_1 = 5\) and \(a_2 = 15\).
Solution.
The charateristic equation is \(r^3 - 6r^2 + 11r - 6 = 0\) and the roots are \(r = 1\), \(r = 2\) and \(r = 3\). The general solution is
Substitue initial condition, we have \(\alpha_1 = 1\), \(\alpha_2 = -1\) and \(\alpha_3 = 2\).
Thus the solution is \(a_n = 1 - 2^n + 2 \cdot 3^n\).
Find the solution of \(a_n = -3a_{n - 1} - 3a_{n - 2} - a_{n - 3}\) with intial conditions \(a_0 = 1\), \(a_1 = -2\) and \(a_2 = -1\).
Solution.
The charateristic equation is \(r^3 + 3r^2 + 3r + 1 = (r + 1)^3 = 0\) and the root is \(r = -1\) of multiplicity \(3\). The general solution is
Substitue initial condition, we have \(\alpha_{1, 0} = 1\), \(\alpha_{1, 1} = 3\) and \(\alpha_{1, 2} = -2\).
Thus the solution is \(a_n = (1 + 3n - 2n^2)(-1)^n\).
Moreover, we can also consider the nonhomogeneous cases.
Definition
A linear nonhomogeneous recurrence relation of degree \(k\) with constant coeffieients is a recurrence relation of the form
where \(c_i \in \mathbb{R}\) and \(F(n) \not\equiv = 0\). And
is called the associated homogeneous recurrence relation.
Theorem
If \(\{a_n^{(p)}\}\) is particular solution of the linear nonhomogeneous recurrence relation with constant coefficients
then each solution is of the form \(\{a_n^{(p)} + a_n^{(h)}\}\), where \(a_n^{(h)}\) is a solution of the associated homogeneous recurrence relation
Example
Find solutions of \(a_n = 3a_{n - 1} + 2n\) with \(a_1 = 3\).
Solution.
The associated linear homogeneous recurrence relation is \(a_n = 3a_{n-1}\), whose solution is \(a_n^{(h)} = \alpha \cdot 3^n\).
It's reasonable to try \(a_n^{(p)} = cn + d\) as a solution. Then from \(a_n = 3a_{n - 1} + 2n\) we have
and thus \(c = -1\) and \(d = -\cfrac{3}{2}\).
The general solution is
Substitute \(a_1 = 3\), we have \(\alpha = \cfrac{11}{6}\). Thus
Moreover, for specific forms of \(F(n)\), we have the following theorem.
Theorem
If \(F(n) = (b_t n^t + b_{t - 1} n^{t - 1} + \cdots + b_1 n + b_0) s^n\), where \(b_i, s \in \mathbb{R}\).
-
When \(s\) is not a characteristic root of the associated linear homogeneous recurrence relation, there is a particular solution of the form
\[ a_n^{(p)} = (p_t n^t + p_{t - 1} n^{t - 1} + \cdots + p_1 n + p_0) s^n. \] -
When \(s\) is a characteristic root with multiplicity \(m\), there is a particular solution of the form
\[ a_n^{(p)} = n^m (p_t n^t + p_{t - 1} n^{t - 1} + \cdots + p_1 n + p_0) s^n. \]
Example
Consider \(a_n = 6a_{n - 1} - 9a_{n - 2} + F(n)\). The charateristic root is \(r = 3\) of multiplicity \(2\).
- If \(F(n) = 3^n\), then \(a_n^{(p)} = n^2 p_0 3^n\).
- If \(F(n) = n \cdot 3^n\), then \(a_n^{(p)} = n^2(p_1 n + p_0) 3^n\).
- If \(F(n) = n^2 2^n\), then \(a_n^{(p)} = (p_2 n^2 + p_1 n + p_0) 2^n\).
- If \(F(n) = (n^2 + 1) 3^n\), then \(a_n^{(p)} = n^2 (p_2 n^2 + p_1 n + p_0) 3^n\).
Generating Functions¶
Definition
The generating function for the sequence \(a_0, a_1, \dots\) is the infineite series
For finite sequence, then
Property
Let \(f(x) = \sum\limits_{k = 0}^{\infty}a_k x^k\) and \(g(x) = \sum\limits_{k = 0}^{\infty}b_k x^k\).
- \(f(x) + g(x) = \sum\limits_{k = 0}^{\infty}(a_k + b_k) x^k\)
- \(f(x) \cdot g(x) = \sum\limits_{k = 0}^{\infty}(\sum\limits_{j = 0}^k a_j b_{k - j}) x^k\)
- \(\alpha f(x) = \sum\limits_{k = 0}^{\infty} \alpha a_k x^k\)
- \(x f'(x) = \sum\limits_{k = 0}^{\infty} k a_k x^k\)
- \(f(\alpha x) = \sum\limits_{k = 0}^{\infty} \alpha^k a_k x^k\)
Definition
For \(u \in \mathbb{R}\) and \(k \in \mathbb{N}^*\), the extended binomial coefficient is
In particular, for \(u = -n\),
Theorem | Extended Binomial Theorem
If \(x, u \in \mathbb{R}\) and \(|x| < 1\), then
Application¶
Solve Recurrence Relations
Solve \(a_n = 8a_{n - 1} + 10^{n - 1}\) with initial condition \(a_0 = 1\).
Solution.
Let \(G(x) = \sum\limits_{k = 0}^{\infty} a_k x^k\). Then
Thus
Therefore
Combination
-
Find \(C(n, k)\).
\[ G(x) = (1 + x)^n = \sum\limits_{k = 0}^n C(n, k) x^k. \] -
Find \(C(n + r - 1, r)\).
\[ \begin{aligned} G(x) &= (1 + x + x^2 + x^3 + \cdots)^n = \frac{1}{(1 - x)^n} = (1 + (-x))^{-n} \\ &= \sum\limits_{r = 0}^{\infty}\binom{-n}{r}(-x)^r = \sum\limits_{r = 0}^{\infty}\binom{-n}{r}(-1)^r x^r \\ &= \sum\limits_{r = 0}^{\infty}(-1)^r C(n + r - 1, r) (-1)^r x^r \\ &= \sum\limits_{r = 0}^{\infty}C(n + r - 1, r) x^r \end{aligned} \]
Example
Find the number of solution of
where \(x_1, x_2, x_3 \in \mathbb{N}\) with \(2 \le x_1 \le 5\), \(3 \le x_2 \le 6\) and \(4 \le x_3 \le 7\).
Solution.
It's the same to find the coefficient of \(x^{17}\) in the expansion of
Thus the answer is \(3\).
Permutation
Definition
The exponential generating function for \(\{a_n\}\) is \(\sum\limits_{n = 0}^{\infty} \cfrac{a_n}{n!}x^n\).
Example
How many different strings with four characaters can be formed from four \(A\), two \(B\), two \(C\), two \(D\), two \(E\) and one \(F\), one \(G\), one \(H\)?
Solution.
It's the same to find the coefficient of \(\cfrac{x^{4}}{4!}\) in the expansion of
Thus the answer is \(3029\).
Example
How many different strings with length \(r\) made from digits \(1, 3, 5, 7, 9\) are there which contain even \(3\)s and even \(7\)s?
Solution.
Notice that \(e^x + e^{-x} = 2 \left(1 + \cfrac{x^2}{2!} + \cfrac{x^4}{4!} + \cdots \right)\), hence
Thus the answer is \(\frac{1}{4} \cdot 5^r + \frac{1}{2} \cdot 3^r\).
Principle of Inclusion-Exclusion¶
Recall principle of inclusion-exclusion
An Alternative Form
Suppose \(A_i \{x | x \text{ has property } P_i\}\), and
Example
How many solution does
have, where \(x_i \in \mathbb{N}\) with \(x_1 \le 3\), \(x_2 \le 4\) and \(x_3 \le 6\)?
Solution.
Let \(P_1 : x_1 > 3\), \(P_2 : x_2 > 4\) and \(P_3 : x_3 > 6\). The answer is
We have
Thus
Example
How many onto functions are there from a set of \(6\) elements to a set of \(3\) elements?
Solution.
Suppose codomain = \(\{b_1, b_2, b_3\}\). Let \(P_i\) be the property that \(b_i\) are not in the range of the function. Then a function is onto iff it has none of properties \(P_1\), \(P_2\) or \(P_3\).
The answer is
We have
Thus
Theorem
There are
onto functions from a set with \(m\) elements to a set with \(n\) elements, where \(m, n \in \mathbb{N}^*\).
创建日期: 2023.01.15 13:54:18 CST