maths.free › Combinatorics & Graph Theory › Recurrence Equations › Using generating functions to solve recurrences
Using generating functions to solve recurrences
The approach we have seen thus far in this chapter is not the only way to solve recurrence equations. Additionally, it really only applies to linear recurrence equations with constant coefficients.
Using generating functions to solve recurrences
The approach we have seen thus far in this chapter is not the only way to solve recurrence equations. Additionally, it really only applies to linear recurrence equations with constant coefficients. In the remainder of the chapter, we will look at some examples of how generating functions can be used as another tool for solving recurrence equations. In this section, our focus will be on linear recurrence equations. In , we will see how generating functions can solve a nonlinear recurrence.
Our first example is the homogeneous recurrence that corresponds to the advancement operator equation in .
Example
Consider the recurrence equation \(r_{n}+r_{n-1}-6r_{n-2} = 0\) for the sequence \(\{r_n\colon n\geq 0\}\) with \(r_0=1\) and \(r_1=3\). This sequence has generating function \[\begin{aligned}\end{aligned}\] Now consider for a moment what the function \(xf(x)\) looks like. It has \(r_{n-1}\) as the coefficient on \(x_n\). Similarly, in the function \(-6x^2 f(x)\), the coefficient on \(x^n\) is \(-6r_{n-2}\).
What is our point in all of this? Well, if we add them all up, notice what happens. The coefficient on \(x_n\) becomes \(r_n+r_{n-1}-6r_{n-2}\), which is \(0\) because of the recurrence equation! Now let's see how this all lines up: \[\begin{aligned}f(x) \amp = r_0 + r_1 x + r_2x^2 + r_3 x^3 + \cdots + r_nx^n + \cdots \\ xf(x) \amp = 0 + r_0 x + r_1x^2 + r_2 x^3 + \cdots r_{n-1}x^n + \cdots \\ -6x^2f(x) \amp = 0 + 0 -6r_0x^2 - 6r_1 x^3 + \cdots - 6r_{n-2}x^n + \cdots\end{aligned}\] When we add the left-hand side, we get \(f(x)(1+x-6x^2)\). On the right-hand side, the coefficient on \(x^n\) for \(n\geq 2\) is \(0\) because of the recurrence equation. However, we are left with \(r_0 + (r_0+r_1)x = 1 + 4x\), using the initial conditions. Thus, we have the equation \[\begin{aligned}\end{aligned}\] or \(f(x) = (1+4x)/(1+x-6x^2)\). This is a generating function that we can attack using partial fractions in SageMath:
This shows us that \[\begin{aligned}\end{aligned}\]. From here, we read off \(r_n\) as the coefficient on \(x^n\) and have \(r_n = (6/5) 2^n -(1/5)(-3)^n\).
Although there's a bit more work involved, this method can be used to solve nonhomogeneous recurrence equations as well, as the next example illustrates.
Condensed: the full section is in Keller & Trotter, Applied Combinatorics.
今度はあなたの番 計算機では解けませんが、計算可能です。下の一つを試してみましょう。もしくは自分で入力してください。
ここで使用された記号
どの記号をタップしても、定義、画像、それぞれの文字の意味が表示されます。
よくある質問
Permutation or combination?
Ask whether order matters. A lock code is a permutation (order matters); a hand of cards is a combination (it does not).
What is a graph in this sense?
Dots (vertices) joined by lines (edges), not a plot. Road maps, social networks and molecules are graphs; questions like "is there a route" and "how few colours" are graph theory.
Parts of this page are adapted from Keller & Trotter, Applied Combinatorics (CC BY-SA 4.0). ここでは要約して説明し直しています。誤りは私たちの責任です。
More in Combinatorics & Graph Theory
The counting principlesPigeonhole principle and inclusion, exclusionBinomial coefficients and Pascal's triangleRecurrences and generating functionsGraphs: vertices, edges, degreesPaths, cycles, trees, Euler and HamiltonColouring and planar graphs