title: Dynkin's formula
text: # Dynkin's formula
  
  In mathematics — specifically, in stochastic analysis — Dynkin's formula is a theorem giving the expected value of any suitably smooth statistic of an Itō diffusion at a stopping time. It may be seen as a stochastic generalization of the (second) fundamental theorem of calculus. It is named after the Russian mathematician Eugene Dynkin.
  
  ## Statement of the theorem
  
  Let X be the $R^n-valued$ Itō diffusion solving the stochastic differential equation
  
      $\mathrm {d} X_{t}=b(X_{t})\,\mathrm {d} t+\sigma (X_{t})\,\mathrm {d} B_{t}.$
  
  For a point x ∈ $R^n,$ let $P^x$ denote the law of X given initial datum $X_0$ = x, and let $E^x$ denote expectation with respect to $P^x.$
  
  Let A be the infinitesimal generator of X, defined by its action on compactly-supported $C^2$ (twice differentiable with continuous second derivative) functions f : $R^n$ → R as
  
      $Af(x)=\lim _{t\downarrow 0}{\frac {\mathbf {E} ^{x}[f(X_{t})]-f(x)}{t}}$
  
  or, equivalently,
  
      $Af(x)=\sum _{i}b_{i}(x){\frac {\partial f}{\partial x_{i}}}(x)+{\frac {1}{2}}\sum _{i,j}{\big\sigma \sigma ^{\top }{\big )}_{i,j}(x){\frac {\partial ^{2}f}{\partial x_{i}\,\partial x_{j}}}(x).$
  
  Let τ be a stopping time with $E^x[τ]$ < +∞, and let f be $C^2$ with compact support. Then Dynkin's formula holds:
  
      $\mathbf {E} ^{x}[f(X_{\tau })]=f(x)+\mathbf {E} ^{x}\left[\int _{0}^{\tau }Af(X_{s})\,\mathrm {d} s\right].$
  
  In fact, if τ is the first exit time for a bounded set B ⊂ $R^n$ with $E^x[τ]$ < +∞, then Dynkin's formula holds for all $C^2$ functions f, without the assumption of compact support.
  
  ## Example
  
  Dynkin's formula can be used to find the expected first exit time $τ_K$ of Brownian motion B from the closed ball
  
  $K=K_{R}=\{x\in \mathbf {R} ^{n}\mid \,|x|\leq R\},$
  
  which, when B starts at a point a in the interior of K, is given by
  
  $\mathbf {E} ^{a}[\tau _{K}]={\frac {1}{n}}{\bigR^{2}-|a|^{2}{\big )}.$
  
  Choose an integer j. The strategy is to apply Dynkin's formula with X = B, τ = $σ_j$ = min(j, $τ_K),$ and a compactly-supported $C^2$ f with f(x) = $|x|^2$ on K. The generator of Brownian motion is Δ/2, where Δ denotes the Laplacian operator. Therefore, by Dynkin's formula,
  
  ${\begin{aligned}\mathbf {E} ^{a}\left[f{\bigB_{\sigma _{j}}{\big )}\right]&=f(a)+\mathbf {E} ^{a}\left[\int _{0}^{\sigma _{j}}{\frac {1}{2}}\Delta f(B_{s})\,\mathrm {d} s\right]\\&=|a|^{2}+\mathbf {E} ^{a}\left[\int _{0}^{\sigma _{j}}n\,\mathrm {d} s\right]\\&=|a|^{2}+n\mathbf {E} ^{a}[\sigma _{j}].\end{aligned}}$
  
  Hence, for any j,
  
  $\mathbf {E} ^{a}[\sigma _{j}]\leq {\frac {1}{n}}{\bigR^{2}-|a|^{2}{\big )}.$
  
  Now let j → +∞ to conclude that $τ_K$ = $lim_{j→+∞}σ_j$ < +∞ almost surely and
  
  $\mathbf {E} ^{a}[\tau _{K}]={\frac {1}{n}}{\bigR^{2}-|a|^{2}{\big )},$
  
  as claimed.
  
  