Numerical Characteristics of Random Variables

This article introduces numerical characteristics of random variables such as expectation and variance.

Expectation

Definition

Discrete random variable

Let the probability distribution of the discrete random variable XX be pi=P{X=xi}p_i = P\{ X = x_i \}. If the series

∑xipi\sum x_i p_i

If it converges absolutely, its value is called the expectation of XX, written EXEX.

Continuous random variable

Let the density function of the continuous random variable XX be f(x)f(x). If the integral

∫Rxf(x)dx\int_{\mathbb{R}} xf(x) \text{d} x

When it converges absolutely, this value is the expectation of XX, denoted EXEX.

Unified definition

Let the distribution function of the random variable XX be F(x)F(x). If the Stieltjes integral

∫RxdF(x)\int_{\mathbb{R}} x \text{d} F(x)

Absolute convergence makes this value the expectation of XX, which we denote by EXEX.

Example where the expectation does not exist

Consider a discrete random variable XX with the following distribution:

P{X=(−1)k2kk}=12k,k=1,2,⋯P\left\{ X = (-1)^k \frac{2^k}{k} \right\} = \frac{1}{2^k}, \quad k = 1, 2, \cdots

Although the series ∑xipi\sum x_i p_i converges to −ln⁡2- \ln 2, it is not absolutely convergent, so the expectation of XX does not exist.

Now consider a continuous random variable YY with the following density function:

f(y)=1π⋅11+y2,y∈(−∞,+∞)f(y) = \frac{1}{\pi} \cdot \frac{1}{1 + y^2}, \quad y \in (-\infty, +\infty)

It is easy to verify that the expectation of YY also does not exist.

Properties of expectation

Linearity

If the expectations of random variables X,YX, Y exist, then

  • For any real numbers a,ba, b, E(aX+b)=a⋅EX+bE(aX + b) = a \cdot EX + b.
  • E(X+Y)=EX+EYE(X + Y) = EX + EY.

Expectation of the product of random variables

If the expectations of random variables XX and YY exist and XX and YY are independent, then

E(XY)=EX⋅EYE(XY) = EX \cdot EY

Note that independence is not a necessary condition in the property above.

Counterexample

Consider random variables XX and YY, where XX is uniformly distributed on [−1,1][-1, 1] and Y=X2Y = X^2.

Converting between expectation and probability

For a random event AA, consider its indicator function IAI_A:

