A rigorous, truly two-dimensional method for threshold analysis of distributed feedback (DFB) lasers based on a coupled wave transfer matrix formalism is presented. The method makes it possible to systematically study the effect of the various structural and material properties parameters of the laser on the threshold gain and lasing frequency. Since the optical fields inside and outside the laser are very accurately represented in our analysis, the small differences in gain of pairs of longitudinal laser modes symmetrically located on both sides of the gap can be more accurately calculated than in any previous work. The analysis is applicable to gratings of any shape for both the TE and TM modes, but numerical results are given only for first-order gratings with rectangular and triangular tooth-shape. Reflectivities of the laser end facets have been calculated from first principles in some typical cases rather than treated as given parameters.