Subspace projection methods based on the Krylov subspace using powers of a matrix A have often been standard for solving large matrix computations in many areas of application. Recently, projection methods based on the extended Krylov subspace using powers of A and A−1 have attracted attention, particularly for functions of a matrix times a vector and matrix equations. In this article, we propose an efficient algorithm for constructing an orthonormal basis for the extended Krylov subspace. Numerical experiments indicate that this algorithm has less computational cost and approximately the same accuracy as the traditional algorithm.