  Consider the problem of scattering of electromagnetic waves by a doubly
periodic structure. The medium above the structure is assumed to be
inhomogeneous characterized completely by an index of refraction. Below the
structure is a perfect conductor or an imperfect conductor partially coated
with a dielectric. Having established the well-posedness of the direct problem
by the variational approach, we prove the uniqueness of the inverse problem,
that is, the unique determination of the doubly periodic grating with its
physical property and the index of refraction from a knowledge of the scattered
near field by a countably infinite number of incident quasi-periodic
electromagnetic waves. A key ingredient in our proofs is a novel mixed
reciprocity relation derived in this paper.
