This paper presents a systematic treatment of the linear theory of scalar gravitational perturbations in the synchronous gauge and the conformal Newtonian ( or longitudinal ) gauge . It differs from others in the literature in that we give , in both gauges , a complete discussion of all particle species that are relevant to any flat cold dark matter ( CDM ) , hot dark matter ( HDM ) , or CDM+HDM models ( including a possible cosmological constant ) . The particles considered include CDM , baryons , photons , massless neutrinos , and massive neutrinos ( an HDM candidate ) , where the CDM and baryons are treated as fluids while a detailed phase-space description is given to the photons and neutrinos . Particular care is applied to the massive neutrino component , which has been either ignored or approximated crudely in previous works . Isentropic initial conditions on super-horizon scales are derived . The coupled , linearized Boltzmann , Einstein and fluid equations that govern the evolution of the metric and density perturbations are then solved numerically in both gauges for the standard CDM model and two CDM+HDM models with neutrino mass densities \Omega _ { \nu } = 0.2 and 0.3 , assuming a scale-invariant , adiabatic spectrum of primordial fluctuations . We also give the full details of the cosmic microwave background anisotropy , and present the first accurate calculations of the angular power spectra in the two CDM+HDM models including photon polarization , higher neutrino multipole moments , and helium recombination . The numerical programs for both gauges are available at http : //arcturus.mit.edu/cosmics .