Talk:High School Mathematics Extensions/Counting and Generating Functions

I think the guessing part is bad mathematics
I think the guessing solution is bad mathematics. I dont know who came up with the idea of guessing. I know that part of the mathematics isn't guessing, it's an observation turned generalisation. Nothing is guesswork, but careful deduction and elimination. I think it would be good to just keep it there for the moment being. But it will need to be heavily edited before the first draft.Xiaodai 22:54, 5 Feb 2004 (UTC)

Uh, smart guessing isn't bad mathematics - if you have a problem and you have a good idea that it may lead to a positive outcome, then there's no real harm in guessing - afterward you can clean up, and justify the guess. I suppose you'd like some justification of the "guess", and I should have done that earlier, so I apologise Dysprosia 23:20, 5 Feb 2004 (UTC)


 * Yeah. Justification would be nice, but I think the idea comes from the derivation method. I dont think we should say it's guesswork, because it's something that follows naturally once you know the work. Xiaodai 00:29, 6 Feb 2004 (UTC)


 * I would argue the opposite, if, say, you were confronting the theory of linear recurrence relations for the first time. You might try polynomials at first and see that they don't work, or try something else - then see that exponentials work, then try and fiddle around with exponentials and then see that they form the general solution, then try and explain why exponentials work. It's much more difficult to come up with some general theory, and then make it more specific. Dysprosia 01:41, 6 Feb 2004 (UTC)

Alternate solution to example 1
We have $$x_n = 2x_{n-1} + 3x_{n-2}$$. Let us suppose that we will have a solution will be in the form rn for some r (Later we will show you that this is just the right form of solution to choose). If we substitute this guess in, we obtain
 * rn = 2rn-1+3rn-2

Divide throughout by rn-2
 * r2 = 2r+3

But this is just a quadratic equation - we can easily solve to get roots
 * &alpha;=-1, &beta;=3

So we have two solutions, A(-1)n, and B(3n). We can add these solutions together to get a new solution*, but we need to find out what coefficients A and B are. We've been given initial conditions x0 = 1, x1 = 1. So, let's substitute x0 into xn=A(-1) n +B(3 n).
 * 1 = A(-1)^0+B(3^0)
 * 1 = A+B

Now substitute x1
 * 1 = -A+3B

Solve these two to get A=B=1/2.

So our solution is xn=1/2((-1)n+3n), same as above.


 * We know this because, if an and bn are both solutions, and we substitute into the general recurrence relation
 * xn=Axn-1+Bxn-2

we get, for an and bn, since they are solutions
 * 0=Aan-1+Ban-2-an
 * 0=Abn-1+Bbn-2-bn

Substituting their sum,
 * A(an-1+bn-1)+B(an-2+bn-2) - (an+bn)
 * =Aan-1+Ban-2-an+
 * Abn-1+Bbn-2-bn
 * =0+0=0

So both the solutions and their sum satisfy the linear recurrence.

Now why is rn such a good solution for linear recurrences? For simplicity, we'll prove this for recurrences in the form an=Aan-1+Ban-2, but the proof can be extended easily to general linear recurrences like the ones you see below.

Now r must be a solution of the quadratic equation x2-Ax-B=0 to be a solution. Why is this so? We have the recurrence
 * an=Aan-1+Ban-2

rearranging
 * an-Aan-1-Ban-2=0

Substitute rn (r not zero) into the recurrence to get
 * rn-Arn-1-Brn-2=0

Now factor out by rn-2, the term farthest on the right
 * rn-2(r2-Ar-B)=0

We know that r isn't zero, so rn-2 can never be zero. So r2-Ar-B must be zero, and so rn, with r a solution of r2-Ar-B=0, will be a solution of the linear recurrence.

Why is this removed, now? If you don't like the approach, just say the word, but it's just a good and logical method as the ones featured in the text. Dysprosia 05:34, 12 Feb 2004 (UTC)


 * This removal is temporary. I think what you have done there is good work. What I would like to do with is to modify it a little so that it's a demonstrastion of how this method of guessing is derived, not just an alternate solution to example 1, but something bigger and more general. The work you have done on this section isn't all that convincing, because the justification (derivation) part isn't fully complete. This will need to be modified (by you or me), before incorporating back into the main article. That's why I just copy-and-pasted it, I see value in this, but not just a solution for example 1. Xiaodai 00:35, 13 Feb 2004 (UTC)

