Draw the angle bisector $AD$ of $\angle BAC$. Then $\triangle CAB\sim \triangle ABD$.

Assume $AB=1, AC=x$, then $AD=CD=1$, $AC:AB=AB:BD$, $BD=\frac1x$, $x=1+\frac1x$, so $x=\frac{1+\sqrt5}2$.Notice $AC:AB=\sin 72^\circ:\sin 36^\circ=2\cos 36^\circ$, hence $\cos 36^\circ=\frac{1+\sqrt5}4$.