  A theoretical framework is developed to estimate the optimal binning of X-ray
spectra. We derived expressions for the optimal bin size for model spectra as
well as for observed data using different levels of sophistication. It is shown
that by taking into account both the number of photons in a given spectral
model bin and their average energy over the bin size, the number of model
energy bins and the size of the response matrix can be reduced by a factor of
$10-100$. The response matrix should then contain the response at the bin
centre as well as its derivative with respect to the incoming photon energy. We
provide practical guidelines for how to construct optimal energy grids as well
as how to structure the response matrix. A few examples are presented to
illustrate the present methods.
