An Empirical Analysis of the Gender Gap in Mathematics