skip to content

What does Jensen's inequality say about a convex function of a weighted average?

level: seniorimportance: should knowfreq 36%

answer

  1. the chord test, extended past two points
  2. average first, or apply f first
  3. convex one way, concave the other
  4. f of the mean <= mean of f
  5. apply it to log to get AM-GM

basics

~20 s

For a convex f and weights t_i >= 0 summing to 1, f(sum t_i x_i) <= sum t_i f(x_i): the function of the weighted average never exceeds the weighted average of the function values. For a concave f the inequality reverses.

solid answer

~40 s

Jensen's inequality generalises the chord definition from two points to many. If `f` is convex on a convex domain and the weights satisfy `t_i >= 0` with `sum t_i = 1`, then `f(sum t_i x_i) <= sum t_i f(x_i)`. The two-point case *is* the definition of convexity, and induction on the number of points gives the rest. For a concave `f` every inequality flips. A clean deterministic application: `log` is concave, so with equal weights `1/n` on positive numbers `x_1, ..., x_n`, `log((x_1 + ... + x_n)/n) >= (1/n) * sum log(x_i) = log((x_1 * ... * x_n)^(1/n))`. Exponentiating both sides yields AM-GM, the arithmetic mean is at least the geometric mean. Equality is automatic for affine `f`; for a strictly convex `f` it holds only when all points carrying positive weight are identical.

go deeper

for a junior

Be ready to state the inequality with the correct direction for a convex function and to say that concavity reverses it; anchor the sign on a small numeric case you can check.

for a middle

Explain why the two-point case is the definition itself and how induction extends it, and be able to name the weight conditions the statement depends on.

for a senior

Show you can use it as a tool: pick the right convex or concave function for the bound you want, and state the equality condition that makes the resulting bound sharp.

for a principal

Own the reasoning style — recognising when an argument reduces to pushing a convex function through an average, and insisting on the equality case before a bound is quoted as tight.

## Statement Let `f` be convex on a convex domain `D`, let `x_1, ..., x_n` be points of `D`, and let `t_1, ..., t_n` be weights with ``` t_i >= 0 and t_1 + ... + t_n = 1 ``` Then **Jensen's inequality** says ``` f( t_1*x_1 + ... + t_n*x_n ) <= t_1*f(x_1) + ... + t_n*f(x_n) ``` In words: **the function of the weighted average is at most the weighted average of the function values**. If `f` is concave, every inequality reverses. If `f` is affine, both directions hold and the relation is an equality. The hypotheses carry real weight. The `x_i` must lie in a region where `f` is convex — a formula convex on one interval need not be convex on a larger one. The weights must be non-negative and sum to one; a negative weight breaks the argument immediately, because multiplying an inequality by a negative number flips it. ## Why it is true The two-point case `f(t*x_1 + (1-t)*x_2) <= t*f(x_1) + (1-t)*f(x_2)` is precisely the definition of a convex function, so there is nothing to prove there. For `n` points, argue by induction. Assume the result for `n - 1` points and suppose `t_n < 1` (if `t_n = 1` the statement is trivial). Write ``` sum_{i=1..n} t_i*x_i = (1 - t_n) * z + t_n * x_n, where z = sum_{i<n} [t_i / (1 - t_n)] * x_i ``` The coefficients `t_i / (1 - t_n)` for `i < n` are non-negative and sum to `1`, so `z` is a convex combination of the first `n - 1` points and therefore lies in `D`. Apply the two-point inequality to `z` and `x_n`, then the induction hypothesis to `f(z)`, and the terms reassemble into the claim. Geometrically the picture is the same one as the chord test: the weighted average of the points `(x_i, f(x_i))` on the graph is a point inside their convex hull, which sits on or above the graph, and its height is `sum t_i f(x_i)` while the graph directly below it has height `f(sum t_i x_i)`. ## Equality For an affine `f`, Jensen is an identity for every choice of points and weights. For a **strictly** convex `f`, equality holds if and only if all the `x_i` that carry positive weight are equal to one another — any genuine spread among the weighted points makes the inequality strict. This equality case is the source of most of the sharpness results proved with Jensen: you get a bound, and then the equality condition tells you exactly which configuration attains it. ## Deriving AM-GM The classic deterministic payoff. The natural logarithm is **concave** on the positive reals (its second derivative is `-1/x^2 < 0`), so Jensen applies with the reversed inequality. Take positive numbers `x_1, ..., x_n` and equal weights `t_i = 1/n`: ``` log( (x_1 + ... + x_n) / n ) >= (1/n) * ( log x_1 + ... + log x_n ) = log( (x_1 * ... * x_n)^(1/n) ) ``` Since `log` is strictly increasing, exponentiating preserves the direction: ``` (x_1 + ... + x_n) / n >= (x_1 * x_2 * ... * x_n)^(1/n) ``` which is exactly **AM-GM**: the arithmetic mean is at least the geometric mean. Because `log` is strictly concave, equality holds if and only if all the `x_i` coincide. The same argument with general weights `t_i` gives the **weighted AM-GM**: ``` t_1*x_1 + ... + t_n*x_n >= x_1^{t_1} * ... * x_n^{t_n} ``` ## How it is used Jensen is the standard tool for turning a statement about a single averaged quantity into a statement about individual terms, or the reverse. Whenever a bound involves a convex function on the outside of a sum, Jensen lets you push the function inside the sum at a known cost — and knowing which direction the cost points is the whole skill. The most common error in interviews is stating the inequality with the sign reversed, so anchor it on a concrete case you can verify in your head: with `f(x) = x^2` and the two numbers `0` and `2` with equal weights, `f(1) = 1` while the average of the function values is `2`, and `1 <= 2` confirms the direction.

  • When does Jensen's inequality hold with equality?
    Always, for an affine `f`, since both directions hold and the relation is an identity. For a strictly convex `f`, equality holds exactly when every point carrying positive weight is the same point — any spread makes the inequality strict. That equality condition is what turns Jensen from a bound into a sharp characterisation in most proofs.
  • How do you get the weighted AM-GM inequality from Jensen?
    Apply Jensen to the concave function `log` with weights `t_i >= 0` summing to one: `log(sum t_i x_i) >= sum t_i log(x_i) = log(prod x_i^{t_i})`. Exponentiating, and using that `log` is increasing, gives `sum t_i x_i >= prod x_i^{t_i}`. Equal weights `1/n` recover the classical arithmetic-versus-geometric-mean statement.
  • Why does the two-point case need no proof at all?
    Because it is the definition of a convex function. Jensen with `n = 2` and weights `t` and `1 - t` is literally the chord inequality `f(t*x + (1-t)*y) <= t*f(x) + (1-t)*f(y)`. Everything beyond two points follows by induction, grouping the first `n-1` terms into a single convex combination and applying the two-point case.
  • What goes wrong if a weight is allowed to be negative?
    The proof multiplies inequalities by the weights, which is only valid when they are non-negative; a negative weight reverses the direction of that step. The conclusion genuinely fails too — with weights outside `[0, 1]` the combination need not even lie in the domain where `f` is convex, so there is nothing to compare against.

Averaging the inputs first and then bending them through a convex curve loses height compared with bending each one and averaging afterwards, because the curve dips below the straight line joining any two of its points.

saying these in an interview costs you the question

  • States the inequality with the direction reversed
  • Forgets weights must be non-negative and sum to one
  • Claims equality holds for any convex function
  • Applies it without checking convexity on that interval
  • Treats log as convex when deriving AM-GM

context