# How to find the greatest value of the function?

$$f(x, y)=x^2+y^2,\quad x,\;y \ge 0,\quad 3x+2y \le 6$$

The max value is in the point $(0, 3)$, but how do I prove it? I may be able to prove that the function decreases on the curve $x(t)=2t,\; y(t)=3-3t$, but I don't know how.

-
Clearly the maximum occurs on the boundary $3x+2y=6$. Plug it in, solve for $y$, take a derivative and set it equal to 0. –  user7530 Jan 21 '13 at 19:41
It does, but not in a stationary point. –  dragostis Jan 21 '13 at 19:43
Ah, you also have to check the boundaries $x=0$ and $y=0$. –  user7530 Jan 21 '13 at 19:46
In general, the sledgehammer here is to use the method of Lagrange multipliers, which will always work. But by recognizing properties of the problem (ie, that the objective function is radial and has no local maxima) you can save yourself a lot of work. –  user7530 Jan 21 '13 at 20:04

As always, pictures provide a great way to see what is happening. I will let you fill in rigorous arguments to make this into a proof.

EDIT

There are many ways to make this into a rigorous proof. Below is one way. Say the maximum of $x^2+y^2$ is $a^2$. Then we have that $x = a \cos(\theta)$ and $y = a \sin(\theta)$. The constraint enforces that $\theta \in [0, \pi/2]$ and $$3a \cos(\theta) + 2a \sin(\theta) \leq 6 \implies a (3 \cos(\theta) + 2 \sin(\theta)) \leq 6$$ Since, we want to maximize $a$, we want to minimize $(3 \cos(\theta) + 2 \sin(\theta))$ in the domain $\theta \in [0, \pi/2]$. Now this is a simple calculus problem in one variable. Find the derivative and set it equal to zero and check the boundary points to figure out the minimum of $(3 \cos(\theta) + 2 \sin(\theta))$. This will give you that the minimum occurs at $\theta = 0$. Hence, the maximum value of $a$ is $3$. Hence, the maximum value of $x^2 + y^2$ is $9$.

-
It states what I mentioned, that $(0,3)$ is the maximum. But how to prove it? –  dragostis Jan 21 '13 at 19:45

Since $$f(x,y) \ge 0=f(0,0) \quad \forall\ (x,y) \in \mathbb{R}^2,$$ the function $$f: \mathbb{R}^2 \to \mathbb{R},\ f(x,y)=x^2+y^2$$ has a global minimum at $(0,0)$, therefore the maximum of $f$ on the compact set $$K=\{(x,y) \in \mathbb{R}^2:\ x,y \ge 0,\ 3x+2y\le 6\}$$ is on its boundary $$\partial K=\{0\}\times[0,3]\cup[0,2]\times\{0\}\cup\{(t,-\frac32t+3):\ 0 \le t\le 2\}.$$ We have \begin{eqnarray} f(x,y)&\le&9=f(0,3) \quad \forall\ (x,y) \in \{0\}\times[0,3]\\ f(x,y)&\le&4=f(2,0) \quad \forall\ (x,y) \in [0,2]\times\{0\}, \end{eqnarray} and for every $t \in [0,2]$ we have \begin{eqnarray} \phi(t)&:=&f(t,-\frac32t+3)=t^2+\Big(-\frac32t+3\Big)^2 \le \max\{\phi(0),\phi(2)\}=9=\phi(0). \end{eqnarray} Hence $$\max_{K}f=9=f(0,3).$$

-

$f$ is critical when the gradient is $(0,0)$; that is, $$\nabla(x^2+y^2)=(2x,2y)=(0,0)$$ $(0,0)$ is on the boundary of the triangle $x\ge0$, $y\ge0$, and $3x+2y\le6$.

An extremum can also be attained on the boundary where the gradient is perpendicular to the boundary.

On $x=0$, where the boundary is parallel to $(0,1)$ so we are looking for a point where $$(2x,2y)\cdot(0,1)=0$$ Again, we have $(x,y)=(0,0)$.

On $y=0$, where the boundary is parallel to $(1,0)$, we are looking for a point where $$(2x,2y)\cdot(1,0)=0$$ Yet again, we have $(x,y)=(0,0)$.

On $3x+2y=6$, where the boundary is parallel to $(2,-3)$, we are looking for a point where $$(2x,2y)\cdot(2,-3)=0$$ $3x+2y=6$ and $4x-6y=0$ intersect at $\left(\frac{18}{13},\frac{12}{13}\right)$.

The other points are the singular points of the boundary (the vertices of the triangle): $(0,0)$, $(2,0)$, and $(0,3)$.

Checking each of these possibilities, we get \begin{align} f(0,0)&=0\\ f\left(\frac{18}{13},\frac{12}{13}\right)&=\frac{36}{13}\\ f(2,0)&=4\\ f(0,3)&=9 \end{align} Therefore, $f(0,3)=9$ is the maximum.

-