Min and max of a two variables function 
I consider the function
  $$f:\mathbb{R}^2 \to \mathbb{R}, \
(x,y) \mapsto \max\left(1-\sqrt{x^2+y^2},2-\sqrt{(x-6)^2+y^2},0\right).$$
  I have to find $\max$ and $\min$ (local and global).

I calculate where $1-\sqrt{x^2+y^2}=2-\sqrt{(x-6)^2+y^2}$ is an ellipse but I don't understand how find $\max$ and $\min$.
 A: Note that $1 - \sqrt{x^2 + y^2} > 0$ inside a circle of radius $1$ about the origin, and is $< 0$ outside that circle. Meanwhile $2-\sqrt{(x-6)^2+y^2} > 0$ inside a circle of radius $2$ about the point $(6, 0)$ and is $< 0$ outside. Since the centers of these circles are a distance of $6$ apart while the sum of the radii is only $3$. So these circles are disjoint.
Ergo, outside both circles and on the circles themselves, $0$ is the maximum. Inside the circle about $(0,0), 1 - \sqrt{x^2 + y^2}$ is the maximum. Inside the circle about $(6, 0), 2-\sqrt{(x-6)^2+y^2}$ is the maximum.
The minimum problem is more difficult. Since for any point one of the two functions is negative, $0$ is never the minimum. Now connect any point where $1 - \sqrt{x^2 + y^2} <2-\sqrt{(x-6)^2+y^2}$ to any point where $1 - \sqrt{x^2 + y^2} >2-\sqrt{(x-6)^2+y^2}$ with a line segment, and by the continuity of the two functions, somewhere along that line segment the two functions are equal. Thus if we identify where the two functions are equal, that curve will divide the plane into regions where either one or the other is less.
$$1 - \sqrt{x^2 + y^2} = 2-\sqrt{(x-6)^2+y^2}\\
\sqrt{(x-6)^2+y^2} = 1 + \sqrt{x^2 + y^2}\\
x^2-12x + 36+y^2 = 1 + x^2 + y^2 + 2\sqrt{x^2 + y^2}\\
35 - 12x = 2\sqrt{x^2 + y^2}\\
1225 - 840x + 144x^2 = 4x^2 + 4y^2\\
140(x^2 - 6x + 9) - 4y^2 = (9)(140) - 1225\\
140(x - 3)^2 - 4y^2 = 35$$
So the two functions are equal on a hyperbola. But note that the calculation isn't reversable. So not every point on the hyperbola may be a place the two functions are equal. In particular, when $y = 0$, we get that $|x - 3| = 1/2$
Now $$1 - \sqrt{2.5^2 + 0^2} = -1.5\\2-\sqrt{(2.5-6)^2+0^2} = -1.5$$ but $$1 - \sqrt{3.5^2 + 0^2} = -2.5\\2-\sqrt{(3.5-6)^2+0^2} = -0.5$$
So the two functions are equal only on the arc of the hyperbola through $(2.5, 0)$. Namely when $$x = 3 - \sqrt\frac{35 - 4y^2}{140}$$
Ergo, when $x < \sqrt\frac{35 - 4y^2}{140}, 2-\sqrt{(x-6)^2+y^2}$ is minimum, when $x > \sqrt\frac{35 - 4y^2}{140}, 1 - \sqrt{x^2 + y^2}$ is minimum, and when $x = 3 - \sqrt\frac{35 - 4y^2}{140}$, the two are equal, so either one could be taken as minimum.
