How to take the partial derivative of $f(x,y) = x\ln(x) + y\ln(y), x + y = 1$?

738 Views Asked by At

Let $f(x,y) = x\ln(x) + y\ln(y)$ be defined on space

$S = \{(x,y) \in \mathbb{R}^2| x> 0, y > 0, x + y = 1\}$.

My question is, how do I take the partial derivative for this function, given that the parameters are coupled through $x+y = 1$.

A first idea would be to do it ignoring the coupling constraint. For this, we will get,

$\dfrac{\partial f(x,y)}{\partial x} = \dfrac{\partial x\ln(x) + y\ln(y)}{\partial x} = \ln(x) + x/x = \ln(x) + 1$

If we do not ignore the coupling constraint, and instead substitute $y = 1-x$, we will get,

$\dfrac{\partial f(x,y)}{\partial x} = \dfrac{\partial x\ln(x) + (1-x)\ln(1-x)}{\partial x} = \ln(x) + 1 + \dfrac{1}{1-x} - \ln(1-x) - \dfrac{x}{1-x}$

Am I doing this correctly?

Why do I get two different expressions of the gradient?

2

There are 2 best solutions below

3
On

You can't use $y=1−x$, these variables are independent. Although we choose our points from $$S = \{(x,y) \in \mathbb{R}^2| x> 0, y > 0, x + y = 1\}$$ but it doesn't mean these variables are dependent. Then the substitute $y = 1-x$ makes no sense in this two variables function.

0
On

Taking the partial of $f(x,y)$ with respect to $x$ means that you vary $x$ while holding $y$ constant, but you can't do that if you insist on fulfilling the constraint $x+y=1$, so it's doesn't really make sense to talk about partial derivatives in this situation.

(You can eliminate $y$ and get a one-variable function $g(x)=f(x,1-x)$, but what you are computing then is an ordinary derivative $g'(x)$.)