A study of defect-mode propagation in lossless layered photonic media has b
een performed. We put forward a new proper characteristic of the defect cav
ity, called the coupling length of the defect, namely, a maximum spatial ra
dius around the defect site, within which the defect mode couples into the
tunnelled incident wave. This coupling length allows us to optimize the val
ues of the Q-factor and the transmission coefficient with respect to both t
he position of the defect and the dielectric permittivity of the defective
layer.