I know that I can compute t-statistic as following.
for one-sample T-Test:
$$t = \frac{E(x) - \mu}{\sigma / \sqrt{(n)}}$$
for independent sample T-Test:
$$t =\frac{E(x_1) - E(x_2)}{\sqrt{\sigma_1 / (n_1) + \sigma_2 / (n_2)}}$$
But I can't understand how we obtain denominators for both equations.
The only source I found is here but it is not clear enough, at least for me. https://www.math.arizona.edu/~jwatkins/ttest.pdf
Could you explain how we can derive these equations?
Also, there is this answer but it does not explain much. Denominator in t Test formula for 2 independent samples
It is still not clear how we got this expression there:
$$\operatorname{var}(\bar X-\bar Y)=\operatorname{var}(\bar X)+\operatorname{var}(\bar Y)=\frac{\sigma_x^2}{n}+\frac{\sigma_y^2}{m}\approx \frac{S_x^2}{n}+\frac{S_y^2}{m}$$