# Definition

When you are looking at a sequence of related numbers (for example, the price of a single stock over time, the height of all students in a classroom, or how many breakfasts you will get out of a box of a particular cereal), the “variance” is how far away the numbers get from the average. The higher the variance, the farther away most numbers are from the group’s average.

Consider two variables:

Both of these variables have an average of 10, but variable 2 has a lot more “variance” than variable one, since it is usually a lot farther away from that average.

# Technical Definition

The technical definition is as follows:

Consider the random variable X. The variance of X is defined as the estimated value of each element of X, minus the mean, squared.

Var(X) = E[(X – μ)^2]

where μ is the average of all the numbers you’re looking at.

To calculate this, imagine you have a set of 10 numbers:

 5 5 5 12 12 10 13 14 8 14

First, find the average of these 10. In this case, the average is 9.8.

Next, subtract 9.8 from each number in your set:

 -4.8 -4.8 -4.8 2.2 2.2 0.2 3.2 4.2 -1.8 4.2

This is how far each of these numbers are from the mean. Now you have to square each number:

 23.04 23.04 23.04 4.84 4.84 0.04 10.24 17.64 3.24 17.64

and the average of this set of numbers is your variance

Var(X) = 12.76

## Why Do I Take A Square, Then Average?

We already know that the average of this sample is 10, and we subtracted 10 from all the numbers. This means that as our sample size grows (if we were using the example of students in a classroom, imagine if we kept looking at bigger and bigger class sizes), if we don’t take a square, the X – μ will always be very close to 0, since we will have the same amount of numbers above and below 0.

By taking the square, we make sure that all of these “errors” are above 0, and we can compare the variance of many different kinds of samples.

# What Is Variance Used For?

Looking at differences in variance is the heart of all technical analysis; it is what stochastics is based on, along with every field in statistics. If you are looking to do any kind of analysis where there is any randomness to data, looking at variance is the only way to find valid conclusions.
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "http://education.howthemarketworks.com/glossary/variance/", "fetch_time": 1529694795000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2018-26/segments/1529267864776.82/warc/CC-MAIN-20180622182027-20180622202027-00187.warc.gz", "warc_record_offset": 100158162, "warc_record_length": 11214, "token_count": 598, "char_count": 2247, "score": 4.46875, "int_score": 4, "crawl": "CC-MAIN-2018-26", "snapshot_type": "latest", "language": "en", "language_score": 0.9234112501144409, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00028-of-00064.parquet"}