# A function that doesn't have a max/min in general, but does when restricted

1. Nov 16, 2011

### wisvuze

Hello, I'm trying to construct a function f from R^2 -> R where f is everywhere differentiable, doesn't have a local min at 0 but if I restrict the domain of f to any line through the origin, 0 will be a (strict) min at that point..
I've been fooling around with this, but I don't really have any good strategies for figuring out how to make this function. Any tips? thank you

2. Nov 16, 2011

### micromass

Staff Emeritus
Hmmm...

Intuitively, I think something like this could work:

$$f(x,y)=\left\{\begin{array}{cc} -e^{1/x^2} &\text{if}~y=x^2\\ 0 &\text{otherwise}\end{array}\right.$$

This isn't continuous everywhere. But I do think that it is differentiable in 0 (because the function $e^{1/x^2}$ is part of a bump function.

Now I guess we should just smooth the function up. I have a feeling it might work.

I'll think of a better example.