Abstract Special bases of orthogonal polynomials are defined, that are suited to expansions of density and potential perturbations under strict particle number conservation. Particle–hole expansions of the density response to an arbitrary perturbation by an external field can be inverted to generate a mapping between density and potential. Information is obtained for derivatives of the Hohenberg–Kohn functional in density space. A truncation of such an information in subspaces spanned by a few modes is possible. Numerical examples illustrate these algorithms.