a generating function
Suppose you have an entire infinite family of objects — the Legendre polynomials P_0, P_1, P_2, ... — and you would like to package all of them into a single compact formula. A generating function does exactly that: it is one function of two variables whose power-series expansion in one variable has the whole family sitting in its coefficients, like a zip file that unpacks into the entire sequence.
Concretely, a generating function G(x, t) is built so that when you expand it as a power series in t, the coefficient of t^n is the n-th member of your family: G(x, t) = sum from n=0 of P_n(x) t^n. The classic example is the Legendre generating function 1/sqrt(1 - 2 x t + t^2) = sum from n=0 of P_n(x) t^n. Read this both ways. Going forward, expanding the left side in powers of t hands you P_0, P_1, P_2, ... one after another with no other work. Going backward, the closed form on the left is often something physically meaningful — here 1/sqrt(1 - 2 x t + t^2) is exactly the form of an inverse-distance (Coulomb or gravitational) potential, which is why the Legendre polynomials appear in multipole expansions in the first place.
Generating functions are prized because they turn hard facts about the whole sequence into easy algebra on a single function. Differentiating G or multiplying it by t and comparing coefficients yields the recurrence relations and many orthogonality and derivative identities almost for free, replacing tedious induction with one clever manipulation. Nearly every classical special-function family — Legendre, Hermite, Laguerre, Chebyshev, Bessel — has its own signature generating function, and knowing it is often the fastest route to its properties.
From G(x, t) = 1/sqrt(1 - 2 x t + t^2), expand for small t: 1 + (x) t + ((3x^2 - 1)/2) t^2 + ... The coefficients read off P_0 = 1, P_1 = x, P_2 = (3x^2 - 1)/2 — the Legendre polynomials drop out directly, with no need to solve the differential equation again.
Reading off the t-coefficients recovers the whole polynomial family at once — the entire sequence packed into one closed form.
A generating function is a formal bookkeeping device first and a convergent function second; many identities follow from manipulating it as a power series even on intervals where, strictly, you should also check that the series converges.