Let $(T,\mathcal T,\tau)$ be a measure space, $a,b\ge0$, $s,t\in T$ and $$f(x):=a\min(x(s),bx(t))\;\;\;\text{for }x\in L^2(\tau).$$



> 
> How can we calculate the [generalized gradient](https://pdf.sciencedirectassets.com/272585/1-s2.0-S0001870800X02502/1-s2.0-0001870881900323/main.pdf?X-Amz-Security-Token=AgoJb3JpZ2luX2VjEMD%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJIMEYCIQDncC3kz2PE7TC8KlgxOrKGXZboogmvjd%2FWr3oL3dR8TgIhAO8c6uJpTlXb9BVyFg091nHZAVaJXBNMXIiwuBN1mXXyKuMDCIn%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEQAhoMMDU5MDAzNTQ2ODY1Igx0g%2BgnzEdovUHHPU8qtwPLOK0uSYKkcP7Epkqzua2wNo0VVHHF379AxjWXRGpFY2cM081ElPcXHr1WZQtCbSIGpdbavxbfPcTqlJuYSevJkksJT%2FlTmwcNxrSw9bpWhjw2DhX%2B3fqk1GRnZ38Lsvfcqhrlt2rNspAWIQe%2F93eD4Sii8P%2BZFbMjgkDuvISlsym0wzORJ%2B%2FTxeH5w4mdIq4gMQ1Vbgw6LV%2FBcxx5sydeS9Vyd3PFh5ZMl5H5uH71ZBRO2gLXBK2RHLGHk5oipEf%2B5EPIrNfnu2eYRQnFFmxrrD5gqAO1ZVhUh%2BrDgpHjNV6XqvSRHFOH7F6LqVJv%2FOlW5UhnrXfewMQVprtXQ8054GHH3WEgx%2FqWQML%2F957vcYRFPrVCrm8VTb7%2B3AtsY8rOcN%2F00%2F11Zg6wd1LYJR8iG714rurZzbEWqOlLEzoJaPNTLP1vwRBkb%2B91%2FLVaT9CjSqULYvMaTldbq%2FMqney8QmpTo6mUQeqYwD2b%2BNk8GXYpIPeKBLy2Mrtnub8BuznaLqv%2FVSBUtdUuqFAPjIc90dsf15KvkFpuriZN4IZb3OJh%2B5Fi%2Bgw29Oa9WF%2BA8K3OfD%2FTEhj8MOG6h%2BwFOrMB1oE6S0%2FJS%2BJ%2BPfsR2be%2F8gKCc4EDj8IVnr%2BZuSOMvbIhoxhywZqpXDvGS8MNgJv4axqZ2OL2CSBcjs7SfOazxHzmcRBqL9veYQi5e0sUL0F6X%2BoD%2FRukrdisUZMuNXF%2FDDE%2BMIcuefsmOHVTd0DR1hUuZTSZi%2B5Oqj%2BSTqhE6YrwX6Ewtx%2BgV1dJMJf91cQlT7wEZU%2FKvVYrOrDE6d4IkUniYnNnIW11n5%2B4metofUYDjhY%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20190918T084923Z&X-Amz-SignedHeaders=host&X-Amz-Expires=300&X-Amz-Credential=ASIAQ3PHCVTYZ5D4I5AJ%2F20190918%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=3794a3cd286dac45255e2a59e02bd53c8def7f8f6c193d95480e0f6d7be8fb67&hash=33ba1fda1dfb5fb50522e5f436a6cd1f37852dec06e1854e80f94e5019494ea5&host=68042c943591013ac2b2430a89b270f6af2c76d8dfd086a07176afe7c76c2c61&pii=0001870881900323&tid=spdf-d0e3327f-85c2-421d-a45c-8e6f4ab0cf5d&sid=b376c27b7e56944aa038dc543f341a6f5a61gxrqa&type=client) $\partial\_Cf(x)$ of $f$ at $x\in L^2(\tau)$?
> 
> 
> 


We may note that $2\min(u,v)=u+v-|u-v|$ for all $u,v\in\mathbb R$. Now the only point on which $\mathbb R\ni u\mapsto|u|$ is not differentiable (in the classical sense) is $0$, but the generalized gradient at $0$ is easily seen to be $[-1,1]$. Moreover, $\mathbb R\setminus\{0\}\ni u\mapsto|u|$ is continuously differentiable and the generalized gradient at $x\in\mathbb R\setminus\{0\}$ is simply $\{x/|x|\}$. This knowledge should be helpful. However, I'm new to this topic and have no idea how to tackle the problem.


**EDIT**: As [Iosif Pinelis pointed out](https://mathoverflow.net/a/341920/91890), we need to assume that the singletons in $(T,\mathcal T,\tau)$ are measurable and admit positive measure to ensure that $f$ is locally Lipschitz continuous.



How can we calculate the generalized gradient of $L^2\ni x\mapsto a\min(x(s),by(t))$?
$\newcommand{\de}{\delta}$
The notion of the generalized gradient, as defined in Clarke's paper linked in your question, is applicable only to Lipschitz functions. In general, depending on your measure space, your function $f$ will not be Lipschitz, because the evaluation functional $L^2(\tau)\ni x\mapsto\de\_s(x):=x(s)$ for $s\in T$ will not be Lipschitz in general. Therefore, the generalized gradient of your function $f$ will be undefined in general. In particular, it will be undefined if your measure $\tau$ is non-atomic. 




---


However, we have $\|x\|\_2\ge\tau(\{r\})^{1/2}|x(r)|$ for all $r\in T$. So, if $\tau(\{r\})>0$, then the evaluation functional $\de\_r$ is bounded and hence Lipschitz. So, assuming now that $\tau(\{s\})>0$ and $\tau(\{t\})>0$, we see that your nonlinear function(al)
\begin{equation\*}
 f=\min(\de\_s,b\de\_t)
\end{equation\*}
is Lipschitz. (I am assuming $a=1$, without loss of generality.) 
Moreover, then the generalized (upper) directional derivative of $f$ at $x\in L^2(\tau)$ in the direction $v\in L^2(\tau)$ is 
\begin{multline\*}
 f^0(x;v):=\limsup\_{y\to x,h\downarrow0}\frac{f(y+hv)-f(y)}h \\ 
 =\left\{\begin{aligned}
 v(s)&\text{ if }x(s)<bx(t), \\
 bv(t)&\text{ if }x(s)>bx(t), \\
 \max[v(s),bv(t)] &\text{ if }x(s)=bx(t); 
 \end{aligned}\right. \tag{1}
\end{multline\*}
see details on this at the end of this answer; here I am using the (somewhat strange to me) notation $f^0(x;v)$ from the linked paper by Clarke. 


So, the generalized gradient is $\{\de\_s\}$ if $x(s)<bx(t)$ and $\{b\de\_t\}$ if $x(s)>bx(t)$.


Consider now the case $x(s)=bx(t)$: 


Consider first the subcase $s\ne t$. We have 
$$\max(v\_s,bv\_t)\ge Av\_s+Bv\_t\quad\text{for all real }v\_s,v\_t
$$
iff $0\le A\le1$ and $B=(1-A)b$. So, if $x(s)=bx(t)$ and $s\ne t$, then the generalized gradient is the set of all linear functionals $\ell$ given by the formula 
$$\ell(v)=Av(s)+(1-A)bv(t)\quad\text{for }v\in L^2(\tau)
$$
with $A\in[0,1]$. 


If $s=t$, $\tau(\{t\})>0$, and $x(t)=bx(t)$ (that is, either $b=1$ or $x(t)=0$), then 
$f^0(x;v)=\max[v(t),bv(t)]$ and the generalized gradient is the set of all linear functionals $\ell$ given by the formula 
$$\ell(v)=Av(t)\quad\text{for }v\in L^2(\tau)
$$
with $A\in[\min(1,b),\max(1,b)]$. 


**Details on (1):** If for a function $x\in L^2(\tau)$ with $\tau(\{s\})>0$ and $\tau(\{t\})>0$ we have $x(s)<bx(t)$, and a function $y\in L^2(\tau)$ is close enough to $x$, and real $h>0$ is small enough, then $y(s)+hv(s)<by(t)+bhv(t)$ and $y(s)<by(t)$, so that 
$f(y+hv)-f(y)=y(s)+hv(s)-y(s)=hv(s)$, 
and hence $f^0(x;v)=v(s)$, in the case $x(s)<bx(t)$. 
Similarly, $f^0(x;v)=bv(t)$ in the case $x(s)>bx(t)$. 


To complete the proof of (1), it remains to consider the case $x(s)=bx(t)$. Then the function $x\in L^2(\tau)$ can be however closely approximated by functions $\check x$ and $\hat x$ in $L^2(\tau)$ such that $\check x(s)<b\check x(t)$ and $\hat x(s)>b\hat x(t)$, so that, by what has just been shown, $f^0(\check x;v)=v(s)$ and $f^0(\hat x;v)=bv(t)$. Letting now $\check x\to x$ and $\hat x\to x$ and using the upper semincontinuity of $f^0(\cdot;\cdot)$ (which is item 4 of the list on page 54 in the linked paper by Clarke), we conclude that 
\begin{equation\*}
 f^0(x;v)\ge\max[v(s),bv(t)]. \tag{2}
\end{equation\*}
On the other hand, for any $y\in L^2(\tau)$ and real $h>0$, 
\begin{multline\*}
 f(y+hv)-f(y)=\min[y(s)+hv(s),by(t)+bhv(t)]-\min[y(s),by(t)] \\ 
 \le\max[hv(s),bhv(t)],
\end{multline\*}
by the inequality $\min[z\_1,w\_1]-\min[z\_2,w\_2]\le\max[z\_1-z\_2,w\_1-w\_2]$ for real $z\_1,w\_1,z\_2,w\_2$. 
So, 
\begin{equation\*}
 f^0(x;v)\le\max[v(s),bv(t)]. \tag{3}
\end{equation\*}
Finally, by (2) and (3), we get $f^0(x;v)=\max[v(s),bv(t)]$, in the case $x(s)=bx(t)$. 


