Suppose a cost function $J$ is defined as follows, $J=J(U(\alpha),\alpha)$ where $U$ and $\alpha$ are the flow variable vector and the design variable vector respectively. $U$ and $\alpha$ are implicitly related through the flow equation, which is represented by a residual function driven to zero. $R(U(\alpha),\alpha)=0$ Finite difference method: