Jensen’s inequality: average before or after?

The question
Two distributions both have mean 3. Do they also have the same average after each value is squared?
Choose a distribution, then compare the two orders of calculation.
- 1 SeeCompare two probability distributions.
- 2 TryTest a different curve and meet goals.
- 3 ProveBuild the weighted-average proof.
- 4 ApplyUse the inequality in five problems.
Before you start · 3 quick checks on probability weights, expectation, and linearity
Two ideas before you start
2 ideasCarry the probabilities with the values
Probability bars at zero and eight. Choose the weight at eight.
Changing a probability changes how much its value contributes to the mean. A transformed value keeps the same probability.
Exact definition
For a finite random variable \(X\), let \(x_i\) be its possible values and \(p_i\) their probabilities. The weights are nonnegative and sum to one. Write \(\mu=E[X]=\sum_i p_i x_i\). Applying a function first gives \(E[f(X)]=\sum_i p_i f(x_i)\); averaging first gives \(f(E[X])=f(\mu)\). The parentheses record which operation happens first.
The expectation and variance lesson develops weighted means and second moments. Here those calculations become a way to compare nonlinear transformations.
A shape condition on an interval
Choose the square curve or the absolute-value curve.
Both curves are convex. Convexity allows a corner; it does not require a derivative everywhere.
Exact definition
A real-valued function \(f\) is convex on an interval \(I\) if, for all \(a,b\in I\) and \(0\le t\le1\),
\[\begin{aligned}f((1-t)a+tb)\\&\le(1-t)f(a)+tf(b).\end{aligned}\]The graph lies on or below the straight chord joining any two of its points. The interval condition keeps the weighted input inside the domain. A function is strictly convex if the inequality is strict whenever the points differ and both weights are positive. A straight line is convex but not strictly convex. The square function is strictly convex on the real line.
Scope: probabilities, not sample estimates
The activities specify finite distributions exactly. No sampling error is involved. Repeated values may be combined by adding their probabilities, and outcomes of probability zero may be discarded. Independence is not needed for Jensen’s inequality about one random variable. It will be used only in one explicit construction of a spread below.
All function values must exist on the stated interval. A formula with a singularity cannot be used across it merely because the mean happens to lie in its domain.
Compare before calculating
- Read the two distributions and choose the larger expected squared value.
- Check your choice to open the curve, both expectations, and their gaps from the transformed mean.
| Distribution | E[X] | (E[X])² | E[X²] | Gap |
|---|
The function of the mean is a height on the curve. The expected function value is a probability-weighted average of heights, so it need not sit on the curve. Keeping these two constructions separate prevents a common error: replacing an average of nonlinear outputs with the output at an average input.
What makes this a mean-preserving spread?
Start with a draw from A. Independently add a noise value that is equally likely to be minus one or plus one. Each starting value is replaced by two children whose average is that starting value. Combining repeated children gives exactly B. This construction preserves the mean within each starting group as well as across the final distribution.
For any convex function on an interval containing these values, the average function value of each pair of children is at least the function at their parent. Weight those pairwise inequalities by A’s probabilities and add. B’s expected function value is therefore at least A’s, and their equal means make the same statement true of their Jensen gaps. “At least” allows equality for an affine function.
Equal means alone do not establish this ordering for every convex function. Neither does a larger variance by itself. A mean-preserving spread supplies the stronger condition: the new outcomes can be grouped so that each group averages back to its original value. The construction here shows those groups explicitly.
Change the function
The first activity used a square. Keep the order of operations explicit as you test another transformation.
Use what you found above
- Choose the function, then move the distance d. The two equally likely values sit at 3 − d and 3 + d.
- Meet each stated goal. Next goal restores the square function and the starting distance.
The readout always subtracts the function of the mean from the average function value. That signed gap is nonnegative for a convex function and nonpositive for a concave function. Its sign changes with curvature; it is not a probability and need not lie between zero and one.
At zero distance both possible values coincide. The function is then evaluated at the same input in every outcome, so either order of calculation agrees. For these strictly convex or strictly concave functions, a positive distance prevents equality. The controls keep both inputs positive, so the square-root function is defined throughout the experiment.
For the square function, the signed gap is exactly the variance. For other functions, variance alone usually does not determine the size of the gap. The function’s shape and the locations and weights of the outcomes all matter. A numerical comparison for one curve is not a proof about every convex function.
Combine weighted groups
Let \(f\) be real-valued and convex on an interval \(I\). Let \(x_1,\ldots,x_n\in I\), with nonnegative weights \(p_i\) that sum to one. Then
\[f\!\left(\sum_i p_i x_i\right)\le\sum_i p_i f(x_i).\]Equivalently, \(f(E[X])\le E[f(X)]\). Equality holds exactly when \(f\) is affine (agrees with a straight line) on the interval from the smallest to the largest value with positive probability; a constant \(X\) is the case where that interval is a single point. A strictly convex function is affine on no interval of positive length, so for strictly convex \(f\), equality holds exactly when all values with positive probability coincide. For a concave function, the inequality reverses, with the same equality condition. Finite support makes all expectations in this statement finite.
Build the proof by induction on the number of positive weights. Remove zero weights first. The single-weight case is equality. In the induction step, assume the result for a group of one fewer positive weights, and use \(n\ge2\) positive weights summing to one. The symbol \(p\) below denotes the last weight, and \(q\) denotes the total of all earlier weights.
Where strictness enters
If the positive-weight values are not all equal, choose an extreme value as the final point and place all remaining points in the other group. The average of that group differs from the extreme whenever at least one remaining point differs. Strict convexity makes this two-group chord inequality strict. The later inequality cannot undo it. Conversely, if all values coincide, both sides evaluate the same function value.
Ordinary convexity permits equality for nonconstant variables. A function that is affine on the interval spanned by the support commutes with that weighted average. This includes a constant or a straight line. Conversely, suppose equality holds and the values with positive probability are not all equal. Call the smallest one \(a\) and the largest \(b\). Then \(\mu\) lies strictly between them, so it is an interior point of \(I\), and \(f\) has a supporting line \(\ell\) at \(\mu\) (see the note below). Each difference \(f(x_i)-\ell(x_i)\) is nonnegative, and their weighted sum is \(E[f(X)]-f(\mu)=0\), so \(f=\ell\) at every value with positive probability, including \(a\) and \(b\). Convexity keeps \(f\) on or below its chord from \(a\) to \(b\), and that chord lies on \(\ell\); since also \(f\ge\ell\), \(f=\ell\) on all of \([a,b]\). Do not infer that a random variable is constant from equality unless strict convexity is available.
Beyond finite distributions
A useful sufficient version is this: let \(f\) be finite and convex on an open interval \(I\), let \(X\in I\) almost surely, and assume \(E[|X|]\) and \(E[|f(X)|]\) are finite. Then \(\mu=E[X]\) also lies in \(I\), and the same inequality holds. Equality holds exactly when \(f\) is affine on some interval \(J\subseteq I\) with \(P(X\in J)=1\); for strictly convex \(f\), this means that \(X\) is almost surely constant. For concave \(f\), the inequality reverses.
A convex function has a supporting line at an interior point: some slope \(s\) satisfies \(f(x)\ge f(\mu)+s(x-\mu)\) throughout the interval. Taking expectations cancels the last term. If the function is differentiable there, its derivative is such a slope. A corner may have several supporting slopes; differentiability is not necessary. This supporting-line argument explains the general version, while the proof builder establishes the finite version directly from the definition.
Markov and Chebyshev use expectations to bound probabilities of events. Jensen instead compares expectations under a nonlinear transformation. It supplies a direction of comparison, not a full distribution or a tail probability.
Choose the transformation and its domain
Use what you found above. Identify the random input, the function applied to it, and whether the question asks for an expectation, a gap, or only a bound. Each problem has a hint and a worked solution.
Related application: the bond convexity lesson studies how a fixed-payment price bends as yield changes. Its financial convexity measure is a normalized second derivative; the mathematical shape condition used here applies to the full function on an interval.
Further reading
- S. Ross, A First Course in Probability, chapter 8, “Limit Theorems,” on probability inequalities.