optimization, local/global maximizers/minimizers

I'm a bit confused on this question, I've had a go at it and any help would be much appreciated.

Determine all the optimal points of the following function, and indicate whether the optimal solutions are global or local:

$$f(x) = \left\{ \begin{array}{l l} x^2+1 & \quad -1 \leq x \leq 0\\ x & \quad 0 \leq x \leq 1 \end{array} \right.$$

This is what I have tried so far:

Stationary points:

$$f'(x) = \left\{ \begin{array}{l l} 2x=0 & \quad \Rightarrow x=0\\ 1=0 & \quad \Rightarrow 1 \neq 0 \end{array} \right.$$

Boundary points: $x=-1$ and $x=1$.

Non-differentiable points: $f(0) = 0$, $f(-1) = 2$, $f(1)=2$.

I have followed the technique used by my teacher but not sure where to go from here...

Many thanks in advance for any help.

-

The definition of the function is not correct. You say $f(x)=x^2+1$ for $-1\le x\le 0$ and $f(x)=x$ for $0\le x\le 1$.

Note that you have defined $f(x)$ in two inconsistent ways at $x=0$.

The definition may be $x^2+1$ for $-1\le x\le 0$ and $f(x)=x$ for $0\lt x\le 1$.

Or maybe it is $x^2+1$ for $-1\le x\lt 0$ and $f(x)=x$ for $0\le x\le 1$.

Do check what was written in the actual problem. If it was exactly as you wrote, there is a mistake in the problem.

Whatever the value at $0$ is, the function is decreasing, then increasing. The derivative can tell you that, but you really don't need the derivative.

So the only possible places where the minimum or maximum could be reached are at endpoints $-1$ and $1$, and at the point $0$ where the function is not continuous.

So calculate $f(-1)$, $f(0)$, and $f(1)$. Which is biggest? Which is smallest?

-
f(-1)=f(1)=2 (biggest), f(0)=1 (smallest). what does that suggest? – user54511 Apr 8 '13 at 12:26
You have not corrected the definition of $f$. How is it defined at $0$? Certainly $2$ is the maximum value, attained at $x=-1$. I need to know the actual definition, with typo correction. Is it $x^2+1$ for $-1\le x\lt 1$ and $x$ for $0\le x\le 1$? Then the min value is $0$, reached at $x=0$. Or is it $x^2+1$ for $-1\le x\le 0$ and $x$ for $0\lt x\le 1$? Then there is no minimum. – André Nicolas Apr 8 '13 at 13:27
sorry you were right it is: $-1\leq x < 0$ for $x^2+1$ and $0\leq x \leq 1$ for $x$ – user54511 Apr 8 '13 at 15:29
The answer is then covered by my comment above. The min. value is $0$, reached at $0$. The fact that the derivative of $x^2+1$ is $0$ at $0$ is completely irrelevant. – André Nicolas Apr 8 '13 at 16:36