In earlier work, the magnetism of pure metals has been discussed in terms of the total energy E as a functional of the densities p*(r) of electrons with upward and downward spins.In the present paper, the problem of local moment formation when a magnetic impurity such as Fe or Co is added to a non-magnetic metallic matrix such as Cu or A1 is considered. It is shown that at the heart of the theory is a one-body spin-dependent potential V,(r) which can be divided into four parts Vn(r) = p(r) + V(r) + Vc(r) + "V,(r). Here is the potential generating the bands of the matrix metal, with dispersion relation c(k) and Wannier function w(r). V(r) generates the impurity state, with energy cd and wave function + d , while Vc(r) denotes the coupling between this d-state and the bands. Finally, and most importantly, y,(r) represents the effects of electron correlations on the impurity site.Using this one-body potential, the density p,(r) can be calculated, in principle exactly, by summing the squares of the occupied orbitals of the potential V,(r). This spin density has three components. The first involves the square of the Wannier function w, with weight determined by parameters nu . The second involves the product of+d and w, with weight mu while the third comes from +$ , with weight 1,. The total energy E[p+ , p-] becomes a function of 1, , mu and nu . I t is shown that the Hartree-Fock solution of Anderson is readily regained solely from the dependence of the energy on 1,.The present work shows how the dependence of the total energy on m and n can be formally incorporated into the theory. The main effects can be described by changes in the self-energy in the Anderson solution, this becoming now spin-dependent. If, eventually, spin and charge densities could be measured around impurities having local moments, it is pointed out that the one-body potentials V,(r) could be obtained. Matrix elements of the one-body potential with respect to +d and w(r) then give direct information on electron correlation. A brief discussion of the relation of the present approach to the calculation of Schrieffer and coworkers of the many-body partition function is given.