I wondered if any of the readers of this thread might be interested in this little explanation:
If I want to find the
stationary values of f(x,y) = 2x^2 + 3y^2 subject to the constraint
2x + y = 1.
The general problem is to find stationary points of f(x,y) subject to
constraint g(x,y) = 0 [Note that the constraint must be written in
this form]. So for our problem g(x.y) = 2x + y - 1.
At stationary points of f(x,y) we have
df = part(df/dx)*dx + part(df/dy)*dy = 0
This implies that the vector [part(df/dx), part(df/dy)] is
perpendicular to the vector [dx, dy]
Since g(x,y) = 0 we can write
dg = part(dg/dx)*dx + part(dg/dy)*dy = 0
Thus the vector [part(dg/dx), part(dg/dy)] is also perpendicular to
the vector [dx, dy]. This implies that the vector [part(df/dx),
part(df/dy)] is parallel to the vector [part(dg/dx), part(dg/dy)] and
that we can find a number 'k' such that
[part(df/dx), part(df/dy)] - k[part(dg/dx), part(dg/dy)]
= [0, 0]
This can be summarized by writing
phi(x,y) = f(x,y) - kg(x,y)
Then f(x,y) will have a stationary point subject to constraint
g(x,y) = 0 when part(d(phi)/dx) = 0, part(d(phi)/dy) = 0 and
g(x,y) = 0
This gives three equations to find x, y and k.
k is called the Lagrange multiplier and phi is called the auxiliary
function.
Applying these ideas to our problem, we have
f(x,y) = 2x^2 + 3y^2 and g(x,y) = 2x + y - 1
The auxiliary function is
phi(x,y) = f(x,y) - kg(x,y)
= 2x^2 + 3y^2 - k(2x + y -1)
Then:
part(d(phi)/dx) = 4x - 2k = 0 (1)
part(d(phi)/dy) = 6y - k = 0 (2)
g(x,y) = 2x + y -1 = 0 (3)
Solving (1), (2) and (3) for k, x and y we get
k = 6/7 x = 3/7 y = 1/7
So at the stationary point x = 3/7 y = 1/7 we have
f(x,y) = 2*(3/7)^2 + 3*(1/7)^2
= 18/49 + 3/49
= 21/49
= 3/7
To determine the nature of the stationary point you look at
neighbouring points to see if f(x,y) has increased or decreased or not
changed (saddle point).