\documentclass[12pt]{article}

\begin{document}
$$
X\hookrightarrow N(\mu,\sigma)
\qquad
H_0\equiv(\mu,\sigma)=(\mu_0,\sigma_0)
\qquad
H_1\equiv(\mu,\sigma)\not=(\mu_0,\sigma_0)
$$

\begin{eqnarray*}
L_0&=&\frac1{\sigma_0^n\sqrt{2\pi}^n}\cdot
e^{-\frac12\sum_{i=1}^n\left(\frac{x_i-\mu_0}{\sigma_0}\right)^2}
\\ \\
L&=&\frac1{s^n\sqrt{2\pi}^n}\cdot
e^{-\frac12\frac1{s^2}\sum_{i=1}^n(x_i-\bar x)^2}\\
{}&=&\frac1{s^n\sqrt{2\pi}^n}\cdot e^{-\frac n2}
\\ \\
 s^2&\stackrel{\Uparrow}=&\frac1n\sum_{i=1}^n(x_i-\bar x)^2
\end{eqnarray*}

\begin{eqnarray*}
  \Lambda=\frac{L_0}{L}
  &=&\left(\frac{s^2}{\sigma_0^2}\right)^{\frac n2}\cdot
      e^{-\frac12\sum\left(\frac{x_i-\mu_0}{\sigma_0}\right)^2
      +\frac n2}\\
  &=&\left[\frac1n\sum\left(\frac{x_i-\bar x}{\sigma_0}\right)^2\right]
      ^{\frac n2}\cdot
      e^{-\frac12\sum\left(\frac{x_i-\mu_0}{\sigma_0}\right)^2
      +\frac n2}\\ \\
  -2\ln\Lambda
  &=&-\not2\cdot\left\{\frac n{\not2}
      \ln\left[\frac1n\sum\left(\frac{x_i-\bar x}{\sigma_0}\right)^2\right]
      -\frac1{\not2}\sum\left(\frac{x_i-\mu_0}{\sigma_0}\right)^2
      +\frac n{\not2}\right\}\\
  &=&n\cdot\ln n
      -n\cdot\ln\underbrace{
      \underbrace{\sum\left(\frac{x_i-\bar x}{\sigma_0}\right)^2}
      _{\chi^2_{n-1}}{}+
      \underbrace{\sum\left(\frac{x_i-\mu_0}{\sigma_0}\right)^2}_{\chi^2_n}}
      _{\rm dependientes}
      {}-n
\end{eqnarray*}
\newpage
\begin{verbatim}
mu0 <- 0
sigma0 <- 1
n <- 100
simul <- replicate(100000,
{
  x <- rnorm(n)
  n*log(n) - n*log(sum(((x-mean(x))/sigma0)^2)) +
     sum(((x-mu0)/sigma0)^2) - n
})
a <- c(1,10,25,50,75,90,99)/100
round(rbind(quantile(simul,a), qchisq(a,2)), 3)

##        1%   10%   25%   50%   75%   90%  99%
## [1,] 0.02 0.212 0.577 1.398 2.805 4.652 9.21
## [2,] 0.02 0.211 0.575 1.386 2.773 4.605 9.21
\end{verbatim}
\end{document}
