a point in a region closest to a given point Let $K=\{(x,y) : |x|+|y| \le 1\}$. Let $p= (-2,2)$. Find the point in $K$ which is closest to $p$.
Here the region is  a square. . I can use calculus after a function is developed . But I am unable to do so.
What i did, was I found the distance from $(-2,2)$ to the line $-x+y=1$ which gives $\frac{3}{\sqrt{2}}$. Because to any other line the distance would be more than this. Then I assumed two points $(x,y)$ on this line and used distance formula to get $(x+2)^2+(y-2)^2=\frac{9}{2}$. Together with the equation $-x+y=1$ I solved to obtain $x=-\frac{1}{2}$ and $y=\frac{1}{2}$, which is the required solution.
I want to know if I could use calculus somewhere, kind of find a function which could be differentiated to obtain the points. 
 A: Draw the picture. The first quadrant part is easy. The boundary there is the line $x+y=1$. Draw the segment of this line that joins $(1,0)$ to $(1,0)$.
For the other quadrants, first reflect the first quadrant part across the $y$-axis, and then the combination around the $x$-axis. We get a square that looks like a "diamond." Sort of.
Now locate the point $(-2,2)$. By geometry (symmetry) the line that joins this to the origin meets the second-quadrant part of the boundary at right angles.  So the minimum distance is the distance between $(-2,2)$ and (-1/2,1/2)$. Now we can find this minimum distance.
If we really want to use calculus, the boundary in the second quadrant is a line with slope $1$ going through $(-1,0)$. So the second-quadrant boundary line of our diamond has equation $y=x+1$.
The square of the distance from the generic point $(x,x+1)$ on this line is equal to
$$(x-(-2))^2 +(x+1-2)^2.$$
Expand, differentiate. When we expand we get $2x^2+2x+5$. The derivative is $0$ at $x=-\frac{1}{2}$.  
A: We know that the distance between a compact set and a point (outside the set) occurs on the boundary of the compact set. Since your region is compact, it suffices to check the boundary of the square. You can do this methodically using the tools from calculus if you parameterize each side of the square in some way, find the value of the parameter that gives minimal distance for each side, then find the minimal distance for each side of the square and then take the minimum among all sides.
So for example we know that the upper left side is parameterized by $y-x = 1$. If we let $x$ be a parameter $t$ ranging from $-1$ to $0$ then we have $y = t+1$. The distance function is then
$$d((x,y))^2 = (x+2)^2 + (y-2)^2 = (t+2)^2 + (t-1)^2 = d(t)^2$$
If we differentiate this with respect to $t$ we get that
$$2d(t)d'(t) = 2(t+2) + 2(t-1) = 4t + 2.$$
Setting this to $0$ we get that $t = -\frac{1}{2}$. Plugging this into our expression for $x$ and $y$ we get that the minimum occurs at $(-\frac{1}{2},\frac{1}{2})$. Plugging this into $d(t)$ we get that $d(-\frac{1}{2}) = \frac{5}{2}$.
Do this for the other three sides and then find the one that gives you the minimum. (Clearly this is way overkill but it's the way to do it using purely calculus and ignoring geometric reasoning.)
