Statistics and uncertainty
Standard deviation - formula in LaTeX
A measure of how far the results scatter around the mean. Dividing by n − 1 rather than n is the correction used when you have a sample, not the whole population. The root stretches over the whole expression by itself, as long as it sits inside \sqrt{...}.
LaTeX code
$$
s = \sqrt{\dfrac{1}{n-1}\sum_{i=1}^{n}(x_i-\bar{x})^2}
$$Working this out from your own measurements? The calculator gives the result with its uncertainty and ready LaTeX, no account needed. Type A, type B and expanded uncertainty calculator
What the symbols mean
- standard deviation of a single measurement
- number of measurements
- result of the i-th measurement
- arithmetic mean
Worked example
Three readings: 1, 3 and 5, with a mean of 3. The squared deviations add up to 8, divided by n − 1 = 2. The fraction under the root uses \dfrac so it does not shrink to subscript size.
Result: s = 2
Try it with your own values
Edit the code and the preview updates as you type.
Common mistakes
- Wrong
s = \dfrac{8}{2} = 4Rights = \sqrt{\dfrac{8}{2}} = 2The sum of squared deviations divided by n − 1 is the variance s². The standard deviation has the unit of the measurement, so you still need the square root.
- Wrong
s = \sqrt{\dfrac{1}{n-1}}\sum (x_i-\bar{x})^2Rights = \sqrt{\dfrac{1}{n-1}\sum_{i=1}^{n}(x_i-\bar{x})^2}The square root brace closes after the whole sum. Closed right after the fraction, it leaves the sum outside the root and changes the formula.
Other ways to write it
Population standard deviation: divide by N, and the mean is written μ.
\sigma = \sqrt{\dfrac{1}{N}\sum_{i=1}^{N}(x_i-\mu)^2}Sample variance, the same expression without the root.
s^2 = \dfrac{1}{n-1}\sum_{i=1}^{n}(x_i-\bar{x})^2Standard deviation of the mean (standard error); a subscript with a bar needs braces.
s_{\bar{x}} = \dfrac{s}{\sqrt{n}}
LaTeX commands in this formula
\sqrt- square root
\dfrac- fraction (display)
\sum- sum
x_{0}- subscript; wrap several characters in braces
x^{2}- superscript (power); wrap several characters in braces
\bar- bar over a symbol (e.g. a mean)
How to use this formula in LaTeX?
- Copy the code with the button above:
$$…$$is centered display math in the CamteX editor and in Markdown; in a .tex file use\[…\]. - Paste it into the CamteX editor, Overleaf or any LaTeX document.
- Inside a sentence, use single
$…$instead of double. - The formula needs the
amsmathpackage - CamteX templates include it in the preamble.
Related formulas - Statistics and uncertainty
Drawing formulas is faster than typing them.
Draw a formula, table or chart - CamteX AI turns it into ready LaTeX and inserts it into your document.