Probability theory term
Beliefs depend on the available information. This idea is formalized in probability theory by conditioning. Conditional probabilities, conditional expectations, and conditional probability distributions are treated on three levels: discrete probabilities, probability density functions, and measure theory. Conditioning leads to a non-random result if the condition is completely specified; otherwise, if the condition is left random, the result of conditioning is also random.
 ;templatestyles src="Template:TOC limit/styles.css" / ;
Conditioning on the discrete level.
Example: A fair coin is tossed 10 times; the random variable "X" is the number of heads in these 10 tosses, and "Y" is the number of heads in the first 3 tosses. In spite of the fact that "Y" emerges before "X" it may happen that someone knows "X" but not "Y".
Conditional probability.
Given that "X" = 1, the conditional probability of the event "Y" = 0 is
 formula_1
More generally,
 formula_2
One may also treat the conditional probability as a random variable, — a function of the random variable "X", namely,
 formula_3
The expectation of this random variable is equal to the (unconditional) probability,
 formula_4
namely,
 formula_5
which is an instance of the law of total probability formula_6
Thus, formula_7 may be treated as the value of the random variable formula_8 corresponding to "X" = 1. On the other hand, formula_7 is well-defined irrespective of other possible values of "X".
Conditional expectation.
Given that "X" = 1, the conditional expectation of the random variable "Y" is formula_10 More generally,
 formula_11
(In this example it appears to be a linear function, but in general it is nonlinear.) One may also treat the conditional expectation as a random variable, — a function of the random variable "X", namely,
 formula_12
The expectation of this random variable is equal to the (unconditional) expectation of "Y",
 formula_13
namely,
 formula_14
or simply
formula_15
which is an instance of the law of total expectation formula_16
The random variable formula_17 is the best predictor of "Y" given "X". That is, it minimizes the mean square error formula_18 on the class of all random variables of the form "f"("X"). This class of random variables remains intact if "X" is replaced, say, with 2"X". Thus, formula_19 It does not mean that formula_20 rather, formula_21 In particular, formula_22 More generally, formula_23 for every function "g" that is one-to-one on the set of all possible values of "X". The values of "X" are irrelevant; what matters is the partition (denote it α"X")
 formula_24
of the sample space Ω into disjoint sets {"X" = "xn"}. (Here formula_25 are all possible values of "X".) Given an arbitrary partition α of Ω, one may define the random variable E ( "Y" | α ). Still, E ( E ( "Y" | α)) = E ( "Y" ).
Conditional probability may be treated as a special case of conditional expectation. Namely, P ( "A" | "X" ) = E ( "Y" | "X" ) if "Y" is the indicator of "A". Therefore the conditional probability also depends on the partition α"X" generated by "X" rather than on "X" itself; P ( "A" | "g"("X") ) = P ("A" | "X") = P ("A" | α), α = α"X" = α"g"("X").
On the other hand, conditioning on an event "B" is well-defined, provided that formula_26 irrespective of any partition that may contain "B" as one of several parts.
Conditional distribution.
Given "X" = x, the conditional distribution of "Y" is
 formula_27
for 0 ≤ "y" ≤ min ( 3, "x" ). It is the hypergeometric distribution H ( "x"; 3, 7 ), or equivalently, H ( 3; "x", 10-"x" ). The corresponding expectation 0.3 "x", obtained from the general formula
formula_28
for H ( "n"; "R", "W" ), is nothing but the conditional expectation E ("Y" | "X" = "x") = 0.3 "x".
Treating H ( "X"; 3, 7 ) as a random distribution (a random vector in the four-dimensional space of all measures on {0,1,2,3}), one may take its expectation, getting the unconditional distribution of "Y", — the binomial distribution Bin ( 3, 0.5 ). This fact amounts to the equality
 formula_29
