Derivative of a function defined by parts involving dirac delta

36 Views Asked by At

Given a function $$\rho (x_1,x_2,x_3,t)=\begin{cases} \rho_1,\text{ if } x_3 \geq f(x_1,x_2,t) \\ \rho_2,\text{ otherwise}\end{cases}$$ I found its gradient as $$\nabla \rho = (\rho_2 - \rho_1) (\partial_{x_1}f(x_1,x_2,t),\partial_{x_2}f(x_1,x_2,t),-1)\delta(x_3 -f(x_1,x_2,t)).$$ Could anyone explain how is this obtained?