Wave scattering from a dielectric medium or a perfect conductor with a periodic rough surface is studied. Our theoretical method is based on the extended boundary condition which is derived from Green's theorem. In this formulation, the amplitudes of the diffracted Floquet waves can be related directly to the amplitudes of the incident plane waves by a transition matrix. This matrix has a simple form which is suitable for calculations, and it saves computational time over other numerical methods. The accuracy of the calculations can be checked by (1) power conservation, and (2) the reciprocity theorem. Numerical results are given, and the influence of the rough surface as compared with the flat interface case will be shown.