One of the very interesting demographic features in the US over the last several decades is the persistent racial educational gap between blacks and whites and the reverse gender education gap as a result of the rapid rise in women's educational attainment. This dissertation is to investigate the reasons behind it. I first investigated the educational gap between blacks and whites. I propose a new model to identify if and how much the educational attainment gap between blacks and whites is due to the difference in their neighborhoods. In this model, individuals belong to two unobserved types: the endogenous type who may move in response to the neighborhood effect on their education; or the exogenous type who may move for reasons unrelated to education. The Heckman sample selection model becomes a special case of the current model in which the probability of one type of individuals is zero. Although I cannot find any significant neighborhood effect in the usual Heckman sample selection model, I do find heterogeneous effects in our type-consistent model. In particular, there is a substantial neighborhood effect for the movers who belong to the endogenous type. No significant effects exist for other groups. On average, I find that the neighborhood variable, the percentage of high school graduates in the neighborhood, accounts for about 37.7% of the education gap between blacks and whites. This dissertation sheds some insight about women?s educational attainment by studying the motivations of education for women: to pursue higher wages and to find highly educated spouses. The identification strategy is that the college education is exogenous to the partner choice if education is driven by pursuing higher job market return (the type of marry-for-romance), and is endogenous if the education decision is driven by marriage market return (the type of marry-for-money). I find that the marry-for-romance type has higher education than the other type and given everything else the same, with the same education level, the women who marry for money have a higher probability of finding a highly educated husband than those marrying for romance. Therefore, the reversal educational gap could be the result of more marry-for-romance women.