# 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". Commented May 28, 2012 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
Commented May 29, 2012 at 1:43
• @Dostre Indeed I did! Commented May 29, 2012 at 8:45
• @AymanHourieh, the function is not differentiable along the line $x = y$, but is there a directional derivative along this line, i.e. along vector (1,1)? Commented Apr 5, 2018 at 18:15
• Is there any scientific paper or book that I could cite for using this partial differentiation? Commented Jan 18, 2021 at 14:18
• @garej If you allow $min(x,y)=x=y$ for the condition $x=y$, then the derivative is 1 for both axes. Commented Apr 15, 2023 at 18:24

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.

• How does this answer the question? Commented Feb 13, 2013 at 16:37