TITLE: Finding the generating function for the Catalan number sequence
QUESTION [5 upvotes]: I know that generating function for the Catalan number sequence is $$f(x) = \frac{1 -\sqrt{4x}}{2x}$$ but I wan to prove it.
So the sequence for the Catalan numbers is $$1,1,2,5,14....$$ as we all know.
Now I have to find a generating function that generates this sequence.
I read that we can prove it this way: Asssume that $f(x)$ is the generating function for the Catalan sequence then by the Cauchy product rule it can be shown that $xf(x)^2 = f(x) − 1$
And so this implies that $$xf(x)^2 - f(x) + 1 = 0$$ and so we can get that $$f(x) = \frac{1-\sqrt{4x}}{2x}$$
But I can't get to understand how is that possible ? Like assume that $f(x)$ is the generating function for the Catalan sequence, then how come by the Cauchy product we have that  $xf(x)^2 = f(x) − 1$
I know that if we multiply the sequence $$1,1,2,5,14,....$$
By itself we would get in the resulting sequence $$1,1,5,14,...$$
Because we have that $c_k = a_0b_k + a_1b_{k-1}+ ........ + a_kb_0$ using the cauchy product formula but still how do we have that $xf(x)^2 = f(x) − 1$
and how did we get that 
$$f(x) = \frac{1-\sqrt{4x}}{2x}$$
 from 
$xf(x)^2 = f(x) − 1$ ? did we use the quadratic formula some how ?

REPLY [3 votes]: I'd like to ressurect this old post :)
To motivate the equation for the generating function you may do direct calculations (!) on the set of correct bracket sequences.
Let
$$
S = \square + () + (()) + ()() + ((())) + (())() + ()(()) + \ldots
$$
Multiplication is intuitive, like $() \cdot (()) = ()(())$.
As @Timur vural pointed out: look at the expression that is surrounded by the first bracket ( and its matching pair ).
$$
S = \square + (\square) \cdot \square + (())\cdot \square + (\square) \cdot () + ((()))\cdot \square + (())\cdot () + ()\cdot (()) + \ldots
$$
And now let the magic happen!
$$
S = \square + (\cdot S \cdot ) \cdot S
$$
Replace the pair of brackets with $x$ and $S$ with $f(x)$ and get the equation you want:
$$
f(x) = 1 + x\cdot f(x)\cdot f(x)
$$