In general relativity the light is assumed to propagate in the vacuum along null geodesic in a pseudo-Riemannian manifold. Besides the geodesics principle in a classical field theory there exists the Fermat's principle for stationary gravity fields.
Contents
Fermat's principle
In more general case for conformally stationary spacetime  with coordinates                     
                    
where conformal factor                     
Fermat's principle for a pseudo-Riemannian manifold states that the light ray path between points                     
                    
where                     
Principle of stationary integral of energy
In principle of stationary integral of energy for a light-like particle's motion, the pseudo-Riemannian metric with coefficients                     
                    
With time coordinate                     
                    
where                     
                    
where                     
With                     
                    
In both cases for the free moving particle the lagrangian is
                    
Its partial derivatives give the canonical momenta
                    
and the forces
                    
Momenta satisfy energy condition for closed system
                    
Standard variational procedure is applied to action
                    
which is integral of energy. Stationary action is conditional upon zero variational derivatives δS/δxλ and leads to Euler–Lagrange equations
                              
which is rewritten in form
                              
After substitution of canonical momentum and forces they give motion equations of lightlike particle in a free space
                              
and
                    
Static spacetime
For the static spacetime the first equation of motion with appropriate parameter                     
                    
For the isotropic paths a transformation to metric                     
                    
Substitution of them in Euler–Lagrange equations gives
                              
This expression after some calculation becomes null geodesic equations
                              
where                     
So in case of the static spacetime the geodesic principle and the energy variational method as well as Fermat's principle give the same solution for the light propagation.
