- In this paper, we exploit orthogonality of modal bases (SIAM J. Sci. Comput. 1999; 20:1671-1695) used in hp finite element models. We calculate entries of coefficient matrix analytically without using any numerical integration, which can be computationally very expensive. We use properties of Jacobi polynomials and recast the entries of the coefficient matrix so that they can be evaluated analytically. We implement this in the context of the least-squares finite element model although this procedure can be used in other finite element formulations. In this paper, we only develop analytical expressions for rectangular elements. Spectral convergence of the L2 least-squares functional is verified using exact solution of Kovasznay flow. Numerical results for transient flow over a backward-facing step are also presented. We also solve steady flow past a circular cylinder and show the reduction in computational cost using expressions developed herein. Copyright 2007 John Wiley & Sons, Ltd.