The Kohn-Sham equations are derived from the diagrammatic structure of many-body perturbation theory for the exact exchange-correlation energy,
Exc, without explicit recourse to a minimum or extremal principle, thus providing new support for this implementation of density-functional theory in a most common situation. Furthermore, it is shown that for a large class of approximate expressions for
Exc, there exist approximate Kohn-Sham equations which give the same density and energy as other means of calculation within the same diagrammatic approximation.
A diagrammatic expansion for the dynamic exchange-correlation kernel
fxc of time-dependent density functional theory is formulated. It is shown that
fxc has no singularities at Kohn-Sham transition energies in every order of the perturbation theory. However, it may diverge with the system size in extended systems. This signifies that any approximate perturbative substitute for
fxc requires a consistent perturbative treatment of the response function to avoid uncontrollable errors in the many-body corrections to excitations energies.