for "y" = 0,1,2,3; which is an instance of the law of total probability.
Conditioning on the level of densities.
Example. A point of the sphere "x"2 + "y"2 + "z"2 = 1 is chosen at random according to the uniform distribution on the sphere. The random variables "X", "Y", "Z" are the coordinates of the random point. The joint density of "X", "Y", "Z" does not exist (since the sphere is of zero volume), but the joint density "f""X","Y" of "X", "Y" exists,
 formula_30
(The density is non-constant because of a non-constant angle between the sphere and the plane.) The density of "X" may be calculated by integration,
 formula_31
surprisingly, the result does not depend on "x" in (−1,1),
 formula_32
which means that "X" is distributed uniformly on (−1,1). The same holds for "Y" and "Z" (and in fact, for "aX" + "bY" + "cZ" whenever "a"2 + b2 + c2 = 1).
Example. A different measure of calculating the marginal distribution function is provided below 
formula_33
formula_34
Conditional probability.
Calculation.
Given that "X" = 0.5, the conditional probability of the event "Y" ≤ 0.75 is the integral of the conditional density,
 formula_35
formula_36
More generally,
 formula_37
for all "x" and "y" such that −1 ; "x" ; 1 (otherwise the denominator "f""X"("x") vanishes) and formula_38 (otherwise the conditional probability degenerates to 0 or 1). One may also treat the conditional probability as a random variable, — a function of the random variable "X", namely,
 formula_39
The expectation of this random variable is equal to the (unconditional) probability,
 formula_40
which is an instance of the law of total probability E ( P ( "A" | "X" ) ) = P ( "A" ).
Interpretation.
The conditional probability P ( "Y" ≤ 0.75 | "X" = 0.5 ) cannot be interpreted as P ( "Y" ≤ 0.75, "X" = 0.5 ) / P ( "X" = 0.5 ), since the latter gives 0/0. Accordingly, P ( "Y" ≤ 0.75 | "X" = 0.5 ) cannot be interpreted via empirical frequencies, since the exact value "X" = 0.5 has no chance to appear at random, not even once during an infinite sequence of independent trials.
The conditional probability can be interpreted as a limit,
 formula_41
Conditional expectation.
The conditional expectation E ( "Y" | "X" = 0.5 ) is of little interest; it vanishes just by symmetry. It is more interesting to calculate E ( |"Z"| | "X" = 0.5 ) treating |"Z"| as a function of "X", "Y":
 formula_42
More generally,
 formula_43
for −1 ; "x" ; 1. One may also treat the conditional expectation as a random variable, — a function of the random variable "X", namely,
 formula_44
The expectation of this random variable is equal to the (unconditional) expectation of |"Z"|,
 formula_45
namely,
 formula_46
which is an instance of the law of total expectation E ( E ( "Y" | "X" ) ) = E ( "Y" ).
The random variable E(|"Z"| | "X") is the best predictor of |"Z"| given "X". That is, it minimizes the mean square error E ( |"Z"| - "f"("X") )2 on the class of all random variables of the form "f"("X"). Similarly to the discrete case, E ( |"Z"| | "g"("X") ) = E ( |"Z"| | "X" ) for every measurable function "g" that is one-to-one on (-1,1).
Conditional distribution.
Given "X" = x, the conditional distribution of "Y", given by the density "f""Y"|"X"="x"(y), is the (rescaled) arcsin distribution; its cumulative distribution function is
 formula_47
for all "x" and "y" such that "x"2 + "y"2 ; 1.The corresponding expectation of "h"("x","Y") is nothing but the conditional expectation E ( "h"("X","Y") | "X"="x" ). The mixture of these conditional distributions, taken for all "x" (according to the distribution of "X") is the unconditional distribution of "Y". This fact amounts to the equalities
 formula_48
