In probability theory, the conditional expectation, conditional expected value, or conditional mean of a random variable is its expected value – the value it would take “on average” over an arbitrarily large number of occurrences – given that a certain set of "conditions" is known to occur. If the random variable can take on only a finite number of values, the “conditions” are that the variable can only take on a subset of those values. More formally, in the case when the random variable is defined over a discrete probability space, the "conditions" are a partition of this probability space.
Depending on the context, the conditional expectation can be either a random variable or a function. The random variable is denoted
E
(
X
∣
Y
)
{\displaystyle E(X\mid Y)}
analogously to conditional probability. The function form is either denoted
E
(
X
∣
Y
=
y
)
{\displaystyle E(X\mid Y=y)}
or a separate function symbol such as
f
(
y
)
{\displaystyle f(y)}
is introduced with the meaning