Starting from the diffraction integration in terms of ray matrix elements, the optical transfer functions have been derived for complicated optical system. They are also represented by the ray matrix elements and have the following generality: All are permitted in the system that there are complex lenslike media with quadratic index and gain(or loss) and Gaussian aperture (or Gaussian mirror) with Gaussian transmissivity (or reflectivity); the observation plane can be located at any plane; the location of aperture can be arbitrary.