Wikipedia:Reference desk/Archives/Mathematics/2011 January 27

= January 27 =

Combine Standard Deviations
I know you can combine weighted averages of non-overlapping subsets to find the average of the whole. Can you do the same to find the standard deviation of the whole? Say you had the average heights of all the boys in a class (n=30, average=60, sd=3) and all the girls in a class (n=20, average=50, sd=5). The average height of the class would be: (total height of girls + total height of boys)/(total number of students) = (50*20+60*30)/(20+30) = 56.

Can you do something similar to find the standard deviation of the whole class? 160.10.98.106 (talk) 18:21, 27 January 2011 (UTC)
 * You can, but it's a little more complicated:
 * $$\sigma=\sqrt{\frac{n_1(\sigma_1^2+\mu_1^2)+n_2(\sigma_2^2+\mu_2^2)}{n_1+n_2}-\mu^2}$$
 * I'll leave it as an exercise to show that this works (and to check that I didn't make a mistake). -- Meni Rosenfeld (talk) 19:16, 27 January 2011 (UTC)
 * It's actually pretty easy: write $$\nu:=\langle x^2\rangle=\mu^2+\sigma^2$$ (by the definition of variance). The overall $$\nu=p_1\nu_1+p_2\nu_2$$ just as $$\mu=p_1\mu_1+p_2\mu_2$$, where $$p_i:=n_i/n$$ is the "probability" for each group.  So we have $$\mu^2+\sigma^2=p_1(\mu_1^2+\sigma_1^2)+p_2(\mu_2^2+\sigma_2^2)$$ and your formula follows immediately.  --Tardis (talk) 20:58, 27 January 2011 (UTC)
 * This can be rewritten as
 * $$\sigma^2=p_1(\sigma_1^2+(\mu_1-\mu)^2)+p_2(\sigma_2^2+(\mu_2-\mu)^2)$$
 * which show how one has to add in a bit because the averages are different Dmcq (talk) 14:55, 28 January 2011 (UTC)