Why the Covariance Matrix Appears in Stein’s Equation
For a Gaussian target, integration by parts turns expectations involving the random vector into expectations involving derivatives of a test function. In several dimensions, the covariance matrix determines exactly how those derivatives are combined. The resulting differential operator is the multivariate Gaussian version of the normal Stein operator.
Fix a dimension \(d\in\mathbb{N}\) and a symmetric positive semidefinite \(d\times d\) matrix \(\Sigma\). Let \(Z\) have the centered Gaussian distribution \(N_d(0,\Sigma)\). For a twice differentiable function \(f:\mathbb{R}^d\to\mathbb{R}\), write \(\nabla f\) for its gradient and \(\nabla^2 f\) for its Hessian. The matrix contraction in the operator is \(\operatorname{tr}(\Sigma\nabla^2 f)\).
The equation is centered at the target expectation: taking expectations under \(Z\) should make its right-hand side zero. The integration-by-parts identity below explains why the operator has this particular form.
Gaussian Integration by Parts
The covariance identity holds even if \(\Sigma\) is singular. Let \(G\) be a standard Gaussian vector in \(\mathbb{R}^d\), and take a symmetric square root \(A=\Sigma^{1/2}\), so that \(Z=AG\) has covariance \(\Sigma\). For a differentiable function \(g\) with sufficient integrability, standard one-dimensional Gaussian integration by parts applied to each coordinate of \(G\) gives the following result.
Apply the identity with \(g=\partial_i f\), then sum over \(i\). The left side becomes \(\mathbb{E}[Z\cdot\nabla f(Z)]\), while the right side becomes the covariance contraction with the Hessian.
Worked Example: A Linear Test Function
Worked Example: The Stein solution for a linear function
Let \(h(x)=a\cdot x\), where \(a\in\mathbb{R}^d\). Since \(Z\) is centered, \(\mathbb{E}h(Z)=0\). Set \(f(x)=-a\cdot x\). Its Hessian is zero and its gradient is \(-a\), so
Therefore \(f(x)=-a\cdot x\) solves the equation. In dimension one with variance \(1\), taking \(h(x)=x\) gives \(f(x)=-x\); direct substitution gives \(f''(x)-xf'(x)=0-x(-1)=x\).
Worked Example: A Correlated Two-Dimensional Target
Worked Example: The operator on a product
Let \(\Sigma=\begin{pmatrix}1&\rho\\ \rho&1\end{pmatrix}\), where \(-1\leq\rho\leq1\), and let \(f(x_1,x_2)=x_1x_2\). The gradient is \((x_2,x_1)\), and the Hessian is \(\begin{pmatrix}0&1\\1&0\end{pmatrix}\). Hence
and therefore \(\mathcal{A}_{\Sigma}f(x)=2\rho-2x_1x_2\). Because \(\mathbb{E}[Z_1Z_2]=\rho\), the expectation of this expression at \(Z\) is \(2\rho-2\rho=0\), as required. In particular, when \(\rho=1\) the operator value is \(2-2x_1x_2\), not \(2-x_1x_2\): both terms in the drift must be included.
Worked Example: A Quadratic Test Function
Worked Example: A centered quadratic
Let \(B\) be a symmetric \(d\times d\) matrix and set \(h(x)=x^{\mathsf T}Bx\). The Gaussian second-moment identity gives \(\mathbb{E}h(Z)=\operatorname{tr}(B\Sigma)\). Choose \(f(x)=-\tfrac12 x^{\mathsf T}Bx\). Then \(\nabla f(x)=-Bx\) and \(\nabla^2 f(x)=-B\), so
This verifies the equation directly, including its covariance term and its sign. The calculation uses the symmetry of \(B\), which ensures the stated gradient and Hessian.
Constructing Solutions with the Ornstein–Uhlenbeck Semigroup
The preceding examples have polynomial solutions. A useful general construction comes from the Gaussian Ornstein–Uhlenbeck semigroup. For \(t\geq0\), define
As \(t\) grows, the coefficient of \(x\) tends to zero and the argument approaches a draw from the target Gaussian. If \(h\) is twice continuously differentiable with bounded first and second derivatives, define
The integral is finite for each fixed \(x\). Indeed, using the same \(Z\) in the two terms and the bounded gradient of \(h\), the absolute difference inside the integral is at most \[ \|\nabla h\|_\infty \left(e^{-t}|x|+\left|1-\sqrt{1-e^{-2t}}\right|\mathbb{E}|Z|\right). \] Both terms are integrable over \(t\in[0,\infty)\).
Which Derivatives Matter for Wasserstein Bounds?
For a test function \(h\), the Stein equation rewrites a difference of expectations as
whenever \(X\) has the required integrability and \(f_h\) is a solution. This identity identifies the derivative terms that an approximation argument must control: the gradient appears in the drift, while the Hessian appears in the covariance term. In coupling and exchangeable-pair arguments, a Taylor expansion commonly produces a remainder controlled by a Hessian bound.
For smooth tests with bounded Hessian, the semigroup also gives a direct bound. If \(\|\nabla^2h(x)\|_{\mathrm{op}}\leq M\) for every \(x\), then the Hessian formula for \(P_t h\) implies \(\|\nabla^2P_t h(x)\|_{\mathrm{op}}\leq e^{-2t}M\). Integrating in \(t\) gives the following result.
Wasserstein distance uses a supremum over Lipschitz test functions, which need not have bounded classical second derivatives. For the standard Gaussian target \(\Sigma=I\), a useful bound for smooth \(L\)-Lipschitz \(h\) follows by differentiating the Gaussian smoothing and applying integration by parts: \[ \partial_{ij}P_t h(x) =\frac{e^{-2t}}{\sqrt{1-e^{-2t}}} \,\mathbb{E}\!\left[Z_j\,\partial_i h\!\left(e^{-t}x+\sqrt{1-e^{-2t}}\,Z\right)\right]. \] For unit vectors \(u,v\), the absolute value of the corresponding Hessian bilinear form is at most \[ \frac{e^{-2t}}{\sqrt{1-e^{-2t}}}\,L\,\mathbb{E}|v\cdot Z| \leq \frac{e^{-2t}}{\sqrt{1-e^{-2t}}}\,L\sqrt{\frac{2}{\pi}}. \] Integrating over \(t\) gives \(\|\nabla^2 f_h(x)\|_{\mathrm{op}}\leq L\sqrt{2/\pi}\), since \(\int_0^\infty e^{-2t}(1-e^{-2t})^{-1/2}\,dt=1\). This illustrates why Hessian estimates for Stein solutions are central to Wasserstein bounds; nonsmooth Lipschitz tests can be handled by smooth approximation.
A Common Pitfall: Mixing Covariance Conventions
The operator here is written in the original coordinates of \(X\), with target covariance \(\Sigma\). Its diffusion term is \(\operatorname{tr}(\Sigma\nabla^2 f)\), and its drift is \(-x\cdot\nabla f\). Replacing \(\Sigma\) by the identity without also changing coordinates gives the wrong equation when the target is not standard Gaussian. A quick check is to apply the proposed operator to a quadratic: its Gaussian expectation must be zero.
A second useful check is sign and centering. The right side is \(h-\mathbb{E}h(Z)\), not its negative. For \(h(x)=a\cdot x\), the solution \(f(x)=-a\cdot x\) verifies the sign immediately. For \(h(x)=x_1x_2\) under a correlated target, both drift contributions must be included, so the drift is \(2x_1x_2\).
Check Your Understanding
Use the operator and examples above to check that you can move between the covariance identity, the Stein equation, and derivative bounds.
- What integration-by-parts identity gives the covariance term in \(\mathcal{A}_{\Sigma}\)?
- For \(h(x)=a\cdot x\), verify the Stein equation using \(f(x)=-a\cdot x\).
- For the correlated two-dimensional example, why is the drift of \(f(x)=x_1x_2\) equal to \(2x_1x_2\)?
- What Hessian bound follows from the semigroup when \(h\) has Hessian operator norm at most \(M\)?
- Which derivatives of the Stein solution occur in the expectation identity used for Wasserstein approximation?