<s>[INST] Minimum value of a function with two variables. Suppose I have a curve (for example $(x-2)^2 + (y-2)^2 = 1$. I want to find the point on the curve where $x+y$ (or any other expression say $x^2+y^2$ ) is minimum.  How can I do it ?
P.S:- I know the method to find minimum and maximum for a two variable function but I don't understand the above case.
 [/INST] A) Consider the extremal values of 
$x^2 + y^2$ for points on the circle.
A bit Geometry:
$(x-2)^2 + (y-2)^2 = 1$ is a circle with center $(2,2)$ and radius $= 1$.
The straight line $y = x$ is a symmetry axis for this circle, it passes through $(0,0)$ and the centre $(2,2)$, and intersects the circle twice.
For any point $(x,y)$ on the circle, $(x^2 + y^2)$ is the squared distance from the origin.
The shortest and longest squared distances from $(0,0)$ to the circles  are the points of intersection of the line $y = x$ with the circle:
$$(x-2)^2 + (y-2)^2 = 1\tag 1$$
$$y =  x \tag 2$$ Combining $(2)$ and $(1)$ gives:
$$(x-2)^2 + (x-2)^2 = 1$$
$$2 \times (x-2)^2 = 1 ;$$
Two solutions:
$$x_1 = 2 - \frac {\sqrt 2} 2$$ $$x_2 = 2 + \frac {\sqrt 2} 2$$
$y_1 = x_1$ and $y_2 = x_2$ (cf. eq. 2)
Min squared distance : 
$$(x_1)^2 + (y_1)^2 = 2 \times (x_1)^2 = 2 \times ( 4 + \frac 1 2 - 2 \sqrt 2) = 9 - 4 \sqrt 2$$
Max  squared distance :
$$(x_2) ^2 + (y_2)^2 = 9 + 4 \sqrt 2$$
$$9 - 4\sqrt 2 \le x^2 + y^2 \le 9 + 4 \sqrt 2$$
B) Now to the extremal values for $x + y$ for points on the circle.
Consider the straight line 
$$y = - x + C\tag; $$
where $C$ is the $y$-intercept, i.e. y-value for $x = 0$. This line is perpendicular to the axis of symmetry $y = x$.
Points of intersection of $y = - x + C$ with the circle, are 
$(X,Y)$, inserting :
$Y+ X = C$
So finding the smallest and largest  y- intercept $C$, with
 $y = -x + C$ intersecting the circle, will solve the problem.
$C (min)$ :  $y = -x +C$ passes through $(x_1,y_1)$ .
$C( max)$: $y= -x + C$ passes through $(x_2,y_2)$.
Inserted: 
$$C( min) = 2\times( 2 - \frac{\sqrt2}2);$$
$$C( max) = 2\times(2 + \frac{\sqrt2}2).$$
Finally we get:
$4 - \sqrt2  \le  x + y  \le  4 + \sqrt2$
Comments welcome.
</s>