# How to compute greeks using the adjoint Monte Carlo approach?

Assume I have a stochastic ODE $$dS = a(S)dt + b(S)dW,$$ with Euler approximation $$\hat{S}_{n+1}=F_n(\hat{S}_n)=\hat{S}_n+a(\hat{S}_n)h+b(\hat{S}_n)Z_n\sqrt{h}.$$ This allows me to create sample paths based on drawing normally distributed random numbers $Z_n$ from $N(0,1)$.

Now the estimated value of my option is $$\hat{V}=\frac{1}{N}\sum_i f(S^i_T)$$ where $f$ is the payoff function and $S^i_T$ is the i-th sample path of the process at time $T$.

Assume the ODE and $f$ have various parameters, for example starting value $S_0$, risk-free interest rate $r$ and volatility $\sigma$. Furthermore, f is sufficiently continous such that the derivatives

$$D_n=\frac{\partial F_n(\hat{S}_n)}{\partial \hat{S}_n }$$

exist.

Based on these quantities, how can I compute sensitivities using the adjoint method?