# Conditional variance

**Conditional variance** is the variance of a random variable computed under a conditional distribution, that is, the spread of one random variable around its conditional mean once the value of another random variable (or, more generally, some information) is known. For a square-integrable random variable \( X \) and a conditioning variable \( Y \), it is written \( \mathrm{Var}(X \mid Y) \) and is itself a random variable: it takes the value \( \mathrm{Var}(X \mid Y=y) \) whenever \( Y=y \).<sup>[1](https://www.probabilitycourse.com/chapter5/5_1_5_conditional_expectation.php)</sup>

| Key fact | Detail |
|---|---|
| Definition | \( \mathrm{Var}(X \mid Y) = \mathrm{E}[(X - \mathrm{E}[X \mid Y])^2 \mid Y] = \mathrm{E}[X^2 \mid Y] - (\mathrm{E}[X \mid Y])^2 \)<sup>[2](https://people.math.harvard.edu/~knill/books/KnillProbability.pdf)</sup> |
| Discrete case | \( \sigma^2_{Y\mid x} = \sum_y [y - \mu_{Y\mid x}]^2\, h(y\mid x) \), the ordinary variance formula with the conditional probability mass function replacing the marginal one<sup>[3](https://online.stat.psu.edu/stat414/Lesson19)</sup> |
| Law of total variance | \( \mathrm{Var}(X) = \mathrm{E}[\mathrm{Var}(X \mid Y)] + \mathrm{Var}(\mathrm{E}[X \mid Y]) \), also called the conditional variance formula<sup>[4](https://statproofbook.github.io/P/var-tot.html)</sup> |
| Variance reduction | All terms in the decomposition are nonnegative, so \( \mathrm{Var}(X) \ge \mathrm{E}[\mathrm{Var}(X \mid Y)] \): conditioning reduces variance on average<sup>[1](https://www.probabilitycourse.com/chapter5/5_1_5_conditional_expectation.php)</sup> |
| Additivity | If \( X \) and \( Z \) are independent random variables in \( L^2 \), then \( \mathrm{Var}[X+Z \mid Y] = \mathrm{Var}[X \mid Y] + \mathrm{Var}[Z \mid Y] \) need not hold; in general, \( \mathrm{Var}(X+Z \mid Y) = \mathrm{Var}(X \mid Y) + \mathrm{Var}(Z \mid Y) + 2\mathrm{Cov}(X, Z \mid Y) \), so independence of \( X \) and \( Z \) alone does not ensure the conditional covariance is zero<sup>[2](https://people.math.harvard.edu/~knill/books/KnillProbability.pdf)</sup><sup> • </sup><sup>[13](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/04:_Expected_Value/4.07:_Conditional_Expected_Value)</sup> |
| Geometric meaning | For \( X \in L^2 \), \( \mathrm{E}[X \mid \mathcal{G}] \) is the orthogonal projection of \( X \) onto the subspace of \( \mathcal{G} \)-measurable random variables, and the conditional variance is the squared distance from \( X \) to that projection<sup>[5](https://tropp.caltech.edu/notes/Tro24-Probability-Theory-LN.pdf)</sup> |

## Definition

For discrete random variables \( X \) and \( Y \), the conditional variance of \( Y \) given \( X=x \) is defined with the conditional [probability mass function](https://www.edgepedia.org/probability-mass-function) \( h(y\mid x) \) in place of the marginal one:<sup>[3](https://online.stat.psu.edu/stat414/Lesson19)</sup>

\[ \sigma^2_{Y\mid x} = \mathrm{E}\{[Y - \mu_{Y\mid x}]^2 \mid x\} = \sum_y [y - \mu_{Y\mid x}]^2\, h(y\mid x), \]

where \( \mu_{Y\mid x} = \mathrm{E}[Y \mid x] \). The usual shortcut formula carries over unchanged:

\[ \sigma^2_{Y\mid x} = \mathrm{E}[Y^2 \mid x] - \mu_{Y\mid x}^2. \]<sup>[3](https://online.stat.psu.edu/stat414/Lesson19)</sup>

In the general measure-theoretic setting, for \( X \in L^2 \) and an arbitrary random variable \( Y \), the conditional variance is defined through the conditional expectation:<sup>[2](https://people.math.harvard.edu/~knill/books/KnillProbability.pdf)</sup>

\[ \mathrm{Var}[X \mid Y] = \mathrm{E}\big[(X - \mathrm{E}[X \mid Y])^2 \,\big|\, Y\big]. \]

Because \( \mathrm{E}[X \mid Y] \) is a random variable (a function of \( Y \)), so is the conditional variance. If \( Y \) takes values \( y_1, y_2, \ldots \), then \( \mathrm{Var}(X \mid Y) \) equals \( \mathrm{Var}(X \mid Y=y_j) \) with probability \( P(Y=y_j) \), and it has its own distribution, mean, and variance.<sup>[1](https://www.probabilitycourse.com/chapter5/5_1_5_conditional_expectation.php)</sup> [Conditional expectation](https://www.edgepedia.org/conditional-expectation) itself is defined with respect to a sigma-algebra \( \mathcal{G} \), the collection of events whose occurrence is already determined by the available information; conditioning on a random variable \( Y \) means conditioning on the sigma-algebra it generates.<sup>[5](https://tropp.caltech.edu/notes/Tro24-Probability-Theory-LN.pdf)</sup>

## The law of total variance

The central result connecting conditional and unconditional variance is the law of total variance, also called the conditional variance formula. For random variables \( X \) and \( Y \) on the same probability space with \( \mathrm{Var}(X) \) finite,<sup>[4](https://statproofbook.github.io/P/var-tot.html)</sup>

\[ \mathrm{Var}(X) = \mathrm{E}\big[\mathrm{Var}(X \mid Y)\big] + \mathrm{Var}\big(\mathrm{E}[X \mid Y]\big). \]

The proof uses only the definition of variance and the [law of total expectation](https://www.edgepedia.org/law-of-total-expectation) (the tower property \( \mathrm{E}[X] = \mathrm{E}[\mathrm{E}[X \mid Y]] \)). Writing \( Z = \mathrm{E}[X \mid Y] \), one has \( \mathrm{E}[\mathrm{Var}(X \mid Y)] = \mathrm{E}[X^2] - \mathrm{E}[Z^2] \) and \( \mathrm{Var}(Z) = \mathrm{E}[Z^2] - (\mathrm{E}[X])^2 \); adding the two identities gives the result.<sup>[1](https://www.probabilitycourse.com/chapter5/5_1_5_conditional_expectation.php)</sup><sup> • </sup><sup>[6](https://faculty.washington.edu/yenchic/20A_stat512/Lec4_conditional.html)</sup>

The two terms have a direct interpretation when a population is divided into groups. Suppose \( X \) is the height of a person chosen at random and \( Y \) indexes the person's country. Then \( \mathrm{E}[\mathrm{Var}(X \mid Y)] \) is the average of the height variances within each country, and \( \mathrm{Var}(\mathrm{E}[X \mid Y]) \) is the variance between the country mean heights. Total variability splits into within-group and between-group parts.<sup>[1](https://www.probabilitycourse.com/chapter5/5_1_5_conditional_expectation.php)</sup> In econometrics the same decomposition is described as the within-group and across-group variance; if \( X \) is education level, the first term is the expected conditional variance within education levels and the second is the variance of the education-level means.<sup>[7](https://www.huhuaping.com/projects/hansenEM/chapters_eng/chpt02-ce.html)</sup>

Because variances are nonnegative, the law implies \( \mathrm{Var}(X) \ge \mathrm{E}[\mathrm{Var}(X \mid Y)] \): on average, knowing \( Y \) reduces uncertainty about \( X \). The gap between the two sides, \( \mathrm{Var}(\mathrm{E}[X \mid Y]) \), measures how much of the variability the conditioning variable explains through shifts in the conditional mean.<sup>[1](https://www.probabilitycourse.com/chapter5/5_1_5_conditional_expectation.php)</sup>

## Properties

Since conditional expectation is a projection, the conditional variance inherits the properties of the ordinary variance. For \( X \) and \( Z \) independent random variables in \( L^2 \), the identity \( \mathrm{Var}[X+Z \mid Y] = \mathrm{Var}[X \mid Y] + \mathrm{Var}[Z \mid Y] \) holds exactly when the conditional covariance \( \mathrm{Cov}[X,Z \mid Y] \) vanishes, since in general the difference equals twice that covariance; independence of \( X \) and \( Z \) alone does not guarantee this.<sup>[2](https://people.math.harvard.edu/~knill/books/KnillProbability.pdf)</sup><sup> • </sup><sup>[13](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/04:_Expected_Value/4.07:_Conditional_Expected_Value)</sup> If \( X \) and \( Y \) are independent, the conditional distribution of \( X \) given \( Y \) equals the marginal distribution, so \( \mathrm{E}[X \mid Y] = \mathrm{E}[X] \) and \( \mathrm{Var}(X \mid Y) = \mathrm{Var}(X) \); conditioning on an independent variable removes nothing.<sup>[1](https://www.probabilitycourse.com/chapter5/5_1_5_conditional_expectation.php)</sup>

The projection viewpoint makes the geometry explicit. For \( X \in L^2 \), \( \mathrm{E}[X \mid \mathcal{G}] \) is the orthogonal projection of \( X \) onto the closed subspace of \( \mathcal{G} \)-measurable random variables, and it is the unique minimizer of \( \mathrm{E}[(X - Z)^2] \) over such \( Z \).<sup>[5](https://tropp.caltech.edu/notes/Tro24-Probability-Theory-LN.pdf)</sup> The conditional variance \( \mathrm{E}[\mathrm{Var}(X \mid \mathcal{G})] \) is then the mean squared distance left after this best approximation, which is why \( \mathrm{E}[X \mid Y] \) is described as the best predictor of \( X \) as a function of \( Y \).<sup>[8](https://arxiv.org/abs/2210.02859)</sup>

## Uses in statistics and econometrics

**Regression.** In a regression with conditional mean function \( m(X) \) and error \( e \) satisfying \( \mathrm{E}[e \mid X] = 0 \), the unconditional error variance equals the average conditional variance, \( \sigma^2 = \mathrm{E}[\sigma^2(X)] \). Writing \( \sigma(X) \) for the conditional standard deviation gives the mean-variance representation \( Y = m(X) + \sigma(X)u \), where the rescaled error \( u = e/\sigma(X) \) has conditional mean zero and conditional variance one.<sup>[7](https://www.huhuaping.com/projects/hansenEM/chapters_eng/chpt02-ce.html)</sup>

**Trees and ANOVA.** A regression tree's prediction at a leaf is the conditional expectation \( \mathrm{E}[Y \mid X \in \text{region}] \), and the variance reduction used to choose a split applies the law of total variance, decomposing total variance into within-leaf and between-leaf parts.<sup>[9](https://mindspaneducation.com/learn/probability-and-statistics/conditional-expectation/)</sup> [Analysis of variance](https://www.edgepedia.org/analysis-of-variance) uses the same partition in sample form: the total sum of squares splits exactly into within-group and between-group sums of squares, because within-group deviations sum to zero in each group so the cross-term cancels.<sup>[10](https://courses.washington.edu/psy524a/_book/anova-part-2-partitioning-sums-of-squares.html)</sup>

**Volatility modeling.** In financial time series, ARCH and GARCH models specify an explicit conditional variance equation for each period, so the variance itself evolves over time as a function of past information. Value-at-Risk forecasts from a [GARCH model](https://www.edgepedia.org/garch-model) combine the conditional mean, the conditional volatility, and a quantile of the standardized residuals.<sup>[11](https://arch.readthedocs.io/en/stable/univariate/univariate_volatility_forecasting.html)</sup>

**Checking approximate inference.** The law of total variance also serves as a diagnostic: it relates prior and posterior means and covariances exactly, so an approximate inference algorithm can be assessed, and adjusted, by checking whether the required relationships hold.<sup>[12](https://arxiv.org/abs/1911.08725)</sup>

## References

1. [Conditional Expectation (Revisited) and Conditional Variance, ProbabilityCourse.com](https://www.probabilitycourse.com/chapter5/5_1_5_conditional_expectation.php)
2. [O. Knill, Probability Theory and Stochastic Processes, Chapter 3.1: Conditional Expectation](https://people.math.harvard.edu/~knill/books/KnillProbability.pdf)
3. [STAT 414, Lesson 19: Conditional Distributions, Penn State Eberly College of Science](https://online.stat.psu.edu/stat414/Lesson19)
4. [Law of Total Variance, The Book of Statistical Proofs](https://statproofbook.github.io/P/var-tot.html)
5. [J. A. Tropp, Probability Theory & Stochastic Processes, Caltech CMS 117 Lecture Notes, Lecture 19](https://tropp.caltech.edu/notes/Tro24-Probability-Theory-LN.pdf)
6. [STAT 512 Lecture 4: Conditional expectation and conditional distribution, University of Washington](https://faculty.washington.edu/yenchic/20A_stat512/Lec4_conditional.html)
7. [B. Hansen, Econometrics, Chapter 2: Conditional Expectation and Projection](https://www.huhuaping.com/projects/hansenEM/chapters_eng/chpt02-ce.html)
8. [On the new properties of conditional expectations with applications in finance, arXiv:2210.02859](https://arxiv.org/abs/2210.02859)
9. [Conditional Expectation & Variance, MindSpan Education GATE notes](https://mindspaneducation.com/learn/probability-and-statistics/conditional-expectation/)
10. [Chapter 17: ANOVA Part 2, Partitioning Sums of Squares, University of Washington](https://courses.washington.edu/psy524a/_book/anova-part-2-partitioning-sums-of-squares.html)
11. [Volatility Forecasting, arch 7.2.0 documentation](https://arch.readthedocs.io/en/stable/univariate/univariate_volatility_forecasting.html)
12. [Assessment and adjustment of approximate inference algorithms using the law of total variance, arXiv:1911.08725](https://arxiv.org/abs/1911.08725)
13. [4.7: Conditional Expected Value](https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/04:_Expected_Value/4.07:_Conditional_Expected_Value)

---
*Topic: Encyclopedia › Physical world and mathematics › Mathematics and statistics › Statistics and probability › Probability theory › Random variables › Algebra and transformations of random variables › Conditional expectation and conditional random variables*

*Initially written Sep 17, 2026 · Reviewed: Sep 17, 2026; Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

*Copyright 2026 EdgeChat AI, a subsidiary of Biostate AI.*

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license
