TITLE: Difference between generating functions and formal power series
QUESTION [7 upvotes]: So I was reading about generating functions and formal power series, and it seems that these two concepts are used interchangeably.
Can someone please tell me the difference between them? Is generating functions a method that involves using formal power series?
Thanks.

REPLY [4 votes]: Generating functions come in two different flavours. Given a counting function $a:\mathbb{N}_{0}\to\mathbb{C}$ often written as sequence $(a_n)_{n\geq 0}$ we can associate with it a power series
\begin{align*}
A(z)=\sum_{n=0}^\infty a_nz^n\tag{1}
\end{align*}
which is called generating function (GF) of the sequence. We can view a GF as a purely formal, i.e. algebraic object.
GF as algebraic object:
Here we consider the ring (or algebra) $\left(K[[z]],+.\cdot\right)$ of formal power series
\begin{align*}
A(z)=\sum_{n=0}^\infty a_nz^n
\end{align*}
which are subject to addition, multiplication, composition, etc. obeying corresponding rules. The term formal is used to address purely algebraic objects. The indeterminate $z^n$ is just a mark for where the $n$-th coefficient $a_n$ is placed.


In this context a generating function and a formal power series are considered to be the same.

But there is more we can do with generating functions. They can also be viewed as analytic objects.



GF as analytic object:
In order to get information about the behavior of numerical sequences $a_n$ for large $n$, we study the corresponding generating functions   $A(z)$. Here complex analysis plays a key role and the asymptotic study of function is essential for gaining insight.
With respect to the asymptotic  behavior of the coefficients from $A(z)$, P. Flajolet and R.  Sedgewick  motivate in  Analytic   Combinatorics this as follows:

Comparatively little benefit results from assigning only real values to the variable $z$ that figures in a univariate generating function. In contrast, assigning complex values turns out to have serendipitous consequences.
...
When we do so, a generating function becomes a geometric transformation of the complex plane. This transformation is very regular near the origin—one says that it is analytic (or holomorphic). In other words, near $0$, it only effects a smooth distortion of the complex plane. Farther away from the origin, some cracks start appearing in the picture. These cracks—the dignified name is singularities—correspond to the disappearance of smoothness. It turns out that a function’s singularities provide a wealth of information regarding the function’s coefficients, and especially their asymptotic rate of growth. Adopting  geometric point of view for generating functions has a large pay-off.

I'd like to give two examples which are presented in section IV.1 Generating functions as analytic objects in the book by P. Flajolet and R.  Sedgewick. They consider the ordinary generating function (OGF) $f(z)$ of the Catalan numbers and the exponential generating function (EGF) $g(z)$ of the derangements.
These functions are
\begin{align*}
\color{blue}{f(z)=\frac{1}{2}\left(1-\sqrt{1-4z}\right)\qquad\qquad g(z)=\frac{\exp(-z)}{1-z}}
\end{align*}
At this stage, these generating functions are just compact descriptions of formal power series built from the elementary series
\begin{align*}
&(1-y)^{-1}=1+y+y^2+\cdots,\qquad(1-y)^{1/2}=1-\frac{1}{2}y-\frac{1}{8}y^2-\cdots,\\
&\exp(y)=1+\frac{1}{1!}y+\frac{1}{2!}y^2+\cdots
\end{align*}
by standard composition rules. Accordingly, the coefficients of both GFs are known in explicit form:
\begin{align*}
\color{blue}{
f_n}&\color{blue}{:=[z^n]f(z)=\frac{1}{n}\binom{2n-2}{n-1},}\\
\color{blue}{g_n}&\color{blue}{:=[z^n]g(z)=\frac{1}{0!}-\frac{1}{1!}+\cdots+\frac{(-1)^n}{n!}}
\end{align*}
But, when we change the view and consider $f$ and $g$ as analytic objects, we obtain asymptotic results
\begin{align*}
\color{blue}{f_n\underset{n\to\infty}{\sim}\frac{4^{n-1}}{\sqrt{\pi n^3}},\qquad g_n\underset{n\to\infty}{\sim}\frac{1}{e}}
\end{align*}
Note: The two different views of generating functions are nicely presented in Analytic Combinatorics by P. Flajolet and R. Sedgewick. This book contains a

Part A - Symbolic Methods where generating functions are treated as formal power series and a

Part B - Complex Asymptotics where generating functions are treated as analytic objects.