Solution (source code)

= Solution

Write the <Cepheid variable>[Cepheid] measurement as $\widehat\mu=\mu+\epsilon_\mu$, where $\epsilon_\mu\sim N(0,\sigma_\mu^2)$, and define the calibrated <absolute magnitude> data
$$
q_k=m_k-\widehat\mu
=M_0+\Delta M_G+\delta M_k-\epsilon_\mu.
$$
Thus $q=(q_1,\ldots,q_K)^T$ has a <multivariate normal distribution> with mean $M_0\mathbf1$ and <covariance matrix>
$$
C=\sigma_I^2I_K+(\sigma_G^2+\sigma_\mu^2)\mathbf1\mathbf1^T.
$$

The <Hubble law> and the definition of <distance modulus> give
$$
m_i=M_i+25+5\log_{10}\!\left(\frac{cz_i}{100\ {\rm km\,s}^{-1}}\right)-\theta.
$$
Consequently, with
$$
x_i=m_i-25-5\log_{10}\!\left(\frac{cz_i}{100\ {\rm km\,s}^{-1}}\right),
$$
the Hubble-flow observations are <independent random variables> satisfying $x_i\sim N(M_0-\theta,\sigma_{\rm tot}^2)$. Apart from a factor independent of the parameters, the joint <likelihood function> is
$$
L(M_0,\theta)
\propto |C|^{-1/2}
\exp\!\left[-\frac12(q-M_0\mathbf1)^TC^{-1}(q-M_0\mathbf1)\right]
(\sigma_{\rm tot}^2)^{-N/2}
\exp\!\left[-\frac1{2\sigma_{\rm tot}^2}
\sum_{i=1}^N\{x_i-(M_0-\theta)\}^2\right].
$$
The expression extends by continuity to a singular limiting covariance such as $\sigma_I=0$.