Fast and efficient finite difference scheme in the vertical direction for optical scattering of gratings is presented. A second order central difference with boundary corrections or a pseudo fourth order operator splitting method is used. A stable recursion formula for the impedance matrix can be obtained. Matrix diagonalizations can be used for rectangular grating profiles when many discretization points are required. The recurrence relation is equivalent to a UL decomposition of block tridiagonal matrix. It is numerically stable compared to existing finite difference methods for gratings and many times faster than the popular rigorous coupled wave analysis method.