The problem of transient growth in compressible boundary layers is considered within the scope of partial differential equations. As follows from previous investigations, the optimal disturbances correspond to steady counter-rotating streamwise vortices. The corresponding scaling of the perturbations leads to the governing equations for a Görtler type of instability, with the Görtler number equal to zero. The iteration procedure employs back and forth marching solutions of the adjoint and original systems of equations. At low Mach numbers, the results agree with those for Blasius boundary-layer flows. In the case of parallel flows, the method leads to the same results obtained for compressible flows within the scope of linearized Navier-Stokes equations. It is shown that there is an optimal spacing of the streamwise vortices and an optimal location for their excitation.