The frequency-dependent exchange-correlation potential, which appears in the usual Kohn-Sham formulation of a time-dependent linear response problem, is a strongly nonlocal functional of the density, so that a consistent local density approximation generally does not exist. This problem can be avoided by choosing the current density as the basic variable in a generalized Kohn-Sham theory. This theory admits a local approximation which, for fixed frequency, is exact in the limit of slowly varying densities and perturbing potentials. [S0031-9007(96) PACS numbers: 71.45. Gm, 73.20.Dx, 73.20.Mf, 78.30.Fs The time-dependent density functional theory (TDFT) of Runge and Gross [1] potentially holds great promise as a tool for studying the dynamics of many-particle systems, as well as for the computation of excitation energies which are not accessible within the ordinary static density functional theory. At sufficiently low frequencies applications of the so-called adiabatic local density approximation (ALDA) [2] have given very useful results. Progress in the application of this theory to higher frequency phenomena has been hindered by inconsistencies in the local density approximation for the frequency dependent exchange-correlation (xc) potential [3,4]. This paper presents a resolution of these difficulties, by providing the correct form of the frequency dependent xc potential in the regime of linear response and slowly varying densities and perturbing potentials.Our objective is the determination of the linear density response n 1 ͑ r, v͒e 2ivt of a system of interacting electrons in their ground state to a time-dependent potential y 1 ͑ r, v͒e 2ivt . In TDFT the problem is reduced to a set of self-consistent single particle equations, analogous to the Kohn-Sham equations for time-independent systems [5], with an effective potential of the formthe xc potential y 1xc ͑ r, v͒ is linear in n 1 ͑ r, v͒,and the kernel f xc ͑ r, r 0 ; v͒ is a functional of the unperturbed ground state density n 0 ͑ r͒.In the spirit of the local density approximation Gross and Kohn (GK) [3] considered the case where both n 0 and n 1 are sufficiently slowly varying functions of r. As f xc is of short range for a homogeneous system, they proposed the following plausible approximation for systems of slowly varying n 0 ͑ r͒:The superscript h refers to a homogeneous electron gas and the function f h xc is a property of the homogeneous electron gas [3,6].However, it was noted later by Dobson [4] that the approximation (3), when applied to an electron gas in a static harmonic potential 1 2 kr 2 and subjected to a uniform electric field, y 1 ͑ r, v͒ 2 E ? re 2ivt , violates the so-called harmonic potential theorem (HPT), related to the generalized Kohn's theorem [7], according to which the density follows rigidly the classical motion of the center of mass: n 1 ͑ r, v͒ =n 0 ͑ r͒ ? R CM ͑v͒. This raised serious questions about the validity of the approximation (3). Dobson observed that one could satisfy the HPT by requiring that the GK approxim...