# Derivative of the $f(x,y)=\min(x,y)$

I just encountered this function $f(x,y)=\min(x,y)$. I wonder what the partial derivatives of it look like.

-
A general rule of thumb is that to find the partial derivatives of functions defined by rules such as the one above (i.e., not in terms of "standard functions"), you need to directly apply the definition of "partial derivative". –  Amitesh Datta May 28 '12 at 23:47

$$f(x, y) = \min(x,y) = \begin{cases} x & \text{if } x \le y \\ y & \text{if } x \gt y \end{cases}$$

The function isn't differentiable along $y = x$, but the partial derivatives are straightforward otherwise.

$$\frac{\partial f(x, y)}{\partial x} = \begin{cases} 1 & \text{if } x \lt y \\ 0 & \text{if } x \gt y \end{cases}$$

$$\frac{\partial f(x, y)}{\partial y} = \begin{cases} 0 & \text{if } x \lt y \\ 1 & \text{if } x \gt y \end{cases}$$

Here is a plot of the function to help you see the derivatives and why it's not differentiable along $y = x$:

-
I bet you used Mathematica to produce this image. –  Koba May 29 '12 at 1:43
@Dostre Indeed I did! –  Ayman Hourieh May 29 '12 at 8:45

If $(a,b)$ is below the line $x=y$, then the function has value $y$ on a neighborhood of $(a,b)$, so the partial derivatives are \begin{align*} \left.\frac{\partial f}{\partial x}\right|_{(x,y)=(a,b)}&=0\\ \left.\frac{\partial f}{\partial y}\right|_{(x,y)=(a,b)} &= 1. \end{align*} Symmetrically, if $(a,b)$ is "above" the line $x=y$, then the function has value $x$ on a neighborhood of $(a,b)$, so the partial derivatives are: \begin{align*} \left.\frac{\partial f}{\partial x}\right|_{(x,y)=(a,b)}&=1\\ \left.\frac{\partial f}{\partial y}\right|_{(x,y)=(a,b)} &= 0. \end{align*}

If $(a,b)$ is on the line $x=y$, then the function has value $y$ as we approach along a constant $y$ direction from the right, and value $x$ if we approach along a constant $y$ direction on the left. So the partial with respect to $x$ is $1$ from the left and $0$ from the right, hence does not exist at $(a,b)$. Similarly for $y$.

So the function is differentiable away from the line $x=y$, with values as given above.

-
It refers to the partial derivatives of functions of two variables or more/simply multiple variables,with their notation $f\{x,y,z,.....\}$, depending on how many variables are given.this method can be done by differentiating with respect to individual variable (with respect to $x$,you fix $y$ and $z$ and treat them as constants, with respect to $y$, you fix $x$ and $z$ and treat them as constants and the same goes for $z$ $zd_n$ other given variables. We can also use the formula.