how to calculate distance between galaxies in the distant past

for example, assume there is a high redshift galaxy called "A" with z=6, so how to calculate the distance between us and another galaxy B when the light left the galaxy A?

For example, say B has a redshift of 0.5, and let's assume when the light emitted from A, us and B both exist.

• How far is B from us now? (for example) – James K Mar 22 '20 at 22:14
• for example, B has redshift of 0.5, but lets assume when the light emitted from A, us and B both exists – Stargazer Mar 22 '20 at 22:35

I'm assuming you're talking about physical distances (as opposed to any of the other distance measures in cosmology).

The comoving distance to a galaxy at redshift $$z$$ is $$d_C(z) = \frac{c}{H_0}\int_0^z \frac{dz}{\sqrt{ \Omega_r(1+z)^4 + \Omega_m(1+z)^3 + \Omega_k(1+z)^2 + \Omega_\Lambda }},$$ where $$c$$ and $$H_0$$ are the speed of light and the Hubble parameter, and $$\{\Omega_r,\Omega_m,\Omega_k,\Omega_\Lambda\}$$ $$\simeq$$ $$\{\lt 10^{-4},0.3,0,0.7\}$$ are the radiation, matter, curvature, and dark energy density parameters, respectively.

By definition, the comoving and the physical distance $$d_P$$ coincide today, but at the time a galaxy at $$z$$ emitted the light we see today, it was at $$d_P = \frac{d_C}{1+z}.$$

In your example, $$z_A = 6$$, and $$z_B = 0.5$$. The comoving distance to galaxy $$B$$ is, from the equation above and with a Planck Collaboration et al. (2016) cosmology, $$1946\,\mathrm{Mpc}$$ away. Hence, when $$A$$ emitted the light we see today, its physical distance was a factor $$(1+6)$$ smaller, i.e. $$278\,\mathrm{Mpc}$$.

In Python, with astropy:

from astropy.cosmology import Planck15
from astropy import units as u
zA,zB      = 6,.5
dC_B       = Planck15.comoving_distance(zB)
dP_B_at_zA = dC_B / (1+zA)
print(dC_B)
-> 1945.5612969107992 Mpc
print(dP_B_at_zA)
-> 277.93732813011417 Mpc
print(dP_B_at_zA.to(u.Mlyr)) # convert to light-years
-> 906.5103217447773 Mlyr

• Thanks for your answer, I am really appercaite your help. However, i still have some quesitons, do I need to know the hubble constant at z=6? to solve this question, can i calculate the recession velocity of B galaxy at z=6, and then calculate the distance by divde the recession velocity of B by hubble constant at z=6? – Stargazer Mar 23 '20 at 2:34
• @Stargazer You only need to know the Hubble parameter at $z_A = 6$ if you also want to know the distance to $A$. Your approach is sort of one step forward, and one step back: To calculate the recession velocity of $B$ at $z=6$, you must first calculate its physical distance $d_{P,B}(z=6)$, and then multiply by $H(z=6)$. Then you divide by $H$ again to get back to $d_{P,B}$ – pela Mar 23 '20 at 11:27
• @Stargazer Sorry, I wrote a slight mistake/confusion: You don't really need to know the Hubble parameter at $z=6$ to know the distance. But in effect you do calculate it, since that is really what the denominator in the integral is (that square-root is sometimes written $\sqrt{\cdots} \equiv E(z)$, and $H(z) = H_0 E(z)$). – pela Mar 23 '20 at 22:15
• Thank you very much, i know it now. – Stargazer Mar 24 '20 at 0:28