In this paper we solve the problem on constructing optimal basis for mode representation of random phase of an optical wave in turbulent atmosphere. We propose an algorithm for obtaining eigenfunctions and eigenvalues of the integral operator with a difference kernel for the case of circular aperture and invariance of the form of eigenfunctions relative to rotation of a coordinate system. We also describe a technique of optimization of the classical Zernike expansion by optimizing coefficients of this expansion based on additional information about spatial correlation of the phase fluctuations.