Given
\begin{align*}
Y &\sim \mathcal{N}(y|0, 1) \\
Z &\sim \chi_n^2(z) \\
\end{align*}
let
\begin{align*}
X = \frac{Y}{\sqrt{Z/n}}
\end{align*}
then X follows t-distribution t_n(x) with n digree of freedom.
\begin{align*}
X \sim t_n(x) = \frac{1}{\sqrt{n} \Beta(\frac{n}{2}, \frac{1}{2})}
\left( \frac{x^2}{n} + 1 \right)^{- \frac{n+1}{2}}
\end{align*}
Let U = Z,
\begin{align*}
1 = \int f_{XU}(x, u) dx du &= \int f_{YZ}(y, z) dy dz \\
&= \int f_Y(y) f_Z(z) dy dz \\
&= \int_{-\infty}^\infty \int_0^\infty \frac{1}{\sqrt{2 \pi}} e^{-\frac{y^2}{2}}
\frac{1}{2^{\frac{n}{2}} \Gamma(\frac{n}{2})} z^{\frac{n}{2}-1} e^{-\frac{z}{2}}
dy dz
\end{align*}
y = x \sqrt{z/n} = x \sqrt{u/n} , z = u,
x: -\infty \rightarrow \infty , u: 0 \rightarrow 1.
\begin{align*}
J &= \begin{vmatrix}
dy/dx & dy/du \\
dz/dx & dz/du
\end{vmatrix} \\
&= \begin{vmatrix}
\sqrt{u/n} & \frac{x}{n} \frac{1}{2} (u/n)^{-\frac{1}{2}} \\
0 & 1
\end{vmatrix} \\
&= \sqrt{u/n}
\end{align*}
therefore
\begin{align*}
&= \int_{-\infty}^\infty \int_0^\infty \frac{1}{\sqrt{2 \pi}} e^{-\frac{x^2 \frac{u}{n}}{2}}
\frac{1}{2^{\frac{n}{2}} \Gamma(\frac{n}{2})} u^{\frac{n}{2}-1} e^{-\frac{u}{2}}
\sqrt{u/n} dx du \\
&= \int_{-\infty}^\infty
\frac{1}{\sqrt{2 \pi n}}
\frac{1}{2^{\frac{n}{2}} \Gamma(\frac{n}{2})}
\int_0^\infty
u^{\frac{n -1 }{2}}
e^{- \left( \frac{x^2 u}{2n} +\frac{u}{2} \right)}
du dx\\
\end{align*}
let r = \frac{x^2 u}{2n} + \frac{u}{2}, u = \frac{2 n}{x^2 + n} r,
du = \frac{2 n}{x^2 + n} dr , r: 0 \rightarrow \infty.
\begin{align*}
&= \int_{-\infty}^\infty
\frac{1}{\sqrt{2 \pi n}}
\frac{1}{2^{\frac{n}{2}} \Gamma(\frac{n}{2})}
\int_0^\infty
(\frac{2 n}{x^2 + n} r)^{\frac{n -1 }{2}}
e^{- r}
\frac{2 n}{x^2 + n} dr
dx\\
&= \int_{-\infty}^\infty
\frac{1}{\sqrt{2 \pi n}}
\frac{1}{2^{\frac{n}{2}} \Gamma(\frac{n}{2})}
(\frac{2 n}{x^2 + n})^{\frac{n + 1 }{2}}
\int_0^\infty
r^{\frac{n + 1}{2} - 1}
e^{- r}
dr
dx\\
&= \int_{-\infty}^\infty
\frac{1}{\sqrt{2 \pi n}}
\frac{1}{2^{\frac{n}{2}} \Gamma(\frac{n}{2})}
2^{\frac{n + 1 }{2}}
(\frac{1}{x^2/n + 1})^{\frac{n + 1 }{2}}
\Gamma(\frac{n+1}{2})
dx \\
&= \int_{-\infty}^\infty
\frac{1}{\sqrt{2 \pi n}}
\frac{1}{2^{\frac{n}{2}} \Gamma(\frac{n}{2})}
2^{\frac{n + 1 }{2}}
(\frac{1}{x^2/n + 1})^{\frac{n + 1 }{2}}
\frac{\Gamma(\frac{n}{2}) \Gamma(\frac{1}{2})}{\Beta(\frac{n}{2}, \frac{1}{2})}
dx \\
&= \int_{-\infty}^\infty
\frac{1}{\sqrt{n} \Beta(\frac{n}{2}, \frac{1}{2})}
\left( \frac{1}{x^2/n + 1} \right)^{\frac{n + 1 }{2}}
dx \\
&= \int_{-\infty}^\infty
t_n(x)
dx \\
\end{align*}
Discussion