Both the Ernst equation and the six Painleve transcendental equations are reductions of the self-dual Yang-Mills (SDYM) equations. We show how this link can be used to find exact solutions to Einstein's equations and to understand aspects of the integrability of the Ernst equation.