Einstein-Hilbert action does not yield the same results as the Einstein field equations for a given metric I am trying to derive the second-order equations of motion for a metric variable using two approaches: the formal vacuum Einstein field equations (with $T_{\mu\nu}=0$)
$$G_{\mu\nu}=R_{\mu\nu}-\frac{1}{2} g_{\mu\nu}R = 0$$
and using the Einstein-Hilbert action
$$S= \frac{1}{16\pi G} \int d^4x \sqrt{-g} R$$
for the following generic metric 
$$ds^2 = -f(r) dt^2 + \frac{1}{f(r)}dr^2 + r^2(d\theta^2 + \sin^2\theta d\phi^2).$$
This metric satisfies the vacuum Einstein equation, so the Einstein field equations (EFEs) should agree with the Euler-Lagrange equations derived using the Einstein-Hilbert (EH) action. However, this is not the case. In particular, using the EFEs, we can derive 2 independent differential equations that the metric function $f(r)$ has to satisfy, and they are
$(\mu\nu) = (tt):  G_{tt}=\frac{f(r)}{r^2}\left(-1 + f(r) + r f'(r)\right) =0$
$(\mu\nu) = (\theta\theta): G_{\theta\theta}=\frac{1}{2r}\left(2f'(r) + r f''(r)\right) =0$
while $G_{rr} = -\frac{1}{f^2(r)} G_{tt}$ and $G_{\phi\phi} = \sin^2\theta G_{\theta\theta}$. So, from the EFEs, we have 2 differential equations to solve, and the solution can be straightforwardly verified to be
$f(r) = 1 - \frac{2 GM}{r}$
which means that we have the Schwarzschild metric. 
On the other hand, if we start with the Einstein-Hilbert action (EH), 
$S_{EH} = \frac{1}{16\pi G}\int d^4x \mathcal L$ with  $\mathcal L= \sqrt{-g} R =- \sin\theta\left(-2 + 2f(r) + 4r f'(r) + r^2 f''(r)\right)$
and use the Euler-Lagrange variation to derive the differential equations to be obeyed by $f(r)$, we have at most one equation, not two. (We also need to convert the term containing $f''(r)$ into $f'(r)$ using integral by parts so that $\mathcal L$ contains at most $f'(r)$ in derivatives). The only field variable here is $f(r)$, so there is only one Euler-Lagrange equation possible, and that is
$\frac{\partial\mathcal L}{\partial f(r)} - \partial_r\left(\frac{\partial \mathcal L}{\partial  f'(r)}\right) = 0 $
So, there is no way we can recover the two differential equations resulting from the EFEs using the EH action, according to this analysis. This apparent puzzle persists with all form of metrics, not just the simple one used in this example above. In general, using the EH action with the Euler-Lagrange variation, the number of derived equations is always smaller than the number of equations obtained using the EFEs. 
I suspect I have overlooked something basic here, and I'd greatly appreciate it if someone could point me to some answer.  
 A: There are 10 independent components of the metric, and 10 Einstein field equations. At first sight that seem to match up, 10 equations for 10 unknowns.
However, it turns out that 4 of the EFEs are in fact non-dynamical. An easy way to see this starts from the fact that the Einstein tensor is divergenceless $\nabla_\mu G^{\mu\nu} = 0$. We can rewrite this as
$$ \partial_0 G^{0\nu} = - \partial_i G^{i\nu} - \Gamma^{\nu}_{\mu\kappa}G^{\mu\kappa} - \Gamma^{\mu}_{\mu\kappa} G^{\kappa\nu}$$
Since the right-hand side contains at most second derivatives with respect to time of the metric, $G^{0\nu}$ can contain at most first derivatives with respect to time of the metric. Hence, these components are not dynamical equations, they express a constraint on the initial conditions which the other equations have to uphold.
That would seem to imply the Einstein equations are underdetermined, but we must not forget that there are also four degrees of freedom in picking a gauge for the metric, the freedom we have in choosing our coordinates.
Since your Ansatz uses up all this freedom and is non-dynamical, it should be purely constraint. Taking the derivative with respect to $r$ of the $G_{tt}$ component of the Einstein tensor yields the $G_{\theta\theta}$ component, showing you only have one real equation.
I don't entirely understand how this explains the variation of the action not working, but I do know how to fix it, by introducing a little bit of freedom again. Instead, take as an Ansatz
$$ ds^2 = -N^2(t) f(r) dt^2 + \frac{1}{f(r)} dr^2 + r^2 d\Omega^2 ,$$
where I have simply added a function $N(t)$. After a few rounds of partial integration, the action will be proportional to
$$ S \propto \int dr dt \, N \left( -1 + f + rf' \right) $$
$N$ is a non-dynamical variable, appearing without derivatives, and acts as a Lagrange multiplier. Its Euler-Lagrange equation will enforce the constraint corresponding to the $G_{tt}$ component of the Einstein field equations, which you can then solve to finally find the Schwarzschild metric. In a sense, $N$ expresses the freedom we have in choosing the time coordinate, which in turn corresponds to the $G_{tt}$ field equation.
A: The problem in your derivation by using the action principle is that you vastly restricted the state space your Lagrangian is defined on. You guess the metric to be of the form $$ds^2=-f(r)dt^2 + f(r)^{-1} dr^2 + r^2d\Omega$$ with $d\Omega$ the 2-sphere volume. If you take a look at the space of states, i.e. the space of metrics on your manifold, the metrics of this form are just a subspace parametrized by $f$. In your derivation, you tried to vary in this subspace of the space of states and, thus, introduce constraints to your system forcing it to stay on the constraint surface. However, there is no reason to constrain our system in this case and it's easier to do a variation on the full state space. Sure, the specific form of the metric can be reasoned by symmetry but dealing with constraints can make things quite complicated. 
This is propably not the answer you hoped for but I hope it helps you anyway!
Cheers!
A: The number of equations you get from the specialized EH action (the one with the ansatz inserted before the Euler-Lagrange equations are derived) isn't really smaller. It only looks smaller because the equations you get for $f$ from the general EH action are redundant. The $(tt)$ equation implies that either $f=0$ or $-1+f+rf'=0$, and both of these cases automatically imply $2f'+rf''=0$, which in turn implies the $(\theta\theta)$ equation.
A: The function $f(r)$ is not the dynamical field at play here, the metric is. This means you can't just derive the Euler-Lagrange equations with respect to $f$, but rather you should consider the variation of the action with respect to the metric, and setting it equal to zero.
Following this procedure gives you the vacuum Einstein field equations (modulo some problems to do with the boundary term), which are in fact the Euler-Lagrange equations of the system. 
