Problem in deriving Friedman equations from Einstein-Hilbert Lagrangian

The Einstein-Hilbert Lagrangian (along with a scalar field) in FRW spacetime reads: $$$$\mathcal{L} = - \frac{1}{8 \pi G} (3 a \dot{a}^2 - 3 k a + \Lambda a^3) + \frac{1}{2} \dot{\phi}^2 a^3 - \mathcal{V}(\phi) a^3.$$$$

Let's determine the Euler-Lagrange EoM w.r.t. the variable $$a$$. First, the canonical conjugate momentum

$$\frac{\partial \mathcal{L}}{\partial\dot{a}} = -\frac{6 a \dot{a}}{8\pi G}$$

Then the time derivative of the conjugate momentum

$$\frac{{\rm d} }{{\rm d}t} \frac{\partial \mathcal{L}}{\partial\dot{a}} = -\frac{6 \dot{a}^2 + 6 a \ddot{a}}{8\pi G}$$

Thus the EoM reads

$$\frac{{\rm d} }{{\rm d}t} \frac{\partial \mathcal{L}}{\partial\dot{a}} = \frac{\partial\mathcal{L}}{\partial a} \implies -\frac{6 \dot{a}^2 + 6 a \ddot{a}}{8\pi G} = - \frac{-3 k + 3 \Lambda a^2}{8\pi G} + 3 a^2 \left(\frac{1}{2}\dot{\phi}^2 - \mathcal{V}(\phi)\right)$$

Simplifying we get

$$\frac{\ddot{a}}{a} + \frac{\dot{a}^2}{a^2} + \frac{k}{2 a^2} - \frac{\Lambda}{2} = - 4 \pi G \left(\frac{1}{2}\dot{\phi}^2 - \mathcal{V}(\phi)\right)$$

Somehow I am not getting the correct factor in front of the $$H^2$$ term. I believe the correct EoM is

$$$$2 \frac{\ddot{a}}{a} + \frac{\dot{a}^2}{a^2} + \frac{k}{a^2} = \Lambda - 8 \pi G \Big( \frac{1}{2} \, \dot{\phi}^2 - \mathcal{V}(\phi) \Big).$$$$

Can someone point out to me where I am going wrong in the derivation?

• To do a proper derivation of the Friedman equations from the Lagrangian, you also need to include the lapse function $N(t)$. (See the ADM formalism). Essentially everywhere you see a $dt$ you should replace it with $Ndt$, then you vary the action with respect to $N$ and $a$. At the end you can set $N=1$. There is one overall factor of $dt$ in front of the whole Lagrangian coming from $S=\int dt N L$, and then every derivative should come with a factor of $1/N$. Commented Jan 1 at 15:14
• Lapse is needed to derive the first Friedman equation or the Hamiltonian constraint. But for the second Friedman equation for which I am having problem, I think Lapse is practically not important if we choose constant lapse gauge $N=1$ Commented Jan 1 at 15:21

I think you are missing the term $$-\frac{3\dot{a}^2}{8 \pi G}$$ when you compute $$\frac{\partial\mathcal{L}}{\partial a}$$.