Constraint Minimization - Pen and Paper calculation
Aim:
To minimize the following function:
=> f(x,y) = `5-(x-2)^2 -2(y-1)^2`
Subject to constraint:
=> `x + 4y = 3`
f(x,y) = `5-(x-2)^2 -2(y-1)^2`
=> `5-(x^2+4-4x) -2(y+1-2y) = 0`
=> `5 - x^2 - 4 +4x - 2y^2 - 2 +4y = 0`
=>`-x^2 -2y^2 +4x+4y-1 = 0`
By lagrangian method:
g(x,y) = `f(x,y) + lamda(x + 4y - 3)`
`g(x,y) = 5-(x-2)^2 -2(y-1)^2 + lamda(x+4y-3)`
The above is the new function which is to be minimized.
The 3 new equations:
=> `delg//delx = 0` ; `delg//dely = 0`; `del g//del lamda = 0`
=> `delg//delx : -2x + 4 + lamda = 0` ------- equation 1
=> `delg//dely: -4y + 4 + 4lamda = 0` -------- equation 2
=> `delg//dellamda = x + 4y -3 = 0` --------- equation 3
equation 2 - `4*`equation 1
=> `-4y + 4 + 4lamda - (-8x + 16 + 4 lamda)`
=> `-4y +4+4lamda+8x-16-4lamda`
=> `8x - 4y -12`
=> `2x-y-3 = 0` ------ equation 4
from equation 4 :
=> `2x-y=3`
=> `2x = y + 3`
=>`x = (y + 3)//2`
putting the above value of x in equation 3
=> `y + 3//2 + 4y = 3`
=> `y + 3 + 8y = 6`
=> `9y = 3`
=> ``y = 1//3``
to get the value for x putting the value of y in equation 3:
=> `x + 4/3 = 3`
=> `3x + 4 = 9`
=> ``x = 5/3``
therefore `lamda = -2/3`