Let

- $ f\in C^3(\mathbb R)$ with $ f>0$
- $ g:=\ln f$ (and assume $ g’$ is Lipschitz continuous)
- $ n\in\mathbb N$ , $ $ s(x,y):=\sum_{i=1}^n\left(g(y_i)-g(x_i)\right)$ $ and $ $ h(x,y):=\min\left(1,e^{s(x,\:y)}\right)$ $ for $ x,y\in\mathbb R^n$
- $ x\in\mathbb R^n$ and $ Y$ be a $ \mathbb R^n$ -valued normally distributed random variable on a probability space $ (\Omega,\mathcal A,\operatorname P)$ with mean vector $ x$ and covariance matrix $ \sigma I_n$ for some $ \sigma>0$ ($ I_n$ denoting the $ n\times n$ identity matrix)

I want to make the following argumentation rigorous: By Taylor’s theorem, \begin{equation}\begin{split}h(x,Y)-h(x,(x_1,Y_2,\ldots,Y_n))&=\frac{\partial h}{\partial y_1}(x,(x_1,Y_2,\ldots,Y_n))(Y_1-x_1)\&=\frac12\frac{\partial^2h}{\partial y_1^2}(x,(Z_1,Y_2,\ldots,Y_n))(Y_1-X_1)^2\end{split}\tag1\end{equation} for some real-valued random variable $ Z_1$ with $ Z_1\in[\min(x_1,Y_1),\max(x_1,Y_1)]$ . Thus, \begin{equation}\begin{split}\left.\operatorname E\left[h(x,(y_1,Y_2,\ldots,Y_n))\right]\right|_{y_1\:=\:Y_1}&=\operatorname E\left[\min\left(1,e^A\right)\right]+g'(x_1)\operatorname E\left[1_{\left\{\:A\:<\:0\:\right\}}e^A\right](Y_1-x_1)\&+\frac12(g”(Z_1)+\left|g'(Z_1)\right|^2)\left.\operatorname E\left[1_{\left\{\:B\:<\:0\:\right\}}e^B\right]\right|_{z_1\:=\:Z_1}(Y_1-x_1)^2.\end{split}\tag2\end{equation} Above, I wrote $ $ A:=\sum_{i=2}^n(g(Y_i)-g(x_i))$ $ and $ $ B:=g(z_1)-g(x_1)+\sum_{i=2}^n(g(Y_i)-g(x_i))$ $ in order to make the equation more readable (you need to replace them where they occur).

**Question 1**: There are two issues: The first one is that $ (x,y)\mapsto\min(x,y)$ is partially differentiable in both arguments except on the diagonal $ \Delta_2:=\left\{(x,y)\in\mathbb R^2:x=y\right\}$ . Are we able to conclude the existence of $ Z_1$ anyway? Note that $ $ \frac{\partial h}{\partial y_1}(x,y)=\begin{cases}\displaystyle g'(y_1)e^{s(x,\:y)}&\text{, if }s(x,y)<0\0&\text{, if }s(x,y)>0\end{cases}\tag3$ $ and $ $ \frac{\partial^2h}{\partial y_1^2}(x,y)=\begin{cases}\displaystyle(g”(y_1)+|g'(y_1)|^2)e^{s(x,\:y)}&\text{, if }s(x,y)<0\0&\text{, if }s(x,y)>0\end{cases}\tag4$ $ for all $ y\in\mathbb R^n$ .

**Question 2**: The second issue is the case $ s(x,y)=0$ . In order for $ (3)$ to hold, we need to show that the probability of the corresponding event is $ 0$ (this seems to be related to the question whether the set on which the occurring function is not differentiable has Lebesgue measure $ 0$ ; and it’s clear that $ \Delta$ has Lebesgue measure $ 0$ ). How can we do that?

While it’s clear that $ h$ is partially differentiable with respect to the second variable except on a countable set, it is not clear to me why $ h$ is even twice differentiable with respect to the second variable except on a set (at least) of Lebesgue measure $ 0$ (see this related question).