The generalized expression of Fermat’s principle is introduced through defining generalized refractive index on the basis of the comparison of the definition between left handed materials(LHMs) and right handed materials(RHMs). The concrete expression of generalized refractive index is derived from electromagnetic theory. The refractive index represents positive or negative refraction of the perfect and composite materials by medium electrical parameters, and the theory obtained can be used to depict the steady electromagnetic or optical system effectively with variable refractive index consisting of LHMs and RHMs. The high frequency forms of refractive index and negative refractions are discussed.