Calculating the generating function for a linear interaction in scalar QFT

So i'm asked to calculate the generating function $$Z(J)$$ for a Lagrangian density $$L = -\left( \partial \phi \right) ^2 + m^2\phi^2 + f\left(x\right) \phi$$ for a fixed function $$f(x)$$ , and express it in terms of the usual propagator and $$f$$ in the case $$f=0$$. My problem is in the role of the function $$f(x)$$.

We are told to do this by integrating $$Z(J) = \int D\phi \exp \left( i \left( \int d^4x L + J\phi \right) \right) \, ,$$ so I get $$Z(J) = \int D\phi \exp( i (\int d^4x L_0 + f(x)\phi + J\phi))$$ where $$L_0$$ is the typical Lagrangian density for a Klein- Gordon field.

My confusion is what I do with $$f(x)$$ - what stops it from just being absorbed into $$J$$ by setting $$J' = J + f$$, which would give effectively the same result as $$Z$$ for the Klein- Gordon field?

Below is what I have so far.

$$Z(J) = \int D\phi \exp(i\int d^4x L + J\phi ) = \int D\phi \exp(iS) \, ,$$ but Fourier transforming everything gives $$S = \int \frac{d^4k}{(2\pi)^4} \ \ \frac{d^4k'}{(2\pi)^4} \ \ d^4x \ \ \frac{1}{2}\eta^{ab} k_ak_b e^{i(k+k')x} + \frac{1}{2} (m^2-i\epsilon) e^{i(k+k')x}\tilde{\phi}(k)\tilde{\phi}(k') + e^{i(k+k')x} \tilde{f}(k')\tilde{\phi}(k) + e^{i(k+k')x}\tilde{J}(k')\tilde{\phi}(k) \, .$$

As usual, integrating over $$x$$ gives the delta function $$(2\pi)^4\delta^{4}(k+k')$$ which allows us to do the $$d^4k'$$ integral sending $$k'$$ to $$-k$$. We are left with $$S= \int \frac{d^4k}{(2\pi)^4} \left[ -\frac{1}{2} \tilde{\phi}(k) \left( k^2 + (m^2-i\epsilon)\right) \tilde{\phi}(-k) + \tilde{f}(-k)\tilde{\phi}(k) + \tilde{J}(-k)\tilde{\phi}(k) \right] \, .$$ In the free field theory, we would then change variables to (dropping all the tildes for brevity) $$\chi(k) = \phi(k) - \frac{J(k)}{k^2 +m^2 - i\epsilon}$$.

I'm not sure whether this is the right step in this problem. Proceeding with it anyway, I arrive at $$S = \int \frac{d^4k}{(2\pi^4)} \left[ -\frac{1}{2} \frac{J(k)J(-k)}{k^2 + m^2 - i\epsilon} + \frac{f(-k)J(k)}{k^2 +m^2 - i\epsilon} + \frac{J(-k)J(k)}{k^2 + m^2 -i\epsilon} \right] \, .$$

I'm not sure what to do from here to obtain $$Z(J)$$, and even if the past step was the right thing to do. Any help would be greatly appreciated.

Thanks

• Exponentiating the final $S$ you are done, you can also back fourier transform to express $Z$ in terms of $J(x)$ instead of $J(k)$. – Sunyam Nov 20 '18 at 21:53