Solution (source code)

= Solution

Put $\chi=a\phi$. Direct differentiation of the previous equation yields
$$
\chi''-\nabla^2\chi+\left(a^2m^2-\frac{a''}a\right)\chi=0.
$$
In <radiation domination>, $a\propto t$, and for a <massless scalar field> both extra terms vanish. Each nonzero <Fourier mode> therefore satisfies $\chi_{\mathbf k}''+k^2\chi_{\mathbf k}=0$. The general real radiative solution is
$$
\boxed{\phi_{\rm rad}(t,\mathbf x)=\frac1{a(t)}\sum_{\mathbf k\ne0}
\left[A_{\mathbf k}e^{i\mathbf k\cdot\mathbf x-ikt}+\text{complex conjugate}\right].}
$$
Summing over both wavevector directions supplies the two traveling-wave solutions, with constant amplitudes. In infinite space the sum is replaced by the corresponding Fourier integral.

There is a qualification to calling the printed oscillatory expression completely general. At $k=0$, $\chi_0''=0$, so $\chi_0=C_1+C_2t$ rather than a single zero-frequency exponential. The <zero mode of a radiation-era massless scalar> is
$$
\boxed{\phi_0=C+D/a.}
$$
A constant nonzero field is an immediate counterexample to the completeness of the fixed-amplitude oscillatory formula at zero wavenumber. Include this homogeneous term, or explicitly restrict the displayed plane-wave expansion to the radiative modes with no homogeneous background.