# Optimize function: Lagrange multipliers

I have a function of 4 variables: (distance function)
$d(x,x_1,y,y_1 )=(x-x_1 )^2+(y-y_1 )^2$

subject to 2 constraints:
1. $g(x,x_1,y,y_1 )=ax^2+2hxy+2gx+by^2+2fy+c=0$
2. $h(x,x_1,y,y_1 )= a_1 x_1^2+2h_1 x_1 y_1+2g_1 x_1+b_1 y_1^2+2f_1 y_1+c_1=0$

Using lagrange multipliers, and partial differentiation, what should be the values of $x,x_1,y,y_1$ in terms of $a,b,c,a_1,b_1,c_1,f,g,h,f_1,g_1,h_1$, with aforementioned constraints?

-
Have you tried writing down the gradients of all functions involved and coming up with an equation for the Lagrange multipliers? –  Alex R. Sep 9 '12 at 1:01
Yes I have tried and I have come up with equations. That was the easy part actually, the hard part is to find values of x,x1,y,y1, with which I'm struggling up to now. –  David Hoffman Sep 9 '12 at 20:49

Let $\nabla F= \langle \partial_x F, \partial_{x_1} F, \partial_y F, \partial_{y_1} F \rangle$. The method of Lagrange in this case requires the introduction of two multipliers. We should solve:

$$\nabla d = \lambda_1\nabla g+ \lambda_2\nabla h$$

subject to constraints 1 and 2 as listed in your post.

The reason for this is as follows: if an extrema exists then curves $t \mapsto \alpha(t)$ which pass through the extremal point must make $\eta=d \circ \alpha$ extreme at the corresponding point in the domain. Suppose $t=0$ gives $\alpha(0)$ the extremal point (we can shift the parameter to make this happen, nothing is lost in this convenience).

The curve $\alpha$ lies on the intersection of the level sets given by 1 and 2. We have

$$g (\alpha(t)) =0 \qquad h( \alpha(t))=0$$

The chain-rule yields

$$\nabla g (\alpha(t)) \cdot \alpha'(t)=0 \qquad \nabla h (\alpha(t)) \cdot \alpha'(t)=0$$

Likewise, since $\eta$ is extremal at $t=0$ the chain rule gives

$$\nabla d (\alpha(0)) \cdot \alpha'(0)=0$$

Summarizing, the tangent vector field $\alpha'$ is orthogonal to the gradient fields of $g$ and $h$ where they can be compared and at $\alpha(0)$ the tangent $\alpha'(0)$ is orthogonal to $\nabla d$. The point $\alpha(0)$ is special in that we obtain orthogonality with respect to $\nabla d, \nabla g$ and $\nabla h$.

At first glance this would not appear to connect $\nabla d, \nabla g$ and $\nabla h$ in any particular way. However, there is not just one curve on the constraint surface. Provided the constraints 1. and 2. are nondegenerate the level set they define is two-dimensional and there will be a two-dimensional plane of tangent vectors which are found orthogonal to $\nabla d, \nabla g$ and $\nabla h$. But, this means that $\nabla d, \nabla g$ and $\nabla h$ are linearly dependent since $\mathbb{R}^4$ should be the direct sum of the tangent and normal space. For these reasons we introduce multipliers to ascertain the location of the max/min solution.

Notice the method is based on the existence of extreme solutions. For the continuous function $d$ these are known to exist if the constraint is a compact surface. Sometimes the method still "works" for non-compact constraints, but beware the limit of the method.

-
I'm sorry but I can't really understand what you wrote, this math is too advanced for me. Would it be possible to explain this at a high-school level? If not, I will be absolutely ok with it. I just need to know whether a high school student is able to solve this. Thanks. –  David Hoffman Sep 9 '12 at 20:43