Concepts / Expectation of a Random Variable

Expectation of a Random Variable

Markov's inequality applies to nonnegative random variables.

  • Programming
Interactive lab

Try it: Expectation and Variance of a Random Variable

A discrete random variable X as values with probabilities: the expectation E[X] = Σ x·p(x) is a probability-weighted average, and the variance is the expected squared distance from that mean, computed two ways.

How it works

  1. Each outcome has a value x and a bar height; probabilities are the heights renormalised, p(x) = height / total, so they always sum to exactly 1.
  2. E[X] = μ is built term by term: every outcome adds x·p(x) to the running sum.
  3. Var[X] = E[(X − μ)²]: centre each value on μ, square the deviation, weight it by p(x) and add.
  4. The same variance again as E[X²] − μ², and the standard deviation √Var[X].
  5. All sums are exact fractions (shown alongside decimals).

Default run (22 steps): X has 6 outcomes with bar heights 10, 10, 10, 10, 10, 10 (total W = 60). … E[X] = μ = 7/2 = 3.5; Var[X] = 35/12 ≈ 2.9167; standard deviation = √Var ≈ 1.7078.

Simplified: Up to 8 outcomes with integer values from −20 to 20 and integer bar heights 0–100. If every bar is 0 the first outcome gets height 1 (a distribution needs total probability 1).

Educational simulation

Loading the simulation…

From Average to Probability

Suppose Z is a random variable that never takes a negative value. You know its expectation, E[Z], but you want to control how likely Z is to reach or exceed a chosen threshold x. Markov's inequality connects these two pieces of information: it uses the expectation to produce an upper bound on the probability of the event Z ≥ x.

Key point

The result is an upper bound, not necessarily the exact probability.

What Expectation Tells You

The expectation of a random variable describes its average value. It combines the possible values of the variable with their probabilities to produce a weighted average. In Markov's inequality, the expectation E[Z] supplies the average-size information used to control the probability of reaching a threshold.

Possible valuesValues of ZE[Z]Average valueProbabilitiesLikelihoods of valuesweighted togetherweighted together
How do possible values and their probabilities combine to determine the average value?

The Nonnegative Requirement

Definition

A nonnegative random variable is a random variable whose values are always at least zero. Markov's inequality applies only under this condition.

The condition matters because Markov's inequality is stated for a variable Z whose values are not negative, together with its expectation E[Z] and a threshold x. The event being bounded is Z ≥ x: Z reaches or exceeds the threshold.

Markov's Inequality

Formula

To use the inequality, identify three ingredients: the nonnegative random variable Z, its expectation E[Z], and the chosen threshold x. Divide the expectation by the threshold. The resulting ratio is an upper bound for the probability that Z reaches or exceeds x.

Z ≥ 0Required conditionE[Z]ExpectationE[Z] / xUpper-bound ratioP[Z ≥ x]At most E[Z] / xxChosen thresholdallows use ofwithnumeratordenominatorbounds
How does Markov's inequality use nonnegativity, the expectation, and a threshold to produce an upper bound?

Substituting Known Values

Worked example

Bounding a Threshold Event

Suppose Z is nonnegative, E[Z] = 6, and the threshold is x = 15. Use Markov's inequality to bound P[Z ≥ 15].

  1. 1
    Identify the inequality

    For a nonnegative random variable, use P[Z ≥ x] ≤ E[Z] / x.

  2. 2
    Substitute the expectation and threshold

    Replace E[Z] with 6 and x with 15, giving P[Z ≥ 15] ≤ 6 / 15.

  3. 3
    Evaluate the ratio

    The ratio 6 / 15 equals 0.4.

Result

P[Z ≥ 15] ≤ 0.4. The probability is at most 0.4; it is not necessarily equal to 0.4.

E[Z] = 6Known expectationx = 15Chosen threshold6 / 150.4P[Z ≥ 15]≤ 0.4numeratordenominatorgives upper bound
What changes when the expectation and threshold are substituted into Markov's inequality?
Output
P[Z ≥ 15] ≤ 6 / 15 = 0.4

Raising the Threshold

For a fixed nonnegative random variable and a fixed expectation, Markov's bound has the form E[Z] / x. When x increases, the denominator becomes larger, so the ratio becomes smaller. The probability of reaching or exceeding the higher threshold therefore has a no-larger Markov bound. The probability P[Z ≥ x] is also monotonically nonincreasing as the threshold increases.

xOriginal thresholdE[Z] / xOriginal boundlarger xHigher thresholdE[Z] / larger xSmaller bounddivide expectation bydivide expectation by
How does increasing the threshold change the probability bound when the expectation stays fixed?

Common Mistakes

  • Common mistake

    Applying Markov's inequality without checking nonnegativity.

    What it looks like

    Using the formula for a random variable that may take negative values.

    Why it fails

    Markov's inequality requires the random variable to never take a negative value.

    Do this instead

    First verify that Z is nonnegative.

  • Common mistake

    Treating the upper bound as the exact probability.

    What it looks like

    Concluding that P[Z ≥ 15] equals 0.4.

    Why it fails

    The inequality states that the probability is at most 0.4.

    Do this instead

    Write P[Z ≥ 15] ≤ 0.4 and interpret it as an upper bound.

  • Common mistake

    Using the wrong threshold event.

    What it looks like

    Replacing P[Z ≥ x] with a probability for an unrelated event.

    Why it fails

    Markov's inequality specifically bounds the event that Z reaches or exceeds x.

    Do this instead

    Match the event and threshold carefully: P[Z ≥ x].

  • Common mistake

    Expecting a higher threshold to produce a larger bound.

    What it looks like

    Assuming that increasing x increases E[Z] / x.

    Why it fails

    With E[Z] fixed, increasing the denominator makes the ratio smaller.

    Do this instead

    Recalculate E[Z] / x and compare the two ratios.

Try the Bound

EASY

A nonnegative random variable Z has expectation E[Z] = 6. Use Markov's inequality to write an upper bound for the probability that Z reaches or exceeds a chosen threshold x. Then explain what happens to the bound if x increases while E[Z] remains fixed.

Hints
  • Start with P[Z ≥ x] ≤ E[Z] / x.
  • Substitute E[Z] = 6.
  • Compare 6 / x with 6 divided by a larger threshold.

What do you think happens?

If E[Z] stays fixed and the threshold increases, does the Markov bound become larger, stay the same, or become smaller?

  • Larger

  • The same

  • Smaller

Reveal answer
Answer:

Smaller

The bound is E[Z] / x. Increasing x increases the denominator, so the ratio becomes smaller.

Key Takeaways

  1. 1
    A nonnegative random variable never takes a negative value.
  2. 2
    Expectation E[Z] represents the average value used in Markov's inequality.
  3. 3
    For a nonnegative random variable, P[Z ≥ x] ≤ E[Z] / x.
  4. 4
    The result is an upper bound, not necessarily the exact probability.
  5. 5
    With a fixed expectation, increasing the threshold makes the Markov bound smaller.

At a glance

  • A nonnegative random variable has values that are always at least zero.
  • Expectation describes the average value of a random variable.
  • Markov's inequality connects E[Z] with the threshold event P[Z ≥ x].
  • The bound P[Z ≥ x] ≤ E[Z] / x gives an upper limit, not necessarily the exact probability.
  • For fixed expectation, a higher threshold produces a smaller probability bound.

More concepts starting with E