  In biological and synthetic materials, many important processes involve
charges that are present in a medium with spatially varying dielectric
permittivity. To accurately understand the role of electrostatic interactions
in such systems, it is important to take into account the spatial dependence of
the permittivity of the medium. However, due to the ensuing theoretical and
computational challenges, this inhomogeneous dielectric response of the medium
is often ignored or excessively simplified. We develop a variational
formulation of electrostatics to accurately investigate systems that exhibit
this inhomogeneous dielectric response. Our formulation is based on a true
energy functional of the polarization charge density. The defining
characteristic of a true energy functional is that at its minimum it evaluates
to the actual value of the energy; this is a feature not found in many commonly
used electrostatic functionals. We explore in detail the charged systems that
exhibit sharp discontinuous change in dielectric permittivity, and we show that
for this case our functional reduces to a functional of only the surface
polarization charge density. We apply this reduced functional to study model
problems for which analytical solutions are well known. We demonstrate, in
addition, that the functional has many properties that make it ideal for use in
molecular dynamics simulations.
