Let F0=0,F1=1 and Fn=Fn−1+Fn−2 for n≥2. Then the ordinary generating function F(x)=∑n=0∞Fnxn equals F(x)=1−x−x2x.
Why is it true?
A linear recurrence with constant coefficients always turns into a simple algebraic (in fact, rational) equation once you multiply through by xn and sum over all n — the recurrence becomes multiplication by a polynomial in x.
Proof sketch
Multiply the recurrence Fn=Fn−1+Fn−2 (valid for n≥2) by xn and sum over n≥2: ∑n≥2Fnxn=∑n≥2Fn−1xn+∑n≥2Fn−2xn.
The left side is F(x)−F0−F1x=F(x)−x. The first sum on the right is x∑n≥2Fn−1xn−1=x∑m≥1Fmxm=x(F(x)−F0)=xF(x). The second sum is x2∑n≥2Fn−2xn−2=x2∑k≥0Fkxk=x2F(x).
So F(x)−x=xF(x)+x2F(x), i.e. (1−x−x2)F(x)=x.
Solving for F(x) gives F(x)(1−x−x2)=x, hence F(x)=1−x−x2x, a single rational function that packs the entire infinite Fibonacci sequence.