# If I know the mean, standard deviation, and size of sample A and sample B, how do I compute the standard deviation of the union of samples A and B? What if samples A and B are of different sizes?

Sep 12, 2016

#### Explanation:

Let the mean, standard deviation and size of sample $A$ be ${\overline{X}}_{A}$, ${S}_{A}$ and ${n}_{A}$ respectively

and mean, standard deviation and size of sample $B$ be ${\overline{X}}_{B}$, ${S}_{B}$ and ${n}_{B}$ respectively.

Then mean of comibined sample $\overline{X}$ is given by

$\overline{X} = \frac{{n}_{A} {\overline{X}}_{A} + {n}_{B} {\overline{X}}_{B}}{{n}_{A} + {n}_{B}}$

and Standard Deviation of combined sample $S$ is

$S = \frac{{n}_{A} \left({S}_{A}^{2} + {\left({\overline{X}}_{A} - \overline{X}\right)}^{2}\right) + {n}_{B} \left({S}_{B}^{2} + {\left({\overline{X}}_{B} - \overline{X}\right)}^{2}\right)}{{n}_{A} + {n}_{B}}$

Note that it is important to work out mean of combined sample first, as to is used to calculate Standard Deviation of combined sample.

If the sample sizes are equal then the above reduces to

$\overline{X} = \frac{{\overline{X}}_{A} + {\overline{X}}_{B}}{2}$ and

$S = \frac{\left({S}_{A}^{2} + {\left({\overline{X}}_{A} - \overline{X}\right)}^{2}\right) + \left({S}_{B}^{2} + {\left({\overline{X}}_{B} - \overline{X}\right)}^{2}\right)}{2}$