robphy said:
Well, Wald is correct to state that the basic action from which the field equations can be derived is the Einstein-Hilbert action:
S_{\textrm{E-H}}[g] = \frac{1}{2\kappa}\int_\mathcal{M} d^4x\,\sqrt{-g}R + S_M,
where S_M is a (possibly derivatively coupled) matter action. This is all fine if \mathcal{M} has no boundary. However, if \partial\mathcal{M}\ne\emptyset then in order for the variational principle to be well posed one needs to add the Gibbons-Hawking-York boundary term S_{\partial\mathcal{M}}[g]. Then we have
S[g] = \frac{1}{2\kappa}\int_\mathcal{M} d^4x\sqrt{-g}R + \frac{1}{\kappa}\int_{\partial\mathcal{M}}d^3y \sqrt{|h|}\textrm{tr}K + S_M,<br />
where h_{ij} is a three-metric on \partial\mathcal{M} and \textrm{tr}K=h^{ij}K_{ij} is the trace of the extrinsic curvature of \partial\mathcal{M}.
In fairness, Wald does stress the importance of this boundary contribution to the action, but he concludes that the action above is sufficient to derive sensible field equations. This is untrue. If you evaluate the gravitational action for, say, flat spacetime, then S_{\textrm{E-H}}[g]=0. However, for flat spacetime S_{\partial\mathcal{M}}[g] is divergent, making the action effectively infinite. Thus, the action that Wald uses is actually ill defined except when \mathcal{M} is compact. In order to overcome this, one needs to introduce a further correction to the action, meaning that the
true action for general relativity is
S = S_{\textrm{E-H}}[g] + S_{\partial\mathcal{M}}[g] + S_M - \frac{1}{\kappa}\int_{\partial\mathcal{M}} d^3y\sqrt{|h|}K_0
where K_0 is the extrinsic curvature of \partial\mathcal{M} embedded in Minkowski space.