Randomized symmetric finite-difference derivative estimator (source code)

= Randomized symmetric finite-difference derivative estimator

Let $Z_i$ be independent <Rademacher random variables> and observe $Y_i=g(x_0+hZ_i)+\epsilon_i$, where the noises are independent of the $Z_i$ and of one another, with zero mean and <variance> $\sigma^2$. Assume the baseline $g(x_0)$ is known exactly and $|g''|\leq M$ on the sampled interval. The estimator
$$
\widehat g'_N(x_0)=\frac1N\sum_{i=1}^N\frac{Z_i(Y_i-g(x_0))}{h}
$$
uses function values on both sides of $x_0$. A first-order <Taylor expansion> gives
$$
\frac{Z_i(g(x_0+hZ_i)-g(x_0))}{h}=g'(x_0)+r_i,\qquad |r_i|\leq Mh/2.
$$
The average remainder therefore has squared magnitude at most $M^2h^2/4$, while the independent zero-mean noise contribution has <variance> $\sigma^2/(Nh^2)$. Their cross term vanishes after conditioning on the sample directions, proving
$$
\mathbb E|\widehat g'_N-g'(x_0)|^2\leq M^2h^2/4+\sigma^2/(Nh^2).
$$
The noise assumptions and exact baseline belong to this bound. Correlated or biased errors, or an independently estimated baseline, require their own error calculation.