Ricci tensor as relativistic Hamiltonian I am little bit dissapointment with action integral in General relativity. The action integral is:
$$
\int Rd^{4}x=\int R_{ij}g^{ij}d^{4}x\tag{1}
$$
Where
$$
R_{ij}=\frac{\partial\Gamma^{l}_{ij}}{\partial x^{l}}-\frac{\partial\Gamma^{l}_{li}}{\partial x^{j}}+\Gamma^{l}_{ij}\Gamma^{m}_{lm}-\Gamma^{l}_{im}\Gamma^{m}_{lj}\tag{2}
$$
Is the Ricci tensor. The Ricci tensor is in General relativity connected with hamiltonian, and quantity 
$$
R=R_{ij}g^{ij}\tag{3}
$$
is the scalar curvature, which is an invariant quantity, and also total energy of the system. I can't understand, how can I see in Ricci tensor Hamiltonian function.
In every book from General relativity I found something like this:
Action principle...
Lets have an action:
$$
\int\sqrt{-g} R d^4 x=\int\sqrt{-g} R_{ik}g^{ij} d^4 x
$$
Where R is the scalar curvature...aaaand, when we do some variation gymnastics like:
$$
\delta \sqrt{-g}=-\frac{1}{2}\sqrt{-g}g_{ik}\delta g^{ik}
$$
$$
\delta R=R_{ik}\delta g^{ik}
$$
and wait when smoke clears, we hopefully arrive to vacuum Einstein field equations:
$$
R_{ik}-\frac{1}{2}Rg_{ik}=0
$$
and
$$
R_{ik}-\frac{1}{2}Rg_{ik}=\frac{8\pi G}{c^{4}}T_{ik}
$$
in the presence of matter. And now we can go further...:)
This is written in every book. But question is: Ok...we arrive to Einstein equations through variation of R. But, why we do variation of R and not some other quantity?
I found this identity:
$$
R_{ik}=\kappa(T_{ik}-\frac{1}{2}Tg_{ik})
$$
But I can't prove it yet. And its the same, where I started
 A: It seems like you've got lost in the subject. To clarify some facts:


*

*The action for General Relativity (Einstein-Hilbert action) is, as usual, an integral of the Lagrangian density over spacetime:
$$ S[g] = \frac{1}{16 \pi G} \int d^4 x \sqrt{-g} \cdot R, $$
where $\sqrt{-g}$ is the square root of the determinant of the metric tensor and $R$ is the Ricci scalar curvature of the metric.
Why is it so? Because it is a postulate.  You can't derive this action from any kind of a fundamental principle (like the equivalence principle). Different actions could also exist. But Einstein-Hilbert action is the simplest of the kind, and therefore gives rise to the simplest geometrical theory of gravity: General Relativity.

*The square root of the determinant of the metric tensor $\sqrt{-g}$ is there for a reason: it gives a natural volume element of the Riemannian geometry:
$$ d\:\text{Volume} = d^4 x \sqrt{-g} $$
is the invariant spacetime 4-volume element. The square root provides the invariance of the Einstein-Hilbert action under diffeomorphisms (General Coordinate Transformations, GCTs) and therefore the mathematical manifestation of the general principle of relativity.

*You have found this identity
$$ R_{\mu \nu} = \frac{8 \pi G}{c^4} \left( T_{\mu \nu}  - \frac{1}{2} T g_{\mu \nu} \right) $$
and are currently unsure of how it arises in the theory. Actually, this is not an identity but rather a dynamical equation of motion, which is completely equivalent to Einstein's equations. In fact, one could easily derive one from the other. We start from Einstein's equations:
$$ R_{\mu \nu} - \frac{1}{2} R g_{\mu \nu} = \frac{8 \pi G}{c^4} T_{\mu \nu} $$
Lets take the trace of this equation (contract it with the contravariant metric):
$$ R - \frac{1}{2} R n = \frac{8 \pi G}{c^4} T_{\mu \nu} g^{\mu \nu} $$
$$ \left( 1 - \frac{1}{2} n \right) R = \frac{8 \pi G}{c^4} T $$
where $n$ is the dimensionality of spacetime ($n = 4$). Now I substitute the expression for $R$ in the original equation:
$$ R_{\mu \nu} - \frac{8 \pi G}{c^4} \cdot \frac{T g_{\mu \nu}}{(2-n)} = \frac{8 \pi G}{c^4} T_{\mu \nu} $$
$$ R_{\mu \nu} = \frac{8 \pi G}{c^4} \left( T_{\mu \nu} - \frac{1}{n-2} T g_{\mu \nu} \right) $$
For $n = 4$ it reduces to
$$ R_{\mu \nu} = \frac{8 \pi G}{c^4} \left( T_{\mu \nu}  - \frac{1}{2} T g_{\mu \nu} \right) $$
which means that your equation is completely equivalent to Einstein's equation.

*There is a way to construct the Hamiltonian formalism of General Relativity. Take a look at ADM formalism. However my guess would be that you don't need that, and when you were speaking about Hamilton, you were referring to Hamilton's principle which is just a fancy name for the principle of the least action. The principle of the least action lies at the heart of the Lagrangian formalism.
