  In this paper we present a rigorous derivation of the luminosity function
(LF) in presence of a background. Our approach is free from the logical
contradictions of assigning negative values to positively defined quantities
and avoid the use of incorrect estimates for the 68 % confidence interval
(error bar). It accounts for Poisson fluctuations ignored in previous
approaches and does not requires binning of the data. The method is extensible
to more complex situations, does not require the existence of an
environment--independent LF, and clarifies issues common to field LF
derivations. We apply the method to two clusters of galaxies at intermediate
redshift (z~0.3) with among the deepest and widest K_s observations ever taken.
Finally, we point out short-comings of flip--flopping magnitudes.
