# Getting confused over a T-test

its been a while since I've done this and I am getting rather confused.

Let's say I have two data sets of size $n_1$ and $n_2$

$X={X_1, X_2,.. X_{n_1}}$

$Y={Y_1, Y_2,.. Y_{n_2}}$

and want to construct a t-test. I have seen this formula in lots of books, what is the intuition and is this correct for finding a t-test?

$T=\dfrac{\bar{X}-\bar{Y}}{\sqrt{\dfrac{s_1^2}{n_1}+\dfrac{s_2^2}{n_2}}}$

I am getting confused a little, I see some books telling me to be careful is my variances are equal. Can i not just put them into this formula either way?

Also are we always referring to sample population, mean and standard deviation. How does the formula change if we have a the population data?

How does this formula change if the data is paired?

Thank you all very much :)

Your formula is for Welch's $t$-test with possibly different variances and a complicated estimate of the number of degrees of freedom. But if you assume that the variances are equal, then $\dfrac{s_1^2}{n_1}+\dfrac{s_2^2}{n_2}$ is not the best estimate of that variance, leading to a different formula.
With a paired $t$-test, you are not testing two different samples from the populations, but one sample of the differences between the pairs. So you again get different formulae.
If you have the population variances or standard deviations but only sample means, this stops being a $t$-test, but instead becomes a test using the normal distribution (assuming that is the underlying distribution, though you are making that assumption for the $t$-test too).