Inversion of lambda-matrices and application to the theory of linear vibrations