  We consider variation of energy of the light-like particle in the
pseudo-Riemann space-time, find Lagrangian, canonical momenta and forces.
Equations of the critical curve are obtained by the nonzero energy integral
variation in accordance with principles of the calculus of variations in
mechanics. This method is compared with the Fermat's and geodesics principles.
Equations for energy and momentum of the particle transferred to the gravity
field are defined. Equations of the critical curve are solved for the metrics
of Schwarzschild, FLRW model for the flat space and Goedel. The gravitation
mass of the photon is found in central gravity field in the Newtonian limit.