Thanks Xiaodai. How's this: moved to Discrete mathematics/Recursion Feel free to merge some stuff across here, if you like :)

Note there are special circumstances when the roots of the characteristic equation are not distinct, and I'll add them later. Dysprosia 04:49, 13 Feb 2004 (UTC)

Partial fraction
Has anyone done a tutorial on how to do partial fractions? Like how to separate into fraction with unique denomiators? Or do I have to write my own?


 * It's not so easy to cover systematically and gently, but I'll have a go if I have some time to spare... Calculus/Integration techniques or something ... Dysprosia 00:04, 18 Feb 2004 (UTC)

Some hints please (1.1 2c)
I am kind of stuck on finding the answer to 1.1 2c (finding f(n) for $$\frac{z^2 - 1}{1 + 3z^3} $$) I would really like it if somebody could give me some hints on how to solve this problem. Mmartin 15:18, 15 Aug 2004 (UTC)


 * Well this is a hard exercise and it's requires a deep understanding of the topic. Try to emulate the derivation of the closed form of other generating functions. Note that
 * $$\frac{1}{1 - z} = 1 + z + z^2 + ... $$

now replace z by 3w^3, what happens? Xiaodai 07:10, 16 Aug 2004 (UTC)


 * If you know Taylor series, you can try and apply that and glean the general form for the coefficients :P Dysprosia 12:48, 30 Oct 2004 (UTC)

Project
I'm considering writing a project on power sum,it may cross this chapter and the mathematical proof chapter. Anyway here is the working draft, I'll place it in the correct location once it has been done to a certain degrees.

Note: Notation is quite a problem here, in question 1, S(z) is a generating function of square number, Sn is the sum of the first n square number, and P2 is a generating function of power sum in degrees 2, i.e. the sum of square number.

Project-Power Sum-First draft 1.a) Find the closed-form of the generating function
 * $$S(z)=1^2+2^{2}z+3^{2}z^{2}+4^{2}z^{3}+...$$
 * (Hint:Reduce it into a linear generating function first)
 * b) Hence find the generating function of
 * $$P_{2}(z)=S_{1}+S_{2}z+S_{3}z^2+S_{4}z^3+...$$
 * Where $$S_n=1^2+2^2+3^2+...+n^2$$
 * And then find out the general formula for Sn

1.a)

$$ \begin{matrix} & & S(z) &=& 1^2 & +2^{2}z & +3^{2}z^{2} & +4^{2}z^{3}+...\\ z & \times & S(z) &=& & z & +2^{2}z^2 & +3^{2}z^3+...\\ (1-z) & \times & S(z) &=& 1 & +3z & +5z^2 & +7z^3+...\\ \end{matrix} $$

$$ \begin{matrix} & & (1-z)S(z) &=& 1 & +3z & +5z^2 & +7z^3+...\\ z & \times & (1-z)S(z) &=& & z & +3z^2 & +5z^3+...\\ (1-z) & \times & (1-z)S(z) &=& 1 & +2z & +2z^2 & +2z^3+...\\ & & (1-z)^{2}S(z) &=& \frac{2}{1-z} -1\\ \end{matrix} $$

$$S(z) = \frac{2}{(1-z)^3} - \frac{1}{(1-z)^2}$$


 * b)

$$ \begin{matrix} & & S(z) &=& 1^2 & +2^{2}z & +3^{2}z^{2} & +4^{2}z^{3}+...\\ z & \times & S(z) &=& & 1^{2}z & +2^{2}z^2 & +3^{2}z^3+...\\ z^2 & \times & S(z) &=& &  & 1^{2}z^2 & +2^{2}z^3+...\\ z^3 & \times & S(z) &=& &  &  & 1^{2}z^3+...\\ ...\\ (1+z+z^2+z^3+...) & \times & S(z) &=& S_{1} & + S_{2}z & + S_{3}z^2 & + S_{4}z^3+ ...\\ \end{matrix} $$

