  We present the mass function of supermassive black holes (SMBHs) over the
redshift range z=0-2, using the latest deep luminosity and mass functions of
field galaxies to constrain the masses of their spheroids, which we relate to
SMBH mass through the empirical correlation between SMBH and spheroid mass (the
M_bh-M_sph relation). In ddition to luminosity fading of the stellar content of
the spheroids, we carefully consider the variation of the bulge-to-total
luminosity ratio of the galaxy populations and the M_bh/M_sph ratio, which,
according to numerous recent studies, evolves rapidly with redshift. The SMBH
mass functions derived from the galaxy luminosity and mass functions show very
good agreement, both in shape and in normalization. The resultant SMBH mass
function and integrated mass density for the local epoch (z~0) match well those
derived independently by other studies. Consistent with other evidence for
cosmic downsizing, the upper end of the mass function remains roughly constant
since $z\approx2$, while the space density of lower mass black holes undergoes
strong evolution. We carefully assess the impact of various sources of
uncertainties on our calculations. A companion paper uses the mass function
derived in this work to determine the radiative efficiency of black hole
accretion and constraints that can be imposed on the cosmological evolution of
black hole spin.
