Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
I took a discrete math class in college where I learned about generating functions and recurrence relations. I was amazed at how versatile these kinds of functions were in modeling combinatorial problems, so after I finished the class, I decided to learn more on my own. During my search for more reading material, I eventually discovered the book “Generatingfunctionology” by Herbert Wilf. As I was reading through the first chapter, I came across the three-term recurrence relation with boundary conditions, and struggled through the details of the method described in the book.
I was eventually able to get a grip on what was happening, but throughout the process, I doubted the validity of many of the steps taken through the solution as presented in the book. Luckily, after much careful thought, I was able to convince myself that every step taken was justified, but it was tricky. There were implicit assumptions made by the author, and there were some results being used that were not obvious to me as I was reading.
Furthermore, part of the general solution was left as an exercise for the reader, so this also left me scratching my head. I want to present my own solution to this exercise as well.
I love the book so far, and am looking forward to learning more, but I wanted to take an opportunity to clarify some of the parts of the solution that I initially had trouble with. Hopefully, this will help someone else struggling to get through that part of the book.
At the end of this post, I’ll provide two examples making use of the techniques presented in the book.
Let me take a moment to derive a basic result about quadratics before discussing the main problem.
Suppose we have the following quadratic equation, where none of the coefficients are 0.
Can the roots of this quadratic equation be 0? Let r1 and r2 be the roots of this quadratic equation. I’ll state the following theorem.
We actually didn’t even make use of the fact that b ≠ 0 in the proof, but it will be important later. We can get a more intuitive understanding of this fact by looking at some simple graphs.
Here are some quadratics cx2 + bx + a where c ≠ 0, but b = 0 and a = 0. These quadratics can of course be written simply as cx2. Here, both roots are equal to 0.
If we have quadratics cx2 + bx + a where both c ≠ 0 and b ≠ 0, but with a = 0, then we can write this as cx2 + bx + a = cx2 + bx = x(cx + b) where only one root is 0, and the other root is non-zero. These quadratics look like the following parabolas. Note how only one point passes through the origin.
Now consider what quadratics of the form cx2 + bx + a look like where c ≠ 0, b ≠ 0, and a ≠ 0. These are like the previous quadratics, except now we’re introducing a non-zero vertical shift to each parabola. This means that the parabola does not pass through the origin, and so neither root is equal to 0.
With this simple result taken care of, let’s start talking about the main problem.
We want to find the general solution to the following problem as presented in the book.
Here, N is some constant natural number greater than 0. The coefficients a, b, and c are some given constants. Finally, the sequence
is given in advance as well.
Before we tackle the problem, I want to make something clear. Here, we’re assuming the constants a, b, and c are all non-zero. If any one were 0, then we would effectively have a two-term recurrence, which defeats the entire purpose of dealing with a three-term recurrence in the first place. This assumption is not made explicit in the text, but will need to be understood in order to justify a future step.
Our goal is to determine the sequence
that satisfies the given constraints.
You can read the details in the book, but eventually we get to the equation
where U(x) is the generating function for sequence
and D(x) is the generating function for sequence
Basically, we need to be able to solve for both u1 and uN-1. This means we need to solve a system of two equations (because we have two unknowns.)
There are two cases to consider.
To form a system of two equations, note that a + bx + cx2 has two roots, which we’re considering to be distinct here. Let’s call these roots r1 and r2. If we substitute r1 into x, we generate one equations as follows.
This is where that preliminary result about the roots of quadratics comes into play. Because we know that c ≠ 0, b ≠ 0, and a ≠ 0, we know that r1 ≠ 0. This means we can divide both sides of the equation by r1 to get our first equation.
We can get our second equation using the exact same logic with the second root r2. This gives us the following system of equations.
By the nature of our recurrence, once we have u1 and uN-1, we just have to solve the recurrence for each individual term of the unknown sequence (un). Because N is a constant, this will be a finite process. Thus, we’ll be able to figure out what the unknown sequence is.
This was the problem left to the reader. For my solution, I used a technique that was touched upon earlier in the book, which was to take a derivative of the generating function. Using the original equation, and a derivative of the equation will yield a system of two equations in two unknowns. Here is what I did.
First, because the roots are equal, I decided to rewrite the quadratic in factored form to make working with it a little bit easier.
First, since both roots are equal, I just used r to refer the the root. Plugging this value in for x yields the following equation.
Now, as I previously said, I took the derivative of both sides with respect to x in order to generate the second equation needed. I substitute r for x after taking the derivative. Here is the result.
We finally have the two equations needed to solve for u1 and uN-1.
Now that we have a handle on both cases, let’s look at an example that’s easier to grasp than the example presented in the book.
Here, we see that a = 2, b = -3, and c = 1. The roots of the quadratic cx2 + bx + a are 1 and 2. Using this, we can solve for u1 and u4 using the solution we found when the roots are distinct.
First, let’s clearly state what D(x) is, because we’ll need to be able to evaluate it.
Now, we solve for u1 and u4,
Now that we have u1, we can solve for u2
We can also solve u3.
Now we know the entire sequence.
We can double check by ensuring that the terms d2 and d3 are acquired by our recurrence using these values of u0, u1, u2, u3, u4, u5.
Everything checks out, and our sequence works as desired!
Let’s check that my solution for the case of repeated roots works by considering the following example.
Here, a = 1, b = -2, and c = 1, so the associated quadratic we have is cx2 + bx + a = x2 – 2x + 1, so both roots are equal to 1, so we’ll let r = 1 throughout this example.
Just as before, let’s take a moment to identify the generating function D(x) as well as D'(x), which we need in this example because the roots are repeated.
Now we can simply use the solution we found in the example to solve for u1 and u4.
Just as in the previous example, we can now solve for u2.
Again, we solve for u3.
Now we know the desired sequence of numbers.
Again, we can check that the recurrence yields d2 and d3 when using this sequence of numbers.
Again, we get the expected results.
At this point, we’ve discussed some of the implicit assumptions, and preliminary results needed to understand the solution presented by Herbert Wilf in his book Generatingfunctionology. We also discussed a solution to a problem he posed, and came up with two example problems making use of the solution.
As stated previously, I’m enjoying working through his book, and would recommend it to anyone wanting to learn more about generating functions. I just wanted to clarify some subtle points that made understanding the solution much easier, and I wanted to propose my own solution to the problem he left for his readers.