# Which formula for t-test is correct?

When Population variance is unknown and n<30 we use t-test.

x=sample mean, u=population mean, s=sample standard deviation,

In my book and on many online websites i found t-test formula to be t=(x-u)/(s/sqrt(n))

But also on some websites it is given that t=(x-u)/(s/sqrt(n-1))

So, which formula should i use for my exams. Any help about this!

It depends on your cacluation of $$s$$, your estimate of the standard deviation

If you calculate $$s=\sqrt{\frac1{n-1}\sum\limits_1^{n} \left(x_i-\bar{x}\right)^2}$$ then you should be using $$t=\dfrac{\bar{x}-\mu}{s / \sqrt{n} }$$

while if you calculate $$s=\sqrt{\frac1{n}\sum\limits_1^{n} \left(x_i-\bar{x}\right)^2}$$ then you should be using $$t=\dfrac{\bar{x}-\mu}{s / \sqrt{n-1} }$$

as they both end up as $$t=\dfrac{\frac1{n}\sum\limits_1^{n} x_i-\mu}{\sqrt{\frac{\sum\limits_1^{n} \left(x_i-\bar{x}\right)^2}{n(n-1)} }}$$

• Ok, i understand what you said, but what if values of s are already given in the question. – anmoloo7 May 4 '19 at 11:05
• @anmoloo7 If your book is using the first pair as its standard practice, then you should use the first pair to answer questions from the book. If your book is used on your course, you should also use this for the exams – Henry May 4 '19 at 13:04
• Very Very Thankyou – anmoloo7 May 12 '19 at 8:11