-1

If I want to find the minimum of $f(x) = x^2$ subject to the constraint $g(x) = 2x + 1 = 0$, then I would first isolate $x$ from $g$ and insert into $f$:

$$ 2x + 1 = 0\\ x = -1/2 $$

So $$ f(x) = x^2 = (-1/2)^2 = 1/4 $$

And now set the first derivative equal $0$:

$$ df/dx (-1/4) = 0 $$

So the derivative is constant zero.

But clearly, the constrained minima are not zero: enter image description here

Where is the approach wrong?

TMOTTM
  • 177
  • 2
    If $2x+1=0$ then $x=-\frac12$ so $f(x)=\frac14;$ that's it – J. W. Tanner May 30 '19 at 20:45
  • Also, the derivative is not zero: $f'(x = -1/2) = 2*(-1/2) = -1.$ – D.B. May 30 '19 at 20:46
  • This is not clear. As others have remarked, the constraint gets you down to a single value, so the optimization is trivial. Did you mean to ask something else? – lulu May 30 '19 at 20:50

3 Answers3

1

$g(x)$ defines your feasible set. Solving it, gives you the answer.

Duns
  • 758
  • 5
  • 16
1

In the question as stated, there is only one variable.

If $g(x)=2x+1=0,$ then $x=-\frac12,$ so $f(x)=\frac14;$ that's it!

J. W. Tanner
  • 60,406
1

Your step of "setting the first derivative to 0" is logically incorrect. The function $f$ is already given and thus $f'(x)$ at $x=-1/2$ is already set [and is nonzero]; informally speaking you can't "make" $f'(x)$ be 0 at $x=-1/2$. I am guessing that you were concerned that $f'(-1/2)$ was nonzero, and were trying to find the value of $x$ so that $f'(x) = 0$?

More generally, the minimum of a function $f$ over a domain $S$ can occur at a point $x$ in the domain that does NOT satisfy $f'(x)=0$. There are even instances for $f$ and $S$ where $S$ contains a point $x_1$ that satisfies $f'(x_1) = 0$ yet $f$ achieves its minimum not at $x_1$ but at another point $x_2$ where $f'(x_2)$ is nonzero. For example, the minimum of $f(x)=x^2$ on $S = [2,4]$ occurs at $x=2$, and the minimum of $h(x) = x^3$ on $S = [-1,1]$ occurs at $x=-1$.

Anyway, getting back to this specific exercise, the way to solve this is to find the (one) point $x$ satisfying $g(x)=0$, and plug that value of $x$ i.e., $x= -1/2$ into $f(x)$ i.e., calculate $f(-1/2)$, to get that the minimum value of $f(x)$ restricted to $g(x)=0$ is $f(-1/2) = 1/4$.

Mike
  • 20,434