The overall X-ray luminosity of a galaxy (except for a giant elliptical) is usually dominated by HMXBs and/or LMXBs. The luminosity functions of HMXBs and LMXBs are linearly scaled with the star formation rate and the stellar mass of a galaxy and are universal to an accuracy better than ~ 50% and 30%, respectively [1, 2]. The differential power law slope of the function for HMXBs is 1.6 over a broad range of log(Lx) ~ 35.5 - 40.5, where Lx is the luminosity in the 0.5-2 keV band. Particularly interesting are a large number of non-AGN (hyper)ultraluminous X-ray sources with log(Lx) in the range of ~ 39.5 - 41.5 and observed typically in active star forming galaxies, suggesting the presence of either so-called intermediate-mass black holes (10 MBH 105) or sources apparently radiating well above the Eddington limit. The luminosity function shape for LMXBs is a bit more complicated, having a slope of 1 at log(Lx) 37.5, steepening gradually at higher luminosities and cutting off abruptly at log(Lx) ~ 39.0-39.5. Furthermore, the frequency of LMXBs per stellar mass is substantially higher in globular clusters than in galaxy field (e.g., ). This is attributed to the formation of LMXBs via close stellar encounters, which has also been proposed to account for an enhanced number of LMXBs in the dense inner bulge of M 31 . But it is not yet clear as to what fraction of field LMXBs was formed dynamically (e.g., [5, 6]).
For the study of diffuse hot gas, it is important to minimize the confusion from point-like source contributions. A source detection limit at least down to log(Lx) ~ 37 is highly desirable, which can be achieved with a Chandra observation of a reasonably deep exposure for nearby galaxies (D 20 Mpc). The residual contribution from fainter HMXBs and LMXBs can then be estimated from their correlation with the star formation rate and stellar mass and subtracted from the data with little uncertainty. However, one still needs to be careful with Poisson fluctuations of sources just below the detection limit. Such fluctuations may significantly affect the reliability of X-ray morphological analysis of a galaxy.
In addition to the subtraction of relatively bright X-ray binaries, one also needs to account for a significant (even dominant) stellar contribution from cataclysmic variables and coronally active stars, which are numerous, though individually faint. Very deep Chandra imaging of a region toward the Galactic bulge  has resolved out more than 80% of the background emission at energies of 6-7 keV, where the observed prominent Fe 6.7-keV line was thought as the evidence for the presence of diffuse hot plasma at T ~ 108 K. This high-energy background emission is now shown to be entirely consistent with this collective stellar contribution in the Galactic bulge/ridge. It should be noted, however, that the resolved fraction is much smaller at lower energies (~ 50% at 4 keV), which may be considered as an indication for the presence of diffuse hot gas at much lower temperatures. The stellar contribution is unresolved for external galaxies, even nearby ones. Fortunately, the average X-ray spectrum and specific luminosity (per stellar mass) of the contribution have been calibrated, based on the Chandra observations of M32, which is too light to hold significant amount of diffuse hot gas), together with the direct detection of stellar X-ray sources in the solar neighborhood . The contribution can be readily included in a spectral analysis of the "diffuse" X-ray emission of a galaxy. In an imaging analysis, one may subtract the contribution scaled according to the stellar mass distribution (e.g., traced by the near-IR K-band intensity of a galaxy).