I'm working on a course problem,
Suppose that $\textbf{x}=\{x_1,\dots,x_n\}$ and $\textbf{y}=\{y_1\dots,y_m\}$ are independent random samples from $\text{N}(x|\mu_x,1/\lambda)$ and $\text{N}(y|\mu_y,1/\lambda)$, respectively. Using the (improper) prior $$\pi(\mu_x,\mu_y,\lambda)=\lambda^{-1},$$ prove that $\mu_x$ and $\mu_y$ are not independent a posteriori and find $\text{Cov}[\mu_x,\mu_y|\textbf{x},\textbf{y}]$.
The given solution begins,
The likelihood can be written as $$\text{L}(\mu_x,\mu_y,\lambda|\textbf{x},\textbf{y})\propto\lambda^{\frac{n+m}{2}}\exp\left(-\lambda\left(\frac{n}{2}(s_x^2+(\bar{x}-\mu_x)^2)+\frac{m}{2}(s_y^2+(\bar{y}-\mu_y)^2)\right)\right)$$ thus the joint posterior is $$\pi(\mu_x,\mu_y,\lambda|\textbf{x},\textbf{y})\propto\lambda^{\frac{n+m}{2}-1}\exp\left(-\lambda\left(\frac{n}{2}(s_x^2+(\bar{x}-\mu_x)^2)+\frac{m}{2}(s_y^2+(\bar{y}-\mu_y)^2)\right)\right)$$ and the marginal for the means is $$\pi(\mu_x,\mu_y|\textbf{x},\textbf{y})\propto\left(1+\frac{1}{ns_x^2+ms_y^2}(n(\bar{x}-\mu_x)^2+m(\bar{y}-\mu_y)^2)\right)^{-\frac{n+m}{2}}.$$
I see we have \begin{align}\pi(\mu_x,\mu_y,\lambda|\textbf{x},\textbf{y})=\frac{\Gamma(a)}{b^a}\text{Ga}(\lambda|a,b),\text{ with } & a = \frac{n+m}{2}, \\ & b = \frac{n}{2}(s_x^2+(\bar{x}-\mu_x)^2)+\frac{m}{2}(s_y^2+(\bar{y}-\mu_y)^2),\end{align} but I can't follow the manipulation of fractions in \begin{align}b&=\frac{n}{2}(s_x^2+(\bar{x}-\mu_x)^2)+\frac{m}{2}(s_y^2+(\bar{y}-\mu_y)^2) \\ &=1+\frac{1}{ns_x^2+ms_y^2}(n(\bar{x}-\mu_x)^2)+(m(\bar{y}-\mu_y)^2)\end{align} between the last two steps. Would someone mind clarifying?