Guozhen AIGlobal AI field notes and model intelligence

English translation

Define random variable X

Published:

Category: Probability for AI

Read time: 4 min

Reads: 0

Lesson #12Views are counted together with the original Chinese articleImages are preserved from the source page

Concept Map: Properties of Variance

Variance measures how much outcomes fluctuate around their expected value. Two models may share the same expectation, yet differ markedly in variance—leading to entirely different risk perceptions.

Variance Properties Checklist

I always examine both expectation and variance. Relying solely on average performance risks overlooking instability and volatility.

In the previous tutorial, we covered computing expectations and the expectation of squared deviations—laying the groundwork for understanding distributional characteristics of random variables. In this tutorial, we focus on the properties of variance, and how to leverage them to analyze the behavior of random variables. As a key measure of dispersion, variance—and its intrinsic properties—forms the foundation for grasping more advanced statistical concepts.

1. Definition of Variance

Variance is a statistical measure quantifying the spread or dispersion of values taken by a random variable. For a random variable XX, its variance is defined as:

Var(X)=E[(XE[X])2]\text{Var}(X) = E[(X - E[X])^2]

Here, E[X]E[X] denotes the expectation (or mean) of the random variable XX.

2. Fundamental Properties of Variance

Variance possesses several important properties—we introduce each below.

2.1 Non-negativity

Variance is always non-negative:

Var(X)0\text{Var}(X) \geq 0

This reflects the fact that values of a random variable always scatter around their mean—and the magnitude of that scattering cannot be negative. Because variance involves squaring deviations, all squared terms are inherently non-negative.

2.2 Variance Under Addition of a Constant

Adding a constant cc to a random variable XX yields a new random variable Y=X+cY = X + c, whose variance equals that of XX:

Var(Y)=Var(X)\text{Var}(Y) = \text{Var}(X)

This property states that shifting a distribution by a constant does not affect its dispersion.

Example

Suppose random variable XX takes values {1,2,3}\{1, 2, 3\}, with expectation E[X]=2E[X] = 2. Define Y=X+1Y = X + 1, so YY takes values {2,3,4}\{2, 3, 4\} and E[Y]=3E[Y] = 3. Compute variances:

  • For XX:
    Var(X)=E[(X2)2]=13[(12)2+(22)2+(32)2]=13(1+0+1)=23\text{Var}(X) = E[(X - 2)^2] = \frac{1}{3}\big[(1-2)^2 + (2-2)^2 + (3-2)^2\big] = \frac{1}{3}(1 + 0 + 1) = \frac{2}{3}

  • For YY:
    Var(Y)=E[(Y3)2]=13[(23)2+(33)2+(43)2]=13(1+0+1)=23\text{Var}(Y) = E[(Y - 3)^2] = \frac{1}{3}\big[(2-3)^2 + (3-3)^2 + (4-3)^2\big] = \frac{1}{3}(1 + 0 + 1) = \frac{2}{3}

  • Thus, Var(Y)=Var(X)\text{Var}(Y) = \text{Var}(X).

    2.3 Additivity of Variance (for Independent Variables)

    For two independent random variables XX and YY, the variance of their sum equals the sum of their variances:

    Variance Properties Decision Card

    When learning variance properties, first visualize: mean → deviations → squared deviations → average. Then distinguish effects of translation (shifting), scaling (stretching/shrinking), and summing independent variables.

    Var(X+Y)=Var(X)+Var(Y)\text{Var}(X + Y) = \text{Var}(X) + \text{Var}(Y)

    This means that when summing multiple independent random variables, the resulting variance is simply the sum of individual variances.

    Example

    Let XX and YY be independent random variables with:

    • Var(X)=1\text{Var}(X) = 1
    • Var(Y)=4\text{Var}(Y) = 4

    Then for Z=X+YZ = X + Y:

    Var(Z)=Var(X)+Var(Y)=1+4=5\text{Var}(Z) = \text{Var}(X) + \text{Var}(Y) = 1 + 4 = 5

    2.4 Variance Under Linear Transformation

    For a random variable XX and constants a,ba, b, the linear transformation Y=aX+bY = aX + b yields:

    Var(Y)=a2Var(X)\text{Var}(Y) = a^2 \cdot \text{Var}(X)

    That is, scaling XX by aa scales its variance by a2a^2; adding constant bb has no effect on variance.

    Sample Code

    Below is a Python example demonstrating how variance transforms under linear operations:

    import numpy as np
    
    # Define random variable X
    X = np.array([1, 2, 3])
    mu_X = np.mean(X)
    var_X = np.var(X)
    
    # Apply linear transformation Y = 2X + 3
    a = 2
    b = 3
    Y = a * X + b
    var_Y = np.var(Y)
    
    print(f"Variance of X: {var_X:.2f}")
    print(f"Variance of Y after linear transformation: {var_Y:.2f} (should equal {a**2} × {var_X:.2f})")
    

    2.5 Square Root of Variance: Standard Deviation

    The standard deviation (σ\sigma) is the square root of variance:

    Probability Reading Roadmap Card

    Don’t stop at “I understood” after reading AI-Ready Probability for Beginners: Properties of Variance. Go back, pick one step, implement it yourself—and note where you get stuck. This makes future learning more solid.

    σ=Var(X)\sigma = \sqrt{\text{Var}(X)}

    Because standard deviation shares the same units as the original data, it offers an intuitive, interpretable measure of dispersion—unlike variance, which is in squared units.

    AI-Ready Probability for Beginners: Variance Properties — Application Recap Card

    By now, organize AI-Ready Probability for Beginners: Properties of Variance into a concise recap table: clarify the core narrative first, then verify understanding with a small task.

    AI-Ready Probability for Beginners: Variance Properties — Application Check Card

    After finishing AI-Ready Probability for Beginners: Properties of Variance, try walking through a small concrete example end-to-end—and assess which steps you can now execute independently.

    3. Summary

    In this tutorial, we thoroughly examined key properties of variance: non-negativity, invariance under constant addition, additivity for independent variables, behavior under linear transformations, and its relationship to standard deviation. These properties form the bedrock for analyzing and applying random variables across statistics and machine learning. In the next tutorial, we’ll explore covariance and correlation—the natural extensions of variance for describing relationships among multiple random variables. We hope you’ll soon wield these variance properties with confidence!

    Continue

    Keep reading from here

    Browse English site

    Reader Messages

    Reader messages

    Questions, corrections, extra sources, or hands-on results can be left here. No login is required.

    Max 800 characters

    To reduce spam, each message is checked for length, link count, and posting frequency.

    0/800

    Messages

    0 messages
    Loading messages...