[Tex/LaTex] write out latex code for degree of freedom of unequal variance for two samples hypothesis test

math-mode

enter image description here

I have problem writing latex code for the attach. Number one is what I want to produce and but what can produce is Number two. Please how can I include the brackets to produce Number one. The picture of Number one is attached below .

Code for Number one is given below:
NUMBER ONE:

$df=\frac{\left(\frac{(s_{1}^{2}{n_1}}+\frac{s_{2}^{2}{n_2-1}}\right)}{{\frac{\frac{\left(s_{1}^{2}\right)^2}{n_1}}{n_1-1}+\frac{\frac{\left(s_{2}^{2}}{n_2}\right)^2{n_2-1}}}}$
but the are errors in this code.

Code for Number two are as following:
NUMBER TWO:

$df=\frac{\frac{s_{1}^{2}}{n_1}+\frac{s_{_2}^{2}}{n_2}}{\frac{\frac{s_{1}^{2}}{n_1}}{n_1-1}+\frac{\frac{s_{2}^{2}}{n_2}}{n_2-1}}$\\
but this is not what I want. I want to product Number one formula.

Thank you.

Best Answer

The picture can be reproduced as follows:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation*}
df=
\frac{
  \left(\dfrac{s_{1}^{2}}{n_1}+\dfrac{s_{2}^{2}}{n_2}\right)^{\!2}
}{
  \dfrac{(s_{1}^{2}/n^{}_1)^2}{n_1-1}+
  \dfrac{(s_{2}^{2}/n^{}_2)^2}{n_2-1}
}
\end{equation*}

\end{document}

Subtle points:

  • ^{\!2} will push the exponent a bit towards the large parenthesis;
  • empty superscripts ^{} make the subscripts to the n in the upper floor of the denominator align with those of s.

enter image description here

Related Question