We consider three dimensional lossless periodic dielectric (photonic c
rystals) and acoustic media having a gap in the spectrum. If such a pe
riodic medium is perturbed by a strong enough defect, defect eigenmode
s arise, localized exponentially around the defect, with the correspon
ding eigenvalues in the gap. We use a modified Birman-Schwinger method
to derive equations for these eigenmodes and corresponding eigenvalue
s in the gap, in terms of the spectral attributes of an auxiliary Hilb
ert-Schmidt operator. We prove that in three dimensions, under some na
tural conditions on the periodic background, the number of eigenvalues
generated in a gap of the periodic operator is finite, and give an es
timate on the number of these midgap eigenvalues. In particular, we sh
ow that if the defect is weak there are no midgap eigenvalues.