  Early work extending the Kohn-Sham theory to excited states utilized an
ensemble average of the Hamiltonian considered as a functional of the
corresponding average density. We propose and develop an alternative that
utilizes the matrix elements of the density operator taken between any two
states of the included space. The new theory is also based on a variational
principle for the trace of the Hamiltonian over a selected space of states
viewed, however, as a functional of the associated array of matrix elements of
the density. It leads to a matrix generalization of Kohn-Sham theory. To
illustrate the formalism, we study a suitably defined weak-coupling limit and
derive from it an eigenvalue equation that has the form of the random phase
approximation. The result can be identified with a similar equation derived
directly from the time-dependent Kohn-Sham equation that has been applied
recently with considerable success to molecular excitations. We prove, within
the defined approximations, that the eigenvalues can be interpreted as true
excitation energies.
