<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\section{Fibonacci}

\definition{}
The \textit{Fibonacci numbers} are defined by the following recurrence relation:
\begin{itemize}
	\item $f_0 = 0$
	\item $f_1 = 1$
	\item $f_n = f_{n-1} + f_{n-2}$
\end{itemize}

\problem{}
Let $F(x)$ be the generating function that corresponds to the Fibonacci numbers. \par
Find the generating function of $0, f_0, f_1, ...$ in terms of $F(x)$. \par
Call this $G(x)$.

\begin{solution}
	\begin{equation*}
		G(x) = xF(x)
	\end{equation*}
\end{solution}

\vfill

\problem{}
Find the generating function of $0, 0, f_0, f_1, ...$ in terms of $F(x)$.
Call this $H(x)$.

\begin{solution}
	\begin{equation*}
		H(x) = x^2F(x)
	\end{equation*}
\end{solution}

\vfill

\problem{}
Calculate $F(x) - G(x) - H(x)$ using the recurrence relation that
we used to define the Fibonacci numbers.

\begin{solution}
	\begin{align*}
		F(x) - G(x) - H(x)
		&amp;=~ f_0 + (f_1 - f_0)x + (f_2 - f_1 - f_0)x^2 + (f_3 - f_2 - f_1)x^3 + ... \\
		&amp;=~ f_0 + (f_1 - f_0)x \\
		&amp;=~ x
	\end{align*}
\end{solution}

\vfill
\pagebreak


\problem{}&lt;fibo&gt;
Using the problems on the previous page, find $F(x)$ in terms of $x$.

\begin{solution}
	\begin{align*}
		x
		&amp;=~ F(x) - G(x) - H(x) \\
		&amp;=~ F(x) - xF(x) - x^2F(x) \\
		&amp;=~ F(x)(1-x-x^2)
	\end{align*}

	So,
	\begin{equation*}
		F(x) = \frac{x}{1-x-x^2}
	\end{equation*}
\end{solution}

\vfill




\definition{}
A \textit{rational function} $f$ is a function that can be written as a quotient of polynomials. \par
That is, $f(x) = \frac{p(x)}{q(x)}$ where $p$ and $q$ are polynomials.

\problem{}
Solve the equation from \ref&lt;fibo&gt; for $F(x)$, expressing it as a rational function.

\begin{solution}
	\begin{align*}
		F(x)
		&amp;=~ \frac{-x}{x^2+x-1} = \frac{-x}{(x-a)(x-b)} \\
		&amp;=~ \frac{1 - \sqrt{5}}{2\sqrt{5}}\frac{1}{x-a} + \frac{-1 - \sqrt{5}}{2\sqrt{5}}\frac{1}{x-b}
	\end{align*}

	where

	\begin{equation*}
		a = \frac{-1 + \sqrt{5}}{2} ;~~
		b = \frac{-1 - \sqrt{5}}{2}
	\end{equation*}
\end{solution}

\vfill
\pagebreak


\definition{}
\textit{Partial fraction decomposition} is an algebreic technique that works as follows: \par
If $p(x)$ is a polynomial and $a$ and $b$ are constants,
we can rewrite the rational function $\frac{p(x)}{(x-a)(x-b)}$ as follows:
\begin{equation*}
	\frac{p(x)}{(x-a)(x-b)} = \frac{c}{x-a} + \frac{d}{x-b}
\end{equation*}
where $c$ and $d$ are constants.


\problem{}&lt;pfd&gt;
Now that we have a rational function for $F(x)$, \par
find a closed-form expression for its coefficients using partial fraction decomposition.

\begin{solution}
	\begin{align*}
		F(x)
		&amp;=~
			\left(\frac{1 - \sqrt{5}}{2\sqrt{5}}\right)\left(\frac{-1}{a}\right)\left(\frac{1}{1-\frac{x}{a}}\right)
			+ \left(\frac{-1 - \sqrt{5}}{2\sqrt{5}}\right)\left(\frac{-1}{b}\right)\left(\frac{1}{1-\frac{x}{b}}\right) \\
		&amp;=~
			\left(\frac{1}{\sqrt{5}}\right)\left(\frac{1}{1-\frac{x}{a}}\right)
			+ \left(\frac{-1}{\sqrt{5}}\right)\left(\frac{1}{1-\frac{x}{b}}\right) \\
		&amp;=~
			\frac{1}{\sqrt{5}}\left(1 + \frac{x}{a} + \left(\frac{x}{a}\right)^2 + ...\right)
			- \frac{1}{\sqrt{5}}\left(1 + \frac{x}{b} + \left(\frac{x}{b}\right)^2 + ...\right)
	\end{align*}
\end{solution}

\vfill

\problem{}
Using problems from the introduction and \ref{pfd}, find an expression
for the coefficients of $F(x)$ (and this, for the Fibonacci numbers).


\begin{solution}
	\begin{align*}
		f_0 &amp;= \frac{1}{\sqrt{5}} - \frac{1}{\sqrt{5}} = 0 \\
		f_1 &amp;= \frac{1}{a\sqrt{5}} - \frac{1}{b\sqrt{5}} = 1 \\
		f_n &amp;= \frac{1}{\sqrt{5}}\left(\frac{1}{a^n} - \frac{1}{b^n}\right)
		= \frac{1}{\sqrt{5}}\left(
			\left(\frac{1 + \sqrt{5}}{2}\right)^n
			- \left(\frac{1-\sqrt{5}}{2}\right)^n
		\right)
	\end{align*}
\end{solution}

\vfill
\pagebreak

\problem{Bonus}
Repeat the method of recurrence, generating function,
partial fraction decomposition, and geometric series
to find a closed form for the following sequence:
\begin{equation*}
	a_0 = 1 ;~~ a_{n+1} = 2a_n + n
\end{equation*}

\hint{
	When doing partial fraction decomposition with a
	denominator of the form $(x-a)^2(x-b)$,
	you may need to express your expression as a sum of three fractions:
	$\frac{c}{(x-a)^2} + \frac{d}{x-a} + \frac{e}{x-b}$.`'
}

\vfill
\pagebreak</pre></body></html>