Geodesics for FRW metric using variational principle I am trying to find geodesics for the FRW metric,
$$
d\tau^2 = dt^2 - a(t)^2 \left(d\mathbf{x}^2 + K \frac{(\mathbf{x}\cdot d\mathbf{x})^2}{1-K\mathbf{x}^2} \right),
$$
where $\mathbf{x}$ is 3-dimensional and $K=0$, $+1$, or $-1$.
Geodesic equation
Using the Christoffel symbols From Weinberg's Cosmology (Eqs. 1.1.17 - 20) in the geodesic equation I get:
\begin{align}
0 &= \frac{d^2 t}{d\lambda^2} + a\dot{a} \left[ \left( \frac{d\mathbf{x}}{d\lambda} \right)^2 +\frac{K(\mathbf{x}\cdot \frac{d\mathbf{x}}{d\lambda})^2}{1-K \mathbf{x}^2}\right], &\text{($t$ equation)}\\ 
0 &= \frac{d^2\mathbf{x}}{d\lambda^2} + 2 \frac{\dot{a}}{a}\frac{dt}{d\lambda}\frac{d\mathbf{x}}{d\lambda} + \left[ \left(\frac{d\mathbf{x}}{d\lambda}\right)^2 + \frac{K(\mathbf{x} \cdot \frac{d\mathbf{x}}{d\lambda})^2}{1-K\mathbf{x}^2} \right]K\mathbf{x}, &\text{($\mathbf{x}$ equation)}
\end{align}
where $\lambda$ is the affine parameter, and $\dot{a}=da/dt$.
Variational principle
It should also be possible to get the geodesics by finding the paths that extremize the proper time $d\tau$, i.e. using the Euler-Lagrange equations with a Lagrangian equal to the square root of the $d\tau^2$ I wrote above:
$$
L = \frac{d\tau}{dp}= \sqrt{ t'^2 - a(t)^2 \left(\mathbf{x}'^2 + K \frac{(\mathbf{x}\cdot \mathbf{x}')^2}{1-K\mathbf{x}^2} \right) },
$$
where a prime is the derivative with respect to the variable $p$ that parameterizes the path.
When I try this $L$ in the E-L equation for $t$ I get the same equation as above. However, when I try the E-L equation for $\mathbf{x}$ my result does not agree with the geodesic equation.
I find
$$
\frac{\partial L}{\partial \mathbf{x}} = -\frac{1}{L} \frac{a^2 K (\mathbf{x} \cdot \mathbf{x}')}{1-K\mathbf{x}^2} \left(\mathbf{x}' + \frac{K(\mathbf{x} \cdot \mathbf{x}')\mathbf{x}}{1-K\mathbf{x}^2}\right),
$$
and
$$
\frac{\partial L}{\partial \mathbf{x}'} = -\frac{a^2}{L} \left(\mathbf{x}' + \frac{K(\mathbf{x} \cdot \mathbf{x}')\mathbf{x}}{1-K\mathbf{x}^2}\right).
$$
I write the E-L equation $$\frac{d}{dp}\frac{\partial L}{\partial \mathbf{x}'}=\frac{\partial L}{\partial \mathbf{x}},$$ and then multiply both sides by $dp/d\tau$ to replace $p$ with $\tau$ everywhere and get rid of the $L$'s in the denominators (using the fact that $1/L=dp/d\tau$ and changing the meaning of the primes to mean derivatives with respect to proper time $\tau$).
I get
$$
\frac{d}{d\tau} \left[ a^2\left(\mathbf{x}' + \frac{K(\mathbf{x} \cdot \mathbf{x}')\mathbf{x}}{1-K\mathbf{x}^2}\right) \right] = \frac{K (\mathbf{x} \cdot \mathbf{x}')}{1-K\mathbf{x}^2} a^2 \left(\mathbf{x}' + \frac{K(\mathbf{x} \cdot \mathbf{x}')\mathbf{x}}{1-K\mathbf{x}^2}\right).
$$
I cannot rearrange this into the formula from the geodesic equation and suspect that the two sets of equations are not equivalent. I've gone through both methods a couple of times but haven't spotted any errors.
Can anyone tell me where the inconsistency (if there actually is one) is coming from?
[Interestingly, the E-L equation can be integrated once with an integrating factor of $\sqrt{1-K\mathbf{x}^2}$, whereas I don't see how to do so with the geodesic equation (not that I am very good at solving differential equations).]
 A: I don't think that your geodetic equations are correct?
This is your metric:
$$G=
\left[ \begin {array}{cccc} 1&0&0&0\\ 0&- \left( a
 \left( t \right)  \right) ^{2} \left( 1+{\frac {K{x}^{2}}{1-K \left( 
{x}^{2}+{y}^{2}+{z}^{2} \right) }} \right) &-{\frac { \left( a \left( 
t \right)  \right) ^{2}Kyx}{1-K \left( {x}^{2}+{y}^{2}+{z}^{2}
 \right) }}&-{\frac { \left( a \left( t \right)  \right) ^{2}Kzx}{1-K
 \left( {x}^{2}+{y}^{2}+{z}^{2} \right) }}\\ 0&-{
\frac { \left( a \left( t \right)  \right) ^{2}Kyx}{1-K \left( {x}^{2}
+{y}^{2}+{z}^{2} \right) }}&- \left( a \left( t \right)  \right) ^{2}
 \left( 1+{\frac {K{y}^{2}}{1-K \left( {x}^{2}+{y}^{2}+{z}^{2}
 \right) }} \right) &-{\frac { \left( a \left( t \right)  \right) ^{2}
Kzy}{1-K \left( {x}^{2}+{y}^{2}+{z}^{2} \right) }}
\\ 0&-{\frac { \left( a \left( t \right)  \right) ^{
2}Kzx}{1-K \left( {x}^{2}+{y}^{2}+{z}^{2} \right) }}&-{\frac { \left( 
a \left( t \right)  \right) ^{2}Kzy}{1-K \left( {x}^{2}+{y}^{2}+{z}^{2
} \right) }}&- \left( a \left( t \right)  \right) ^{2} \left( 1+{
\frac {K{z}^{2}}{1-K \left( {x}^{2}+{y}^{2}+{z}^{2} \right) }}
 \right) \end {array} \right] 
$$
and my program calculate this geodetic
$$
{\frac {d^{2}}{d{\lambda}^{2}}}t \left( \lambda \right) +{\frac {a
 \left( t \right)  \left( -1+K{y}^{2}+K{z}^{2} \right)  \left( {\frac 
{d}{dt}}a \left( t \right)  \right)  \left( {\frac {d}{d\lambda}}x
 \left( \lambda \right)  \right) ^{2}}{-1+K{x}^{2}+K{y}^{2}+K{z}^{2}}}
-2\,{\frac {a \left( t \right) Kyx \left( {\frac {d}{dt}}a \left( t
 \right)  \right)  \left( {\frac {d}{d\lambda}}x \left( \lambda
 \right)  \right) {\frac {d}{d\lambda}}y \left( \lambda \right) }{-1+K
{x}^{2}+K{y}^{2}+K{z}^{2}}}+{\frac {a \left( t \right)  \left( -1+K{x}
^{2}+K{z}^{2} \right)  \left( {\frac {d}{dt}}a \left( t \right) 
 \right)  \left( {\frac {d}{d\lambda}}y \left( \lambda \right) 
 \right) ^{2}}{-1+K{x}^{2}+K{y}^{2}+K{z}^{2}}}+{\frac {a \left( t
 \right)  \left( -1+K{x}^{2}+K{y}^{2} \right)  \left( {\frac {d}{dt}}a
 \left( t \right)  \right)  \left( {\frac {d}{d\lambda}}z \left( 
\lambda \right)  \right) ^{2}}{-1+K{x}^{2}+K{y}^{2}+K{z}^{2}}}=0$$
and so on.
2) If you want to calculate the geodetic with E.L. methode
you can also use this lagrangian 
$L=\frac{1}{2}\left(g_{\mu\nu}\,\frac{dx^\mu}{d\tau}\frac{dx^\nu}{d\tau}\right)$
A: I think the equations may be consistent after all. First a solution to the EL equation for $\mathbf{x}$ also satisfies the geodesic equation:
Starting with the EL equation I have above:
$$
\frac{d}{d\tau} \left[ a^2\left(\mathbf{x}' + \frac{K(\mathbf{x} \cdot \mathbf{x}')\mathbf{x}}{1-K\mathbf{x}^2}\right) \right] = \frac{K (\mathbf{x} \cdot \mathbf{x}')}{1-K\mathbf{x}^2} a^2 \left(\mathbf{x}' + \frac{K(\mathbf{x} \cdot \mathbf{x}')\mathbf{x}}{1-K\mathbf{x}^2}\right),
$$
define $\mathbf{f}$ as
$$ \mathbf{f} \equiv a^2\left(\mathbf{x}' + \frac{K(\mathbf{x} \cdot \mathbf{x}')\mathbf{x}}{1-K\mathbf{x}^2}\right),$$
so the EL equation is
$$
\frac{d\mathbf{f}}{d\tau} - \frac{K (\mathbf{x} \cdot \mathbf{x}')}{1-K\mathbf{x}^2} \mathbf{f}=\mathbf{0}.
$$
Note that 
\begin{align}
\mathbf{f} \cdot \mathbf{x} &= a^2\left(\mathbf{x} \cdot \mathbf{x}' + \frac{K(\mathbf{x} \cdot \mathbf{x}')\mathbf{x}^2}{1-K\mathbf{x}^2}\right) \\
&= a^2 (\mathbf{x} \cdot \mathbf{x}') \left(1 + \frac{K\mathbf{x}^2}{1-K\mathbf{x}^2}\right) \\
&= \frac{a^2 (\mathbf{x} \cdot \mathbf{x}')}{1-K\mathbf{x}^2},
\end{align}
and
$$
\mathbf{f} \cdot \mathbf{x}' = a^2\left(\mathbf{x}'^2 + \frac{K(\mathbf{x} \cdot \mathbf{x}')^2}{1-K\mathbf{x}^2}\right) \equiv Q,
$$
($Q$ appears in the geodesic equation for $\mathbf{x}$).
Next dot the EL equation with $\mathbf{x}$:
\begin{align}
0 &= \frac{d\mathbf{f}}{d\tau} \cdot \mathbf{x} - \frac{K (\mathbf{x} \cdot \mathbf{x}')}{1-K\mathbf{x}^2} \mathbf{f}\cdot \mathbf{x} \\
&=\frac{d}{d\tau}\left(\mathbf{f} \cdot \mathbf{x}\right) - \mathbf{f} \cdot \mathbf{x}' - a^2 \frac{K (\mathbf{x} \cdot \mathbf{x}')^2}{(1-K\mathbf{x}^2)^2},
\end{align}
so
$$
\frac{d}{d\tau}\left(\mathbf{f} \cdot \mathbf{x}\right) = 
Q +a^2 \frac{K (\mathbf{x} \cdot \mathbf{x}')^2}{(1-K\mathbf{x}^2)^2}.
$$
Now go back to the original EL equation (first equation) and apply the $d/d\tau$ inside the brackets:
$$
\text{EL LHS} = \frac{d}{d\tau}\left(a^2 \mathbf{x}'\right) + \left[\frac{d}{d\tau}\left( a^2 \frac{K (\mathbf{x} \cdot \mathbf{x}')}{1-K\mathbf{x}^2}\right)\right]\mathbf{x} + a^2 \frac{K (\mathbf{x} \cdot \mathbf{x}')}{1-K\mathbf{x}^2}\mathbf{x}'.
$$
The last term above cancels with the first term on the right hand side of the EL equation.
Moving everything that's left to one side you get
\begin{align}
\mathbf{0} &= \frac{d}{d\tau}\left(a^2 \mathbf{x}'\right) +
\left[\frac{d}{d\tau}\left( a^2 \frac{K (\mathbf{x} \cdot \mathbf{x}')}{1-K\mathbf{x}^2}\right)\right]\mathbf{x}
- \frac{a^2 K^2(\mathbf{x} \cdot \mathbf{x}')^2\mathbf{x}}{(1-K\mathbf{x}^2)^2} \\
&= \frac{d}{d\tau}\left(a^2 \mathbf{x}'\right) +
\left[\frac{d}{d\tau}\left( a^2 \frac{(\mathbf{x} \cdot \mathbf{x}')}{1-K\mathbf{x}^2}\right)
- \frac{a^2 K(\mathbf{x} \cdot \mathbf{x}')^2}{(1-K\mathbf{x}^2)^2}\right]K\mathbf{x}\\
&= \frac{d}{d\tau}\left(a^2 \mathbf{x}'\right) +
\left[\frac{d}{d\tau}\left( \mathbf{f} \cdot \mathbf{x}\right)
- \frac{a^2 K(\mathbf{x} \cdot \mathbf{x}')^2}{(1-K\mathbf{x}^2)^2}\right]K\mathbf{x} \\
&= \frac{d}{d\tau}\left(a^2 \mathbf{x}'\right) + Q K\mathbf{x},
\end{align}
which, after dividing both sides by $a^2$, is exactly the geodesic equation from my original question.
If you want to start with a solution to the geodesic equation and show it satisfies the EL equation you can almost reverse the steps. The only new thing you need to show is the reverse of the very last step, that the geodesic equation implies
$$
Q = \frac{d}{d\tau}\left(\mathbf{f} \cdot\mathbf{x}\right) - \frac{a^2 K(\mathbf{x} \cdot \mathbf{x}')^2}{(1-K\mathbf{x}^2)^2}.
$$
You start by dotting the geodesic equation with $\mathbf{x}$, and then start rearranging (using the definitions of $\mathbf{f}$ and $Q$ at some point).
