Equality in Gaussian Poincare Inequality The Gaussian Poincare inequality states that: for $f: \mathbb{R}^n \to \mathbb{R}$ and $Z\sim \mathcal{N}(0,I)$, we have that
\begin{align}
Var(f(Z)) \le E[ \| \nabla f(Z)\|^2].
\end{align}
My question: For what class of functions do we have equality?

Equality holds for the linear functions and only for them.
The inequality applies to everywhere differentiable functions $f$ for which the right hand side is finite  (implying both $f$ and its derivative are square integrable), so let's assume these conditions.
It's straightforward to reduce the problem to $n=1$ variables (integrate over the margins).  Suppose $f$ is such a univariate function for which the inequality becomes an equality.  Upon subtracting $\alpha = E[f(Z)]$ from $f$ to center it, this means the resulting zero-mean function $f$ minimizes the functional
$$\mathscr{L}[f] = E[(f^\prime)^2(Z) - f^2(Z)].$$
Suppose $\delta$ is any variation of $f:$ that is, $\delta$ is a function for which the inequality applies to both $f$ and $f+\delta.$  Writing $t$ for an arbitrary real number, we know that any variation cannot reduce the the value of the functional at its minimum:
$$\begin{aligned}
0 &\le \mathscr{L}[f+t\delta] - \mathscr{L}[f] \\
&= E[((f+t\delta)^\prime)^2(Z) - (f+\delta)^2(Z)] -  E[(f^\prime)^2(Z) - f^2(Z)] \\
&=E[2tf^\prime(Z)\delta^\prime(Z) + t^2\delta^\prime(Z)^2 - 2tf(Z)\delta(Z) + t^2\delta(Z)^2]\\
&= 2tE[f^\prime(Z)\delta^\prime(Z) - f(Z)\delta(Z)] + t^2E[\delta^\prime(Z)^2 -\delta(Z)^2].
\end{aligned}$$
This inequality can hold for all $t$ only when the linear term in this quadratic function of $t$ vanishes, implying
$$E[f^\prime(Z)\delta^\prime(Z)] =  E[f(Z)\delta(Z)].$$
Consider polynomial variations $\delta(z) = z^k$ for $k=0, 1, 2, \ldots.$  The crux of the matter (and a key part of the proof of the original inequality) is that integration by parts gives $E[Z g(Z)] = E[g^\prime(Z)]$ for all differentiable functions $g$ where both expectations are finite.  Use this to compute
$$\begin{aligned}
kE[Z^{k-1}f^\prime(Z)] &= E[f^\prime(Z)(Z^k)^\prime] \\
&= E[f(Z) Z^k] \\
&= E[Z(f(Z)Z^{k-1})] \\
&= E[Z^{k-1}f^\prime(Z) + (k-1)Z^{k-2} f(Z)],
\end{aligned}$$
whence, for $k\ne 1,$
$$E[Z^{k-2}(Zf^\prime(Z)-f(Z))] = 0.$$
Applying this to $k=2,3,4,\ldots$ shows the function $zf^\prime(z) - f(z)$ is orthogonal to all the functions $1, z, z^2, \ldots.$  Since these form a complete basis for the square-integrable functions (w.r.t. Gaussian measure), necessarily
$$zf^\prime(z) - z = 0.$$
The solutions to this first order linear ordinary differential equation are the functions
$$f(z) = \beta z$$
for $\beta\in\mathbb R.$  (Proof: the solutions form a vector space of the same dimension as the order, so we need only check that a single such nonzero function satisfies the ODE, which is trivial.) Adding back in the original expectation (remember, we centered $f$ for this analysis) shows that

Equality in the Gaussian Poincare inequality holds only if $f$ is a linear function, $f(z) = \alpha + \beta z.$

It's easy to check that equality does hold for all such functions.
