  A rigorous method of calculating the electromagnetic field, the scattering
matrix, and scattering cross-sections of an arbitrary finite three-dimensional
optical system described by its permittivity distribution is presented. The
method is based on the expansion of the Green's function into the resonant
states of the system. These can be calculated by any means, including the
popular finite element and finite-difference time-domain methods. However,
using the resonant-state expansion with a spherically-symmetric analytical
basis, such as that of a homogeneous sphere, allows to determine a complete set
of the resonant states of the system within a given frequency range.
Furthermore, it enables to take full advantage of the expansion of the field
outside the system into vector spherical harmonics, resulting in simple
analytic expressions. We verify and illustrate the developed approach on an
example of a dielectric sphere in vacuum, which has an exact analytic solution
known as Mie scattering.
