Phonons and related properties are important in a number of fields in physics, chemistry and materials science. Phonon calculations require the dynamical matrix, which is related to the second order derivatives of the ground state total energy with respect to the atomic position, and the phonon frequencies are the eigenvalues of the dynamical matrix. In Kohn-Sham density functional theories, the most straightforward way for computing the dynamical matrix is the frozen phonon approach, which perturbs each atom towards each of the three dimensional directions in real space. Hence even lowest order finite difference approximation requires 3N+1 ground state calculations where N is the number of atoms. This procedure is prohibitively expensive and the cost scales as O(N^4). The complexity is the same when density functional perturbation theory (DFPT) is used, due to a large number of linear to be solved. We develop an efficient numerical method to compress the linearly dependent equations, which allows phonon calculations to be performed via density functional perturbation theory with reduced complexity. (Joint with Ze Xu and Lexing Ying)