$$\frac{S(z)}{1-z} = P_{2}(z)$$ $$P_{2}(z) = \frac{2}{(1-z)^4} - \frac{1}{(1-z)^3}$$

$$\sum_{i=0}^{\infty} [2{4+i-1 \choose i} z^i] - \sum_{i=0}^{\infty} [{3+i-1 \choose i} z^i] = P_{2}(z)$$ $$\sum_{i=0}^{\infty} [2{3+i \choose i} - {2+i \choose i}] z^i = \sum_{i=0}^{\infty} S_{i+1} z^i$$ $$[2{3+i \choose i} - {2+i \choose i}] z^i = S_{i+1} z^i$$ $$2{3+i \choose i} - {2+i \choose i} = S_{i+1}$$ So n = i+1. $$2{n+2 \choose n-1} - {n+1 \choose n-1} = S_{n}$$ $$S_{n} = 2{n+2 \choose (n+2)-(n-1)} - {n+1 \choose (n+1)-(n-1)}$$ $$S_{n} = 2{n+2 \choose 3} - {n+1 \choose 2}$$ $$S_{n} = \frac{2(n+2)(n+1)n}{6} - \frac{(n+1)n}{2}$$ $$S_{n} = \frac{2(n+2)(n+1)n - 3(n+1)n}{6}$$ $$S_{n} = \frac{[2(n+2) - 3](n+1)n}{6}$$ $$S_{n} = \frac{n(n+1)(2n+1)}{6}$$

2.Let $$p_n = 1^n + 2^n z + 3^n z^2 + 4^n z^3 + ...$$
 * a)Recall that $$\frac{d}{dx}x^n = nx^{n-1}$$
 * Try to define pn recursively.
 * b)Using 2a), or otherwise, find out the closed-form of the generating function of p3, p4, and p5.


 * Ok, cool. I will read the thing carefully now. Xiaodai 23:39, 27 Dec 2004 (UTC)


 * Update:It appears that power sum is a deep and difficult topic, so... I've discovered that the topic of generating function is deep and wide, that we couldn't possibly cover 'em all in those 25 pages. I propose exploring exponential generating function in the project, is it ok? Somehow it is the most common generating function right after ordinary generating function. --Lemontea 10:49, 12 August 2005 (UTC)


 * Sounds good, i can't pretend to have cover everything i know about generating functions in those pages. Feel free to add your own content! It's great. But somehow i dont know how ppl will discover how to diff e^x. Xiaodai 14:14, 12 August 2005 (UTC)


 * Ha! When I learn differentiating, I was told to define e so that we can differentiate log x, then went on to discover e^x is the solution of the differential equation f'(x) = f(x) lol. (Opps, I spoiled what will appear later on!) --Lemontea 14:33, 12 August 2005 (UTC)

Generating functions and the z-transformation
What do the counting and generating functions have in common with the z-transformation. (The z-transformation of $$f(n)$$ I came across is defined by $$\sum_{n=0}^{\infty}f(n)z^n$$) It seems to me that the generating function of some series is the z-transform of the function that gives the coefficients of the polynomial. If that's the case it might be nice to inform the reader about it.

Counting and Generating Functions
In the first section of "Counting and Generating Functions", there is a note about it called "Info - Infinite Sums". It says that the two expressions (the infinite geometric series and the formula for it) are not equal. An example was also given by adding a finite amount of terms of the series and comparing the sum with the result from the formula. I disagree with this statement that the two expressions are not equal. First, infinite sums have to be defined and it is DEFINED to be the limit of the partial sum as the number of terms go to infinity if the limit exists. So when the formula was derived, it IS equal to the geometric series according to the definition. The example is not a valid way of showing that the two things are different since it was a finite amount of terms, so of course the number will be close but not equal. According to the definition the value of the infinite series is the LIMIT defined before, so in the example it is 2 and the formula also gives 2 which are equal. Also, I am not just making up this definition, its in any rigorous calculus book such as by Spivak.