A new implicit algorithm to solve the full Navier Stokes equations for two dimensional unsteady incompressible flows that only makes use of the stream function, without the explicit calculation of the vorticity, is presented. The mathematical model discretized in finite differences, according to the ADI method, results in a system of two algebraic equations involving 11 nodes in each equation. By making an original hyphotesis, a reduction to equations with five nodes allows to obtain the numerical solution via the use of a pentadiagonal matrix algorithm PDMA. An iterative cycle has been implemented to verify the quality of the proposed hyphotesis ant to asses its accuracy and speed of convergence. Numerical results are presented for two classical fluid mechanics problems: induced laminar flow in a square cavity with Re = 100, 400, 1000 and natural convection inside a square cavity for cases where Ra = 1000, 10000 and Pr = 0.1; 1, 10.