IA(ω)={1,ω∈A0,ω∉AI_A(\omega) = \begin{cases} 1, & \omega \in A \\ 0, & \omega \notin A \end{cases}

By definition, its expectation is EIA=P(A)EI_A = P(A). This conversion is very common in practical applications.

Example

Suppose a sequence of length nn, {ai}\{ a_i \}, is given, where aka_k, with probability pkp_k, takes the value kk and, with probability 1−pk1 - p_k, takes the value 00. Consider how to find the expectation of S=∑i=1naiS = \sum_{i=1}^{n} a_i.

Directly applying the definition requires finding the probability of every possible value of SS, which is rather cumbersome, so the details are omitted here.

Alternatively, let IkI_k be the indicator function of the random event ak=ka_k = k. Then

S=∑k=1nk⋅IkS = \sum_{k=1}^{n} k \cdot I_k

It is then easy to obtain

ES=E(∑k=1nk⋅Ik)=∑k=1nk⋅E[Ik]=∑k=1nk⋅pkES = E \left( \sum_{k=1}^{n} k \cdot I_k \right) = \sum_{k=1}^{n} k \cdot E[I_k] = \sum_{k=1}^{n} k \cdot p_k

Conditional distribution and conditional expectation

We have previously studied conditional probability; similarly, we can introduce the concept of conditional expectation.

Definition

For two random variables XX and YY, conditional on Y=yY = y, the probability distribution (density function) of XX is called the conditional probability distribution (conditional probability density), denoted respectively by

P(X=xi∣Y=y)fX∣Y(x∣y)P( X = x_i | Y = y ) \qquad f_{X|Y}(x|y)

Under this condition, the expectation of XX is called the conditional expectation, denoted by E[X∣Y=y]E[X|Y=y].

Properties of conditional expectation

Many properties of conditional expectation follow from conditional probability and will not be elaborated here.

It is worth noting that E[X∣Y]E[X | Y] is generally a function of the random variable YY, and this function is usually not linear. However, we do have

E[E[X∣Y]]=EXE[E[X|Y]] = EX

The equation above is called the law of total expectation.

Application

HDU 5984 Pocky

There is a Pocky stick of length LL, which is randomly broken into two pieces each time. If the length of the piece on the right is no greater than dd, stop; otherwise, repeat the process on the piece on the right. Find the expected number of repetitions.

Solution

Let f(x)f(x) denote the expected number of repetitions for a piece of length xx. The case x≤dx \leq d is trivial.

When x>dx > d, let the distance from the break point to the right endpoint be kk. Clearly, k∼U[0,x]k \sim U[0, x], and the expected number of repetitions at this point is

g(k)={1,k≤d1+f(k),k>dg(k) = \begin{cases} 1, & k \leq d \\ 1 + f(k), & k > d \end{cases}

By the law of total expectation,

f(x)=Eg(k)=1+1x⋅∫dxf(t)dtf(x) = Eg(k) = 1 + \frac{1}{x} \cdot \int_{d}^{x} f(t) \text{d} t

Solving the integral equation above and substituting the initial condition gives

f(x)=1+ln⁡xdf(x) = 1 + \ln \frac{x}{d}

Variance

Definition

Let a random variable XX have an existing expectation EXEX, and suppose that the expectation

E(X−EX)2E(X - EX)^2

also exists. Then its value is called the variance of the random variable XX, denoted by DXDX or Var(x)Var(x). The arithmetic square root of the variance is called the standard deviation, denoted by σ(X)=DX\sigma(X) = \sqrt{DX}.

Properties of variance

If the variance of a random variable XX exists, then

  • For any constants a,ba, b, D(aX+b)=a2⋅DXD(aX + b) = a^2 \cdot DX.
  • DX=E(X2)−(EX)2DX = E(X^2) - (EX)^2.

Covariance and correlation coefficient

In general, the equality D(X+Y)=DX+DYD(X + Y) = DX + DY does not hold. This naturally raises two questions:

  • What exactly is the difference between D(X+Y)D(X + Y) and DX+DYDX + DY?
  • Under what conditions are D(X+Y)D(X + Y) and DX+DYDX + DY equal?

We introduce covariance to answer the first question.

Definition of covariance

For random variables X,YX, Y,

E((X−EX)(Y−EY))E((X - EX)(Y - EY))

is called the covariance of XX and YY, denoted by Cov⁡(X,Y)\operatorname{Cov}(X, Y).

Properties of covariance

For random variables X,Y,ZX, Y, Z, we have

  • Cov⁡(X,Y)=Cov⁡(Y,X)\operatorname{Cov}(X, Y) = \operatorname{Cov}(Y, X)
  • For any constants a,ba, b, Cov⁡(aX+bY,Z)=a⋅Cov⁡(X,Z)+b⋅Cov⁡(Y,Z)\operatorname{Cov}(aX + bY, Z) = a \cdot \operatorname{Cov}(X, Z) + b \cdot \operatorname{Cov}(Y, Z)

Covariance and variance are also related as follows:

  • DX=Cov⁡(X,X)DX = \operatorname{Cov}(X, X)
  • D(X+Y)=DX+2Cov⁡(X,Y)+DYD(X + Y) = DX + 2 \operatorname{Cov}(X, Y) + DY
About covariance

You may notice that the properties of covariance are highly consistent in form with the properties of the inner product of vectors.

From the perspective of functional analysis, for a given probability space, all random variables on it form a linear space, while covariance is an inner product on this space, and the standard deviation is the norm induced by this inner product.

For the second question raised above, it is easy to see that D(X+Y)=DX+DYD(X + Y) = DX + DY if and only if Cov⁡(X,Y)=0\operatorname{Cov}(X, Y) = 0. A natural necessary condition is that XX and YY are independent, because then

Cov⁡(X,Y)=E((X−EX)(Y−EY))=E(X−EX)E(Y−EY)=0\operatorname{Cov}(X, Y) = E((X - EX)(Y - EY)) = E(X - EX) E(Y - EY) = 0

However, this condition is not sufficient. To describe the relationship characterized by Cov⁡(X,Y)=0\operatorname{Cov}(X, Y) = 0 between random variables XX and YY, we introduce the correlation coefficient.

Correlation coefficient

For random variables X,YX, Y,

Cov⁡(X,Y)σ(X)σ(Y)\frac{ \operatorname{Cov}(X, Y)}{ \sigma(X)\sigma(Y) }

is called the Pearson correlation coefficient of XX and YY, denoted by ρX,Y\rho_{X,Y}.

The Pearson correlation coefficient describes the strength of the linear association between two random variables. The larger ∣ρX,Y∣|\rho_{X,Y}| is, the stronger the linear association between XX and YY. It is not difficult to prove that ∣ρX,Y∣≤1|\rho_{X,Y}| \leq 1, and ∣ρX,Y∣=1|\rho_{X,Y}| = 1 can occur only in the following two cases:

  • If there are a real number aa and a positive real number bb such that P(X=a+bY)=1P(X = a + bY) = 1, then ρX,Y=1\rho_{X,Y} = 1.
  • If there are a real number aa and a negative real number bb such that P(X=a+bY)=1P(X = a + bY) = 1, then ρX,Y=−1\rho_{X,Y} = -1.

When ρX,Y=0\rho_{X,Y} = 0, we say that random variables XX and YY are uncorrelated; in this case, there is no linear relationship between XX and YY.

“Uncorrelated” and “independent”

Two random variables being uncorrelated only means that there is no linear association between them; it does not mean that there are no other forms of dependence.

Therefore, the statement that two random variables X,YX, Y are uncorrelated is a necessary but not sufficient condition for them to be independent.

For the second question mentioned at the beginning of this section, we conclude that the necessary and sufficient condition for Cov⁡(X,Y)=0\operatorname{Cov}(X, Y) = 0 is that either one of XX and YY is constant with probability 11, or that X,YX, Y are uncorrelated.

This content comes from OI Wiki: Numerical Characteristics of Random Variables. See the original for authors and revision history. AIOJ has adapted the formatting, in-site links, and resource paths.

Content is shared under CC BY-SA 4.0 and SATA license; additional terms are governed by the original notice. Thanks to the OI Wiki authors and contributors; per the SATA terms, please visit the OI Wiki repository and star it to show your support.