<!doctypehtml><html lang=en><meta content="text/html; charset=utf-8"http-equiv=content-type><title>
   Standard Deviation Formulas
  </title><meta content="math, maths, mathematics, school, homework, education"name=keywords><meta content=width=device-width,initial-scale=1.0,user-scalable=yes name=viewport><meta content=true name=HandheldFriendly><meta content=always name=referrer><link as=font crossorigin href=../images/style/font-champ-bold.ttf rel=preload type=font/ttf><link as=style href=../style4.css rel=preload><link as=script href=../main4.js rel=preload><link href=../style4.css rel=stylesheet><script defer src=../main4.js></script><script async src=https://www.googletagmanager.com/gtag/js?id=UA-29771508-1></script><script>window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'UA-29771508-1');</script><body class=adv id=bodybg><div id=stt></div><div id=adTop></div><header><div id=hdr></div><div id=tran></div><div id=adHide></div><div id=cookOK></div></header><div class=mid><nav><div class=menu id=menuWide></div><div id=logo><a href=https://www.mathsisfun.com/> <img alt="Math is Fun Advanced"src=../images/style/logo-adv.svg> </a></div><div id=search role=search></div><div id=linkto></div><div class=menu id=menuSlim></div><div class=menu id=menuTiny></div></nav><div id=extra></div><article id=content role=main><h1 class=center>Standard Deviation Formulas</h1><p class=center><i> Deviation just means how far from the normal </i><h2><b> <a id=Top name=Top> </a> </b> Standard Deviation</h2><p>The Standard Deviation is a measure of <b> how spread out numbers are </b> .<p class=center>You might like to read <a href=standard-deviation.html> this simpler page on Standard Deviation </a> first.<p>But here we explain <b> the formulas </b> .<p>The symbol for Standard Deviation is <b class=larger> Ï </b> (the Greek letter sigma).<div class=def><p>This is the formula for Standard Deviation:<p class=center><img alt="square root of [ (1/N) times Sigma i=1 to N of (xi - mu)^2 ]"height=59 src=images/standard-deviation-formula.svg width=200></div><p class="larger center"><b> <i> Say what? </i> </b> Please explain!<p>OK. Let us explain it step by step.<p>Say we have a bunch of numbers like 9, 2, 5, 4, 12, 7, 8, 11.<p>To calculate the standard deviation of those numbers:<ul><div class=bigul><li>1. Work out the <a href=../mean.html> Mean </a> (the simple average of the numbers)<li>2. Then for each number: subtract the Mean and square the result<li>3. Then work out the mean of <b> those </b> squared differences.<li>4. Take the square root of that and we are done!</div></ul><p>The formula actually says all of that, and I will show you how.<h2>The Formula Explained</h2><p>First, let us have some example values to work on:<div class=example><p style="float:left; margin: 10px;"><img alt=rose height=111 src=images/rose.jpg width=130><h3>Example: Sam has 20 Rose Bushes.</h3><p>The number of flowers on each bush is<p class="center larger">9, 2, 5, 4, 12, 7, 8, 11, 9, 3, 7, 4, 12, 5, 4, 10, 9, 6, 9, 4<p>Work out the Standard Deviation.</div><h3> </h3><h3>Step 1. Work out the mean</h3><p>In the formula above <b> Î¼ </b> (the greek letter "mu") is the <a href=../mean.html> mean </a> of all our values ...<div class=example><h3>Example: 9, 2, 5, 4, 12, 7, 8, 11, 9, 3, 7, 4, 12, 5, 4, 10, 9, 6, 9, 4</h3><p>The mean is:<p class="center larger"><span class=intbl> <em> 9+2+5+4+12+7+8+11+9+3+7+4+12+5+4+10+9+6+9+4 </em> <strong> 20 </strong> </span><p class="center larger">= <span class=intbl> <em> 140 </em> <strong> 20 </strong> </span> = <b> 7 </b><p class=center>And so <b> Î¼ = 7 </b></div><p> <h3>Step 2. Then for each number: subtract the Mean and square the result</h3><p>This is the part of the formula that says:<p class="center larger"><img alt="(xi - mu)^2"height=32 src=images/standard-deviation-part1.svg width=75><p>So what is <span class=times> <i> x <sub> i </sub> </i> </span> ? They are the individual x values 9, 2, 5, 4, 12, 7, etc...<p>In other words <span class=times> <i> x <sub> 1 </sub> </i> </span> = 9, <span class=times> <i> x <sub> 2 </sub> </i> </span> = 2, <span class=times> <i> x <sub> 3 </sub> </i> </span> = 5, etc.<p>So it says "for each value, subtract the mean and square the result", like this<div class=example><h3>Example (continued):</h3><p>(9 - 7) <sup> 2 </sup> = (2) <sup> 2 </sup> = <b> 4 </b><p>(2 - 7) <sup> 2 </sup> = (-5) <sup> 2 </sup> = <b> 25 </b><p>(5 - 7) <sup> 2 </sup> = (-2) <sup> 2 </sup> = <b> 4 </b><p>(4 - 7) <sup> 2 </sup> = (-3) <sup> 2 </sup> = <b> 9 </b><p>(12 - 7) <sup> 2 </sup> = (5) <sup> 2 </sup> = <b> 25 </b><p>(7 - 7) <sup> 2 </sup> = (0) <sup> 2 </sup> = <b> 0 </b><p>(8 - 7) <sup> 2 </sup> = (1) <sup> 2 </sup> = <b> 1 </b><p>... etc ...<p>And we get these results:<p class="center larger">4, 25, 4, 9, 25, 0, 1, 16, 4, 16, 0, 9, 25, 4, 9, 9, 4, 1, 4, 9</div><p> <h3>Step 3. Then work out the mean of those squared differences.</h3><p>To work out the mean, <b> add up all the values </b> then <b> divide by how many </b> .<p>First add up all the values from the previous step.<p>But how do we say "add them all up" in mathematics? We use "Sigma": <span class=times> Î£ </span><div class=center80><p>The handy <a href=../algebra/sigma-notation.html> Sigma Notation </a> says to sum up as many terms as we want:<p class=center><img alt="Sigma Notation"height=118 src=../algebra/images/sigma-notation.svg style=max-width:100% width=451> <br> Sigma Notation</div><p>We want to add up all the values from 1 to N, where N=20 in our case because there are 20 values:<div class=example><h3>Example (continued):</h3><p class=center><img alt="sigma i=1 to N of (xi - mu)^2"height=51 src=images/standard-deviation-part2.svg width=103><p class=center>Which means: Sum all values from (x <sub> 1 </sub> -7) <sup> 2 </sup> to (x <sub> N </sub> -7) <sup> 2 </sup><p align=left> <p align=left>We already calculated (x <sub> 1 </sub> -7) <sup> 2 </sup> =4 etc. in the previous step, so just sum them up:<p class="center larger">= 4+25+4+9+25+0+1+16+4+16+0+9+25+4+9+9+4+1+4+9 = <b> 178 </b></div><p>But that isn't the mean yet, we need to <b> divide by how many </b> , which is done by <b> multiplying by 1/N </b> (the same as dividing by N):<div class=example><h3>Example (continued):</h3><p class=center><img alt="(1/N) times sigma i=1 to N of (xi - mu)^2"height=51 src=images/standard-deviation-part3.svg width=133><p class="center larger">Mean of squared differences = (1/20) Ã 178 = <b> 8.9 </b><p class=center>(Note: this value is called the "Variance")</div><p> <h3>Step 4. Take the square root of that:</h3><div class=example><h3>Example (concluded):</h3><p class=center><img alt="square root of [ (1/N) times Sigma i=1 to N of (xi - mu)^2 ]"height=59 src=../data/images/standard-deviation-formula.svg width=200><p class="center larger">Ï = â(8.9) = <b> 2.983... </b></div><p>DONE!<p> <h2>Sample Standard Deviation</h2><p>But wait, there is more ...<p class=center>... sometimes our data is only a <b> sample </b> of the whole population.<div class=example><p style="float:left; margin: 10px;"><img alt=rose height=111 src=images/rose.jpg width=130><h3>Example: Sam has <b> 20 </b> rose bushes, but only counted the flowers on <b> 6 of them </b> !</h3><p>The "population" is all 20 rose bushes,<p>and the "sample" is the 6 bushes that Sam counted the flowers of.<p>Let us say Sam's flower counts are:<p class="center large">9, 2, 5, 4, 12, 7</div><p>We can still <b> estimate </b> the Standard Deviation.<p>But when we use the sample as an <b> estimate of the whole population </b> , the Standard Deviation formula changes to this:<div class=def><p>The formula for <b> Sample Standard Deviation </b> :<p class=center><img alt="square root of [ (1/(N-1)) times Sigma i=1 to N of (xi - xbar)^2 ]"height=58 src=images/standard-deviation-sample.svg width=210></div><p class="center larger">The important change is <b> "N-1" instead of "N" </b> (which is called "Bessel's correction").<div class=center80><p>The symbols also change to reflect that we are working on a sample instead of the whole population:<ul><li>The mean is now <span class=times style=text-decoration:overline> x </span> (called "x-bar") for <b> sample mean </b> , instead of <b> Î¼ </b> for the population mean,<li>And the answer is <b> s </b> (for sample standard deviation) instead of <b> Ï </b> .</ul><p>But they do not affect the calculations. <b> Only N-1 instead of N changes the calculations. </b></div><p> <p>OK, let us now use the <b> Sample Standard Deviation </b> :<h3>Step 1. Work out the mean</h3><div class=example><h3>Example 2: Using sampled values 9, 2, 5, 4, 12, 7</h3><p>The mean is (9+2+5+4+12+7) / 6 = 39/6 = 6.5<p>So:<p class=center><span class=times style=text-decoration:overline> x </span> = 6.5</div><p> <h3>Step 2. Then for each number: subtract the Mean and square the result</h3><div class=example><h3>Example 2 (continued):</h3><p>(9 - 6.5) <sup> 2 </sup> = (2.5) <sup> 2 </sup> = 6.25<p>(2 - 6.5) <sup> 2 </sup> = (-4.5) <sup> 2 </sup> = 20.25<p>(5 - 6.5) <sup> 2 </sup> = (-1.5) <sup> 2 </sup> = 2.25<p>(4 - 6.5) <sup> 2 </sup> = (-2.5) <sup> 2 </sup> = 6.25<p>(12 - 6.5) <sup> 2 </sup> = (5.5) <sup> 2 </sup> = 30.25<p>(7 - 6.5) <sup> 2 </sup> = (0.5) <sup> 2 </sup> = 0.25</div><p> <h3>Step 3. Then work out the mean of those squared differences.</h3><p>To work out the mean, <b> add up all the values </b> then <b> divide by how many </b> .<p>But hang on ... we are calculating the <b> Sample </b> Standard Deviation, so instead of dividing by how many (N), we will divide by <b> N-1 </b><div class=example><h3>Example 2 (continued):</h3><p class="center large">Sum = 6.25 + 20.25 + 2.25 + 6.25 + 30.25 + 0.25 = <b> 65.5 </b><p class="center large">Divide by <b> N-1 </b> : (1/5) Ã 65.5 = <b> 13.1 </b><p class=center>(This value is called the "Sample Variance")</div><p> <h3>Step 4. Take the square root of that:</h3><div class=example><h3>Example 2 (concluded):</h3><p class=center><img alt="square root of [ (1/(N-1)) times Sigma i=1 to N of (xi - xbar)^2 ]"height=58 src=images/standard-deviation-sample.svg width=210><p class="center larger">s = â(13.1) = <b> 3.619... </b></div><p>DONE!<h2>Comparing</h2><p>Using the whole <b> population </b> we got: Mean = <b> 7 </b> , Standard Deviation = <b> 2.983... </b><p>Using the <b> sample </b> we got: Sample Mean = <b> 6.5 </b> , Sample Standard Deviation = <b> 3.619... </b><p>Our Sample Mean was wrong by 7%, and our Sample Standard Deviation was wrong by 21%.<h2>Why Take a Sample?</h2><p>Mostly because it is easier and cheaper.<div class=example><p>Imagine you want to know what the whole country thinks ... you can't ask millions of people, so instead you ask maybe 1,000 people.</div><p>There is a nice quote (possibly by Samuel Johnson):<p class=center><i> "You don't have to eat the whole animal to know that the meat is tough."  </i><p>This is the essential idea of sampling. To find out information about the population (such as mean and standard deviation), we do not need to look at <b> all </b> members of the population; we only need a sample.  <p>But when we take a sample, we lose some accuracy.<p>Have a play with this at <a href=normal-distribution-simulator.html> Normal Distribution Simulator </a> .<p> <h2>Summary</h2><table style="border: 0; margin:auto;"><tbody><tr><td style=text-align:right;><p>The <b> Population </b> Standard Deviation:</p><td style=text-align:right;> <td><img alt="square root of [ (1/N) times Sigma i=1 to N of (xi - mu)^2 ]"height=59 src=images/standard-deviation-formula.svg width=200><tr><td style=text-align:right;>The <b> Sample </b> Standard Deviation:<td style=text-align:right;> <td><img alt="square root of [ (1/(N-1)) times Sigma i=1 to N of (xi - xbar)^2 ]"height=58 src=images/standard-deviation-sample.svg width=210></table><p> <div class=questions>699, 1472, 1473, 1474</div><div class=related><a href=../mean.html> Mean </a><a href=../accuracy-precision.html> Accuracy and Precision </a><a href=standard-deviation-calculator.html> Standard Deviation Calculator </a><a href=index.html> Probability and Statistics </a></div></article><div class="centerfull noprint"id=adend></div><footer class="centerfull noprint"id=footer></footer><div id=copyrt>Copyright Â© 2021 MathsIsFun.com</div></div>