The Hamiltonian density for a massive neutral vector field, described by a Lorentz vector field $Z_\mu$, coupled to a four-vector source field $J^\mu$, which involves fields other than $Z_\mu$ (for example, we might have $J^\mu=e \bar{\psi} \gamma^\mu \psi$, with $\psi$ a Dirac field) is given by
$$
\begin{aligned}
\mathcal{H} & =\mathcal{H}_0+\mathcal{H}_{\text {int }} \\
\mathcal{H}_0 & =\frac{1}{2}\left\{\vec{\pi}^2+|\vec{\nabla} \times \vec{Z}|^2+m^2 \vec{Z}^2+\frac{1}{m^2}(\vec{\nabla} \cdot \vec{\pi})^2\right\} \\
\mathcal{H}_{\text {int }} & =-\frac{1}{m^2} J^0 \vec{\nabla} \cdot \vec{\pi}-\vec{J} \cdot \vec{Z}+\frac{1}{2 m^2}\left(J^0\right)^2
\end{aligned}
$$
where $\pi_i$ is the momentum field conjugate to $Z_i(i=1,2,3)$. From Hamilton's equation, we easily find $\pi_i=K_{i j}^{-1}\left(\dot{Z}_j-\frac{1}{m^2} \partial_j J^0\right)$, where $K_{i j} \equiv \delta_{i j}-\frac{1}{m^2} \partial_i \partial_j$.
(a) Perform the Legendre transform to arrive at a Lagrangian density given as a function of $\vec{Z}, \dot{\vec{Z}}, J^0$, and $\vec{J}$. The result is non-local, and horribly non-covariant in appearance (sanity will be restored in part (d))! Note that the Lagrange density may always be thought of as defining an action via a spacetime integral (e.g., in the Lagrangian form of the functional integral (12.60)), so you are always permitted to rearrange derivatives in each term by free use of integration by parts.
(b) Next, show that the result obtained in (a) is completely equivalent to that obtained starting with the manifestly local and Lorentz-invariant Lagrangian
$$
\mathcal{L}=-\frac{1}{4} F_{\mu \nu} F^{\mu \nu}+\frac{m^2}{2} Z_\mu Z^\mu-J^\mu Z_\mu, \quad F_{\mu \nu} \equiv \partial_\mu Z_\nu-\partial_\nu Z_\mu
$$
Proceed as follows. First, show that $Z^0$ is a dependent field: namely one that can be expressed, via the Euler-Lagrange equations of motion, uniquely and entirely in terms of the other canonical fields and their conjugate momenta at the same time. Do this by writing down the equation of motion for $Z^0$ and showing that it reduces to
$$
Z^0=\frac{1}{m^2}\left(J^0-\vec{\nabla} \cdot \vec{\pi}\right), \quad \pi_i=\frac{\partial \mathcal{L}}{\partial \dot{Z}_i}=\dot{Z}_i-\partial_i Z^0
$$
Show that (12.300) implies the formula $\pi_i=K_{i j}^{-1}\left(\dot{Z}_j-\frac{1}{m^2} \partial_j J^0\right)$ obtained previously in the Hamiltonian framework. Finally, eliminate $Z^0$ completely from the Lagrangian (12.299), and show that the resultant expression agrees with that found in part (a).
(c) Now carry out the canonical procedure in the usual direction, by starting with the Lagrangian, and eliminating $\dot{\vec{Z}}$ in favor of $\vec{\pi}$ in $\mathcal{H}=\vec{\pi} \cdot \dot{\vec{Z}}-\mathcal{L}$, to check that the original Hamiltonian (12.296-12.298) is recovered.
(d) In the functional integral approach, the fact that $Z^0$ is a dependent field manifests itself in the Gaussian dependence of the Lagrangian density on $Z^0$ (and its spatial derivatives). Show that if we explicitly integrate out $Z^0$ in the path integral
$$
\int \mathbf{D} Z^\mu e^{i \int\left(-\frac{1}{4} F_{\mu \nu} F^{\mu \nu}+\frac{1}{2} m^2 Z_\mu Z^\mu-J_\mu Z^\mu\right) d^4 x} \rightarrow \int \mathbf{D} \vec{Z} e^{i \int \mathcal{L}^{\prime}\left(\vec{Z}, \dot{\vec{Z}}, J^0, \vec{J}\right) d^4 x}
$$
the resultant Lagrangian $\mathcal{L}^{\prime}$ is exactly the expression found in part (a). (Hint: note the identity $K_{i j}^{-1}=\delta_{i j}+\frac{1}{-\Delta+m^2} \partial_i \partial_j$ ) Its disgustingly non-covariant (and non-local) appearance is seen to arise from the fact that the Legendre transform from the Hamiltonian side naturally produces a Lagrangian density with dependent fields eliminated-which we see clearly in this instance serves to disguise the underlying Lorentz-invariance of the theory. The same situation arises when redundant fields, associated with local gauge symmetries, are present, as we shall see in Chapter 15 . Of course, the sensible way to ensure Lorentz-invariance is to start with a Lorentz-invariant Lagrangian, from which we go (if needed) to the Hamiltonian.