  In the works on Statistical Mechanics and Statistical Physics, when deriving
the distribution of particles of ideal gases, one uses the method of Lagrange
multipliers in a formal way. In this paper we treat rigorously this problem for
Bose--Einstein, Fermi--Dirac and Maxwell--Boltzmann entropies and present a
complete study in the case of the Maxwell--Boltzmann entropy. Our approach is
based on recent results on series of convex functions.
