Deriving distribution of $w | x $ when $w$ is marginal $\chi^2$ and $x$ normal Let $w \sim \chi_\nu^2 / \nu$, where $\nu$ the degrees of freedom, and $x \sim N(\mu,\sigma^2/w)$, so that marginally $p(x|\nu,\mu,\sigma^2)$ is $t$ distributed (which is a well known result that I can show and which can be generalized to when $w$ is $\Gamma$-distributed). 
In a text it is now stated that "a simple calculation shows" that the distribution of $w$ given $(x,\nu,\mu,\sigma^2)$ is $\chi^2_{\nu+1}(\nu + (x-\mu)^2/\sigma^2)^{-1}$. They lost me - what does this simple calculation look like?
I can see that $$p(w|\nu) = \int p(x|\mu,\sigma^2)p(w|x,\nu,\mu,\sigma^2) dx,$$ the first factor in the integral being normal and the left side $\chi^2$ but I am not sure how to go on.
 A: It might help to just drop the parameters, $\nu, \mu, \sigma^2$ from the notation because they aren't random variables and just add clutter when manipulating the density functions, also by way of notation let $\chi^2_{\nu}(\cdot)$ and $\mathcal{N}(\cdot|\mu,\sigma^2)$ denote the density functions of a $\chi^2$-random variable and a normal random variable respectively. Then you can write the marginal density of $W$ as
$$
p(w)=\nu \chi^2(\nu \cdot w),
$$
and the conditional density of $X$ as
$$
p(x|w)=\mathcal{N}\left(x|\mu, \sigma^2/w \right).
$$
Then we know that
\begin{align*}
p(w|x) &\propto p(x|w)p(w) \\
&= \frac{\sqrt{w}}{\sqrt{2\pi}\sigma}e^{-\frac{w(x-\mu)^2}{2\sigma^2}}\frac{\nu}{2^{\nu/2}\Gamma\left(\frac{\nu}{2}\right)}(\nu w)^{\nu/2-1}e^{-\frac{\nu w}{2}},
\end{align*}
now I am going to ignore every term that does not depend on $w$ in some way, this reduces clutter and so we can work with the density only up to some unknown normalising constant and then at the end finish by identifying the unnormalised density with some proper density function. So with that in mind write
\begin{align*}
p_{W|X=x}(w) &\propto w^{(\nu+1)/2 - 1}\exp\left\{-\frac{w}{2}\left(\nu +\frac{(x-\mu)^2}{\sigma^2}\right)\right\} 
\end{align*}
which is starting to look like what we are after. So in a natural way define a new variable 
$$
y = \phi(w) = w\cdot \left(\nu + \frac{(x-\mu)^2}{\sigma^2} \right)
$$
and since the transformation is linear the jacobian does not depend on the variable, and since we are working with the density only up to proportionality we can effectively just ignore it, this gives the density of $Y$ up to some unknown normalising constant as
\begin{align*}
p(y|x) &= \left|\frac{\partial \phi^{-1} }{\partial y}\right|p_{W|X=x}(\phi^{-1}(y)) \\
&\propto y^{(\nu+1)/2 - 1} e^{-\frac{y}{2}}
\end{align*}
which we quickly identify as being a Chi-squared random variable from which we conclude
$$
W\left(\nu + \frac{(x-\mu)^2}{\sigma^2} \right)\bigg| \, X=x \sim \chi^2_{\nu + 1}.
$$
