I was looking at an example of difference of two means test where $t$-statistic is calculated as follows: $$t=\frac{(\bar x_1-\bar x_2)-D}{\sqrt{\frac{s_1^2}{n_1}+\frac{s_2^2}{n_2}}}$$ and degrees of freedom for the $t$-distribution is obtained using following formula: $$v=\frac{\left(\frac{s_1^2}{n_1}+\frac{s_2^2}{n_2}\right)^2}{\frac{\left(s_1^2/n_1\right)^2}{n_1-1}+\frac{(s_2^2/n_2)^2}{n_2-1}}$$ My questions are:
1) What is degrees of freedom? (I've known it as the number of items that can be chosen freely.)
2) How the formula for $v$ has been derived?
I've found a reasonable answer to 2), by reading an article written by Michael Allwood, using following facts -
$$\chi_n^2=Z_1^2+Z_2^2+...+Z_n^2$$ $$t_n=\frac{N(0,1)}{\sqrt{\frac{\chi_n^2}{n}}}$$ $$E[\chi_n^2]=n\,\,\,\,\,\,\,var(\chi_n^2)=2n\,\,\,\,\,\,\,and\,\,\,\,\,\,\,var(aX)=a^2var(X)$$
In this case answer to 1), degrees of freedom, is just a multiplier and can be found using algebra and calculus.