We have calculated the parameters for an optimal matching layer between a waveguide and a laterally coupled photodetector for TE and TM modes. We find a difference on the order of a few percent between the classical and exact calculations based on optical modes concerning the optimal matching layer thickness. Also, the thickness of the matching layer depends critically on the thickness of the absorbing layer. Comparing TE and TM modes, the absorption maxima for TE(TM) and the minima for TM(TE) coincide approximately, and the maxima and minima depend on the matching layer thickness.