ArticleslgStudy

mathematics

Stein's lemma

Stein's lemma is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Stein's lemma rather than just read about it. In short: Stein's lemma, named in honor of Charles Stein, is a theorem of probability theory that is of interest primarily because of its applications to statistical inference – in particular, to James–Stein estimation and empirical Bayes methods – and its applications to portfolio choice theory. The theorem gives a formula for the covariance of one random variable with the value of a function of another, when the two random…

Key takeaways

  • Stein's lemma belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Stein's lemma to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Stein's lemma from memory before moving on to harder problems.

Reference excerpt

Stein's lemma, named in honor of Charles Stein, is a theorem of probability theory that is of interest primarily because of its applications to statistical inference – in particular, to James–Stein estimation and empirical Bayes methods – and its applications to portfolio choice theory. The theorem gives a formula for the covariance of one random variable with the value of a function of another, when the two random variables are jointly normally distributed. Note that the name "Stein's lemma" is also commonly used to refer to a different result in the area of statistical hypothesis testing, which connects the error exponents in hypothesis testing with the Kullback–Leibler divergence. This result is also known as the Chernoff–Stein lemma and is not related to the lemma discussed in this article.

Statement Suppose X is a normally distributed random variable with expectation μ and variance σ2. Further suppose g is a differentiable function for which the two expectations E⁡(g(X)(X−μ)) and E⁡(g′(X)) both exist. (The existence of the expectation of any random variable is equivalent to the finiteness of the expectation of its absolute value.) Then

E⁡(g(X)(X−μ))=σ2E⁡(g′(X)).

Multidimensional In general, suppose X and Y are jointly normally distributed. Then

Cov⁡(g(X),Y)=Cov⁡(X,Y)E⁡(g′(X)). For a general multivariate Gaussian random vector (X1,...,Xn)∼𝒩(μ,Σ) it follows that

E⁡(g(X)(X−μ))=Σ⋅E(∇g(X)). Similarly, when μ=0, E⁡[∂ig(X)]=E⁡[g(X)(Σ−1X)i],E⁡[∂i∂jg(X)]=E⁡[g(X)((Σ−1X)i(Σ−1X)j−Σij−1)]

Gradient descent Stein's lemma can be used to stochastically estimate gradient:∇Eϵ∼𝒩(0,I)(g(x+Σ1/2ϵ))=Σ−1/2Eϵ∼𝒩(0,I)(g(x+Σ1/2ϵ)ϵ)≈Σ−1/21N∑i=1Ng(x+Σ1/2ϵi)ϵiwhere ϵ1,…,ϵN are IID samples from the standard normal distribution 𝒩(0,I). This form has applications in Stein variational gradient descent and Stein variational policy gradient.

Proof The univariate probability density function for the univariate normal distribution with expectation 0 and variance 1 is

φ(x)=12πe−x2/2 Since ∫xexp⁡(−x2/2)dx=−exp⁡(−x2/2) we get from integration by parts:

E⁡[g(X)X]=12π∫g(x)xexp⁡(−x2/2)dx=12π∫g′(x)exp⁡(−x2/2)dx=E⁡[g′(X)]. The case of general variance σ2 follows by substitution.

Generalizations Isserlis' theorem is equivalently stated asE⁡(X1f(X1,…,Xn))=∑i=1nCov⁡(X1,Xi)E⁡(∂Xif(X1,…,Xn)).where (X1,…Xn) is a zero-mean multivariate normal random vector. Suppose X is in an exponential family, that is, X has the density

fη(x)=exp⁡(η′T(x)−Ψ(η))h(x). Suppose this density has support (a,b) where a,b could be −∞,∞ and as x→a or b, exp⁡(η′T(x))h(x)g(x)→0 where g is any differentiable function such that E|g′(X)|<∞ or exp⁡(η′T(x))h(x)→0 if a,b finite. Then

E[(h′(X)h(X)+∑ηiTi′(X))⋅g(X)]=−E[g′(X)]. The derivation is same as the special case, namely, integration by parts. If we only know X has support ℝ, then it could be the case that E|g(X)|<∞ and E|g′(X)|<∞ but limx→∞fη(x)g(x)≠0. To see this, simply put g(x)=1 and fη(x) with infinitely spikes towards infinity but still integrable. One such example could be adapted from f(x)={1x∈[n,n+2−n)0otherwise so that f is smooth. Extensions to elliptically contoured distributions also exist.

See also Stein's method Taylor expansions for the moments of functions of random variables Stein discrepancy

References

Worked examples

Example 1 — a first encounter with Stein's lemma

Start with the simplest possible case. Write down what Stein's lemma claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Stein's lemma before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Stein's lemma ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Stein's lemma

In research
Stein's lemma appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Stein's lemma in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Stein's lemma is common in secondary-school and first-year university syllabi. It links to neighbouring topics Theorems in probability theory, Theorems in statistics, so understanding it makes those chapters shorter.
In everyday life
Look for Stein's lemma outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Stein's lemma” →

How to study Stein's lemma in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Stein's lemma means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Stein's lemma out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Stein's lemma in simple terms?

Stein's lemma, named in honor of Charles Stein, is a theorem of probability theory that is of interest primarily because of its applications to statistical inference – in particular, to James–Stein estimation and empirical Bayes methods – and its applications to portfolio choice theory. The theorem…

Why does Stein's lemma matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Stein's lemma?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Stein's lemma.

Tags

  • Theorems in probability theory
  • Theorems in statistics

Keep exploring