Function Optimization with Non-linear Constraint, Lagrange Multipliers Fails I am trying to maximize the function $A(x,y)=\frac{1}{2}(x(12-x)+y(13-y))$ subject to the constraint $x^2+(12-x)^2-y^2-(13-y)^2=0$.
My attempt:
$\begin{align*} \nabla A=\frac{1}{2}\langle 12-2x,\,13-2y\rangle &= \lambda\langle4x-24,\, -4y+26\rangle\\ \implies&\begin{cases} -x+6=\lambda(4x-24)\\-y+\frac{13}{2}=\lambda(-4y+26)\\x^2+(12-x)^2-y^2-(13-y)^2=0\end{cases}\end{align*}$
But clearly there is no solution due to the first two equations.
Using Wolfram Alpha, however, yields a maximum at $\displaystyle \left(\frac{17}{2},\,\frac{13}{2}\right)$ being $A=36$ and shows a nice little graph.
 A: First, let's re-explain why the first two equations are contradictory. The first equation gives us:
$$\lambda=\frac{-x+6}{4x-24}=-\frac 1 4$$
While the second equation gives us:
$$\lambda=\frac{-y+\frac{13} 2}{-4y+26}=\frac 1 4$$
However, what's important to realize here is that these two equations only work when $4x-24\neq 0$ and when $-4y+26\neq 0$. Therefore, in order to find a solution, we need to consider the other cases: $4x-24=0$ (i.e. $x=6$) and $-4y+26=0$ (i.e. $y=\frac {13} 2$).
Case 1: $x=6$
Let's plug $x=6$ into our constraint equation:
$$6^2+(12-6)^2-y^2-(13-y)^2=0\rightarrow y=\frac{13}{2}\pm \frac{5i}{2}$$
Thus, this equation has no real solutions, and this case can be ignored.
Case 1: $y=\frac {13} 2$
Let's plug $y=\frac {13} 2$ into our constraint equation:
$$x^2+(12-x)^2-\left(\frac{13}2\right)^2-\left(13-\left(\frac{13}2\right)\right)^2=0\rightarrow x=\frac 7 2 \text{ or } x=\frac{17}2$$
Thus, we have two critical points: $(\frac 7 2, \frac{13}2)$ and $(\frac{17}2, \frac{13}2)$. I will leave it to you to show these critical points are maximums.
A: For a constrained problem 
\begin{align}
\max{} & f(x,y) \\
& g(x,y)\le 0
\end{align}
you must write the Lagrangian:
$$
L(x,y,\lambda)=f(x,y)+\lambda g(x,y)
$$
Then you must find stationary points of your Lagrangian (attention this is only necessary conditions, see wiki)
\begin{align}
\partial_x L &= 0 = \partial_x f+ \lambda \partial_x g \\
\partial_y L &= 0 = \partial_y f+ \lambda \partial_y g \\
\partial_\lambda L &= 0 = g   
\end{align}
With your example, this is essentially computations:
$$
L(x,y,\lambda)=\frac{1}{2} ((12-x) x+(13-y) y)-\lambda 
   \left(x^2+(12-x)^2-y^2-(13-y)^2\right)
$$
your three equations are (after simplification):
\begin{align}
 -(-6 + x) (1 + 4 \lambda) &= 0 \\
\frac{1}{2} (-13 + 2 y) (-1 + 4 \lambda) &= 0\\
  -x^2-(12-x)^2+y^2+(13-y)^2 &=0 &\\
\end{align}
The (real) solutions are:
$$
(x,y,\lambda)=(\frac{7}{2},\frac{13}{2},-\frac{1}{4})
$$
and
$$
(x,y,\lambda)=(\frac{17}{2},\frac{13}{2},-\frac{1}{4})
$$
You can check that for these two solutions 
$$
f(\frac{7}{2},\frac{13}{2})=f(\frac{17}{2},\frac{13}{2})=36
$$
Extra: to check that these points are maximizers you must check that the Hessian of $f(x,y)$ is symmetric definite negative, which is clearly the case as:
$$
\nabla^2f=\left(\begin{array}{cc}-1& 0 \\ 0 & -1\end{array}\right)
$$
A: Let $x(12-x)=a$ and $y(13-y)=b$.
Thus, the condition gives $b=a+12.5$.
Also, we have
$$a=x(12-x)\leq\left(\frac{x+12-x}{2}\right)=36$$ and
$$b=y(13-y)\leq\left(\frac{y+13-y}{2}\right)=42.25,$$
which gives
$$a=b-12.5\leq42.25-12.5=29.75.$$
Id est, $$A(x,y)=\frac{1}{2}(a+b)=a+6.25\leq29.75+6.25=36.$$
The equality occurs for $b=42.25$ or $y=6.5$, which says that we got a maximal value.
