Solution (source code)

= Solution

A <fundamental observer> follows the mean cosmic matter flow and is at rest with respect to the homogeneous cosmological frame. <Cosmological isotropy> permits no preferred spatial acceleration, rotation vector or anisotropic expansion for this flow: the congruence is geodesic, irrotational and shear-free, with isotropic expansion. Its orthogonal homogeneous spatial slices define simultaneity. Choosing fixed spatial labels along these worldlines and their common <proper time> as $t$ gives <synchronous coordinates>, $g_{tt}=c^2$ and $g_{ti}=0$.

In the <Friedmann-Lemaître-Robertson-Walker metric>, $t$ is this cosmic <proper time> and $\chi$ is radial <comoving coordinate>. On a constant-$t$ radial slice, the <proper distance in cosmology> from $0$ to a fixed $\chi_0$ is $D(t)=a(t)\chi_0$. Therefore
$$
\boxed{\dot D=H(t)D,\qquad H(t)=\frac{\dot a(t)}{a(t)}.}
$$
This is the <Hubble parameter>. The metric describes expansion when $\dot a>0$; its form alone also permits static or contracting histories, so expansion additionally requires that sign of the <scale factor> derivative.

For a radial <photon>, the metric components relevant to its motion are $g_{tt}=c^2$ and $g_{\chi\chi}=-a^2(t)$, both independent of $\chi$. The angular momentum components vanish. The covariant-momentum form of the <geodesic equation> therefore gives
$$
\boxed{\frac{dp_\chi}{d\lambda}=\frac12\partial_\chi g_{\nu\rho}p^\nu p^\rho=0.}
$$
Only this radial contraction is needed: angular metric coefficients can depend on $\chi$, but multiply zero angular components. The conserved quantity is the lower-index $p_1=p_\chi$, rather than the contravariant component $p^1$.

For outward travel put $P=-p_\chi>0$. The null condition $c^2(p^t)^2-a^2(p^\chi)^2=0$ gives
$$
p^\chi=\frac P{a^2},\qquad p^t=\frac P{ac},\qquad\boxed{p_0=p_t=c^2p^t=\frac{cP}{a(t)}.}
$$
Here the time coordinate is $t$, rather than $ct$. A <comoving observer> has $u^t=1$ and measures <photon energy> $E=p_\mu u^\mu=p_t$. Thus <energy> and <frequency> decrease as $a^{-1}$, giving the <cosmological redshift>
$$
\boxed{1+z=\frac{\nu_E}{\nu_R}=\frac{a(t_R)}{a(t_E)}.}
$$
The reciprocal relation for <wavelengths> follows from their common local propagation speed $c$.

Finally center the spatial coordinates on the receiving <comoving observer>. At the source, the transverse spatial line element is $dl=a(t_E)S_K(\chi)\,d\theta$. For a short transverse rod and a small observed <angle> $\Delta\theta$,
$$
l=a(t_E)S_K(\chi)\Delta\theta
=\boxed{\frac{a(t_R)S_K(\chi)}{1+z}\Delta\theta.}
$$
Thus the <angular diameter distance> is $d_A=a(t_E)S_K(\chi)$. Writing the reception epoch as $t_0=t_R$ gives the displayed formula in the question. The length is the proper transverse length at emission; $t_0$ cannot be replaced by an unrelated epoch while retaining that expression.