the latter being the instance of the law of total probability mentioned above.
What conditioning is not.
On the discrete level, conditioning is possible only if the condition is of nonzero probability (one cannot divide by zero). On the level of densities, conditioning on "X" = "x" is possible even though P ( "X" = "x" ) = 0. This success may create the illusion that conditioning is "always" possible. Regretfully, it is not, for several reasons presented below.
Geometric intuition: caution.
The result P ( "Y" ≤ 0.75 | "X" = 0.5 ) = 5/6, mentioned above, is geometrically evident in the following sense. The points ("x","y","z") of the sphere "x"2 + "y"2 + "z"2 = 1, satisfying the condition "x" = 0.5, are a circle "y"2 + "z"2 = 0.75 of radius formula_49 on the plane "x" = 0.5. The inequality "y" ≤ 0.75 holds on an arc. The length of the arc is 5/6 of the length of the circle, which is why the conditional probability is equal to 5/6.
This successful geometric explanation may create the illusion that the following question is trivial.
 A point of a given sphere is chosen at random (uniformly). Given that the point lies on a given plane, what is its conditional distribution?
It may seem evident that the conditional distribution must be uniform on the given circle (the intersection of the given sphere and the given plane). Sometimes it really is, but in general it is not. Especially, "Z" is distributed uniformly on (-1,+1) and independent of the ratio "Y"/"X", thus, P ( "Z" ≤ 0.5 | "Y"/"X" ) = 0.75. On the other hand, the inequality "z" ≤ 0.5 holds on an arc of the circle "x"2 + "y"2 + "z"2 = 1, "y" = "cx" (for any given "c"). The length of the arc is 2/3 of the length of the circle. However, the conditional probability is 3/4, not 2/3. This is a manifestation of the classical Borel paradox.
 ;templatestyles src="Template:Blockquote/styles.css" / ;Appeals to symmetry can be misleading if not formalized as invariance arguments.
Another example. A random rotation of the three-dimensional space is a rotation by a random angle around a random axis. Geometric intuition suggests that the angle is independent of the axis and distributed uniformly. However, the latter is wrong; small values of the angle are less probable.
The limiting procedure.
Given an event "B" of zero probability, the formula formula_50 is useless, however, one can try formula_51 for an appropriate sequence of events "B""n" of nonzero probability such that "B""n" ↓ "B" (that is, formula_52 and formula_53). One example is given above. Two more examples are Brownian bridge and Brownian excursion.
In the latter two examples the law of total probability is irrelevant, since only a single event (the condition) is given. By contrast, in the example above the law of total probability applies, since the event "X" = 0.5 is included into a family of events "X" = "x" where "x" runs over (−1,1), and these events are a partition of the probability space.
In order to avoid paradoxes (such as the Borel's paradox), the following important distinction should be taken into account. If a given event is of nonzero probability then conditioning on it is well-defined (irrespective of any other events), as was noted above. By contrast, if the given event is of zero probability then conditioning on it is ill-defined unless some additional input is provided. Wrong choice of this additional input leads to wrong conditional probabilities (expectations, distributions). In this sense, "the concept of a conditional probability with regard to an isolated hypothesis whose probability equals 0 is inadmissible." (Kolmogorov)
The additional input may be (a) a symmetry (invariance group); (b) a sequence of events "B""n" such that "B""n" ↓ "B", P ( "B""n" ) ; 0; (c) a partition containing the given event. Measure-theoretic conditioning (below) investigates Case (c), discloses its relation to (b) in general and to (a) when applicable.
Some events of zero probability are beyond the reach of conditioning. An example: let "X""n" be independent random variables distributed uniformly on (0,1), and "B" the event ""X""n" → 0 as "n" → ∞"; what about P ( "X""n" ; 0.5 | "B" ) ? Does it tend to 1, or not? Another example: let "X" be a random variable distributed uniformly on (0,1), and "B" the event ""X" is a rational number"; what about P ( "X" = 1/"n" | "B" ) ? The only answer is that, once again, ;templatestyles src="Template:Blockquote/styles.css" / ;the concept of a conditional probability with regard to an isolated hypothesis whose probability equals 0 is inadmissible.
Conditioning on the level of measure theory.
Example. Let "Y" be a random variable distributed uniformly