# Calculate largest possible standard deviation for a set

Given a set with a known cardinality, least upper and greatest lower bound; how can I calculate the maximum possible standard deviation for any set of values within the set.

As an example:

Given a set {1,50}, with mean of 25.5, the std. dev. for both members at 34.65. This std. dev. is the possible for a set with a cardinality of 2, greatest lower bound of 1, and least upper bound of 50.

Here are some examples I have calculated by hand:

F(2, 1, 50) = 34.65 (as above)

F(3, 1, 50) = 28.29

F(4, 1, 50) = 28.29

F(5, 1, 50) = 26.84

F(6, 1, 50) = 26.84

F(7, 1, 50) = 26.19

F(8, 1, 50) = 26.19

-
Are you allowed to repeat values? Does the set {1,1,50} have two or three elements? – Alex R. Dec 14 '10 at 20:16
Unless I am mistaken, the standard deviation should be greatest for a distribution which is bimodal: for your example, as many occurrences of 1 as of 50. If so, should this not simplify the calculation for you? Gerhard "Not Sure About His Statistics" Paseman, 2010.12.14 – Gerhard Paseman Dec 14 '10 at 20:19