Solution (source code)

= Solution

For radial motion, use the <geodesic Lagrangian>
$$
\mathcal L=\frac12(c^2\dot t^2-a(t)^2\dot\chi^2).
$$
The <Euler-Lagrange equation> for $t$ gives $c^2\ddot t+a(da/dt)\dot\chi^2=0$. Since $\chi$ is a <cyclic coordinate>, its conjugate momentum is constant. Hence
$$
\boxed{\frac d{d\tau}(c^2\dot t)+a\frac{da}{dt}\dot\chi^2=0,\qquad a^2\dot\chi=C.}
$$
For a massive particle, take $\tau$ as <proper time>; the <four-velocity> normalization is $c^2\dot t^2-a^2\dot\chi^2=c^2$. For a <photon>, use an <affine parameter> rather than proper time, and the corresponding tangent is a <null vector>. Therefore
$$
\boxed{\dot t^2=1+\frac{a^2\dot\chi^2}{c^2}\quad\text{(massive)},\qquad
\dot t^2=\frac{a^2\dot\chi^2}{c^2}\quad\text{(massless)}.}
$$
The normalization of the null affine parameter remains arbitrary.