# Variance

Variance is a measure of dispersion. It is equal to the average squared distance of the realizations of a random variable from its expected value.

## Definition

A formal definition of variance follows.

Definition Let be a random variable. Denote the expected value operator by . The variance of is provided the expected values in the formula exist.

## Understanding the definition

To better understand the definition of variance, we can break up its calculation in several steps:

1. compute the expected value of , denoted by

2. construct a new random variable equal to the deviation of from its expected value;

3. take the square which is a measure of distance of from its expected value (the further is from , the larger );

4. finally, compute the expectation of to know the average distance:

From these steps we can easily see that:

• variance is always positive because it is the expected value of a squared number;

• the variance of a constant variable (i.e., a variable that always takes on the same value) is zero; in this case, we have that , and ;

• the larger the distance is on average, the higher the variance.

## An equivalent definition

Variance can also be equivalently defined by the following important formula:

Proof

That this definition is equivalent to the one given above can be seen as follows:

This formula also makes clear that variance exists and is well-defined only as long as and exist and are well-defined.

We will use this formula very often and we will refer to it, for brevity's sake, as variance formula.

## Example

The following example shows how to compute the variance of a discrete random variable using both the definition and the variance formula above.

Example Let be a discrete random variable with support and probability mass functionwhere . Its expected value isThe expected value of its square isIts variance isAlternatively, we can compute the variance of using the definition. Define a new random variable, the squared deviation of from , asThe support of is and its probability mass function isThe variance of equals the expected value of :

The exercises at the bottom of this page provide more examples of how variance is computed.

## More details

The following subsections contain more details on variance.

### Variance and standard deviation

The square root of variance is called standard deviation. The standard deviation of a random variable is usually denoted by or by :

### Addition to a constant

Let be a constant and let be a random variable. Then,

Thanks to the fact that (by linearity of the expected value), we have

### Multiplication by a constant

Let be a constant and let be a random variable. Then,

Thanks to the fact that (by linearity of the expected value), we obtain

### Linear transformations

Let be two constants and let be a random variable. Then, combining the two properties above, one obtains

### Square integrability

If exists and is finite, we say that is a square integrable random variable, or just that is square integrable. It can easily be proved that, if is square integrable then is also integrable, that is, exists and is finite. Therefore, if is square integrable, then, obviously, also its variance exists and is finite.

## Solved exercises

Below you can find some exercises with explained solutions.

### Exercise 1

Let be a discrete random variable with support and probability mass functionCompute its variance.

Solution

The expected value of isThe expected value of isThe variance of is

### Exercise 2

Let be a discrete random variable with support and probability mass functionCompute its variance.

Solution

The expected value of isThe expected value of isThe variance of is

### Exercise 3

Read and try to understand how the variance of a Poisson random variable is derived in the lecture entitled Poisson distribution.

### Exercise 4

Let be a continuous random variable with support and probability density functionCompute its variance.

Solution

The expected value of isThe expected value of isThe variance of is

### Exercise 5

Let be a continuous random variable with support and probability density functionCompute its variance.

Solution

The expected value of isThe expected value of isThe variance of is

### Exercise 6

Read and try to understand how the variance of a Chi-square random variable is derived in the lecture entitled Chi-square distribution.
{"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": "https://www.statlect.com/fundamentals-of-probability/variance", "fetch_time": 1670200433000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2022-49/segments/1669446711001.28/warc/CC-MAIN-20221205000525-20221205030525-00825.warc.gz", "warc_record_offset": 1047025948, "warc_record_length": 13728, "token_count": 884, "char_count": 4419, "score": 4.65625, "int_score": 5, "crawl": "CC-MAIN-2022-49", "snapshot_type": "latest", "language": "en", "language_score": 0.9424285888671875, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00028-of-00064.parquet"}