In Modules 2 and 3 we used derivatives to study functions. In Module 4 we use them, along with a little geometry, to find the best choice: the largest profit, the smallest cost, the shortest distance.
Lagrange multipliers. Find the maximum or minimum of f(x,y) when x and y are connected by a condition such as x2+y2=1. There can be one condition (constraint) or two.
Linear programming. Optimise a linear objective like z=3x1+5x2 when the variables must satisfy some linear inequalities. Write word problems in mathematical form, and then solve them by the graphical method.
Gradient descent (steepest descent). A step-by-step numerical method that moves downhill to a minimum, using the gradient from Module 3.
What you will be able to do
Set up the Lagrange function L=f+λg and solve the system ∇L=0.
Find the point on a plane that is closest to the origin, the largest area for a fixed perimeter, and similar problems.
Solve problems with two constraints using two multipliers λ and μ.
Convert a word problem into a linear programming problem (LPP).
Draw the feasible region of a two-variable LPP, find its corner points and choose the optimal one.
Identify infeasible, unbounded and multiple-optimum problems.
Do gradient descent iterations by hand.
How to use these notes
Every topic has the same shape: idea → method → worked examples → common mistakes.
Try each worked example yourself before reading the solution.
Green boxes hold key ideas. Amber boxes marked Watch out show the mistakes that make you lose marks. Boxes marked Note on the source show where the handwritten class notes were corrected.
The last page has practice questions with answers and a formula sheet.
Where each topic sits
Part
Topics
Lagrange multipliers
One constraint, applications in three variables, two constraints
Linear programming
Terms and general form, formulation, graphical method, special cases
Numerical optimisation
Gradient descent
Before you start. You should know partial derivatives and the gradient (Modules 2 and 3), how to solve simultaneous linear equations, and how to draw straight lines using their intercepts.
Lagrange multipliers
The idea
In Module 3 we found extreme values of f(x,y) where x and y could take any values. Many times they are not free: a fence of fixed length, a point that must stay on a circle, a budget that must be spent fully.
Such a condition is called a constraint, and it is written as
g(x,y)=0
We want the largest or smallest value of famong the points that satisfy the constraint.
Key idea. At a constrained maximum or minimum, the level curve of f just touches the constraint curve g=0. Curves that touch have parallel normals, so ∇f and ∇g are parallel: ∇f=−λ∇g for some number λ. This is the Lagrange multiplier.
Method
Write the function f(x,y), and write the constraint in the form g(x,y)=0.
Build the Lagrange function:
L(x,y,λ)=f(x,y)+λg(x,y)
Put all its partial derivatives equal to zero:
∂x∂L=0,∂y∂L=0,∂λ∂L=0
That is,
⎩⎨⎧fx+λgx=0fy+λgy=0g(x,y)=0
The third equation is just the constraint itself.
Solve for x, y (and λ). The solutions are the critical points.
Find f at every critical point. On a closed, bounded constraint curve (a circle, an ellipse) the largest value is the maximum and the smallest value is the minimum.
Solving tip. The usual trick: find λ from the first two equations, put the two expressions equal (this removes λ), and put the resulting relation between x and y in the constraint.
First example
Example 1. Find the extreme value of f(x,y)=x2+y2 subject to x+y=1.
From (1) and (2), λ=−2x=−2y, so x=y. Putting this in (3): 2x=1, so
x=y=21,f(21,21)=41+41=21
This is the minimum. x2+y2 is the square of the distance from the origin, and (21,21) is the point on the line x+y=1 that is nearest to the origin.
Note on the source. The class notes asked to "maximise" x2+y2 on x+y=1. There is no maximum, because points on the line far from the origin make x2+y2 as large as we like. The only critical point (21,21) gives the minimum value 21.
Watch out. The Lagrange method gives only possible points. Decide whether each point is a maximum or a minimum by comparing the values. Remember that on an unbounded constraint (a line, a plane), one of the two may not exist.
Lagrange multipliers: worked examples
Example 1. Find the maximum and minimum of f(x,y)=xy subject to x2+y2=1.
From (1), λ=−2xy; from (2), λ=−8yx. Equating and cross-multiplying:
8y2=2x2⇒x2=4y2⇒x=±2y
Put x2=4y2 in (3): 4y2+4y2=4, so y2=21 and y=±21, x=±2.
Point
f=xy
(2,21), (−2,−21)
1
(2,−21), (−2,21)
−1
The maximum is 1 at (2,21) and (−2,−21).
Note on the source. The class notes went from 8y2=2x2 to "y=x/4", where the square root was taken wrongly (it should be x=±2y). Then they found xy at (54,51) by adding the coordinates and got 5. That point does lie on the ellipse, but xy there is only 54. The correct maximum is 1.
Example 3. Find the extreme values of f(x,y)=xy subject to x2+y2=10.
Exactly as in Example 1: Lx=y+2λx=0 and Ly=x+2λy=0 give x2=y2, and the constraint gives 2x2=10, so x=±5, y=±5.
Point
f=xy
(5,5), (−5,−5)
5
(5,−5), (−5,5)
−5
Maximum 5, minimum −5.
Note on the source. One line of the handwritten table wrote f(−5,5)=5. It should be −5. The final conclusion in the notes was correct.
Example 4. Find the maximum and minimum of f(x,y)=3x+4y on the circle x2+y2=1.
λ=25: x=−53, y=−54, and f=−59−516=−5 (minimum).
Note on the source. In the copied notes, the page was blank after the value −5. The maximum 5 at (53,54) is completed here.
Watch out. When you divide by x or y to get λ, you are assuming that they are not zero. Check separately whether x=0 or y=0 can satisfy the equations. (In these examples it cannot, because then the other variable would also be 0, and that point is not on the curve.)
Lagrange multipliers: applications
The method works in the same way with three variables: L=f(x,y,z)+λg(x,y,z) and four equations Lx=Ly=Lz=Lλ=0.
Example 1. Closest point on a plane
Find the point P(x,y,z) on the plane 2x+y−z−5=0 that is closest to the origin.
The distance is d=x2+y2+z2. Minimising d is the same as minimising d2, which has no square root, so take
Check. The distance from the origin to ax+by+cz=k is a2+b2+c2∣k∣=65. ✓
Note on the source. The notes wrote "x=−λ/2" from 2x+2λ=0, but it should be x=−λ. The next lines actually used x=−λ, so the final point (35,65,−65) is correct.
Example 2
Find the minimum of f(x,y,z)=x2+y2+z2 subject to x+y+z=9.
L=x2+y2+z2+λ(x+y+z−9)
Lx=2x+λ=0, Ly=2y+λ=0, Lz=2z+λ=0 give x=y=z=−2λ. The constraint gives 3x=9, so x=y=z=3 and λ=−6:
f(3,3,3)=9+9+9=27
Note on the source. The question of this example was missing in the copied notes. Only the working "λ=−6, x=y=z=3, f=27" was available. The constraint x+y+z=9 gives exactly that working.
Example 3. Largest rectangle
A rectangle has perimeter 20m. Find the dimensions that maximise its area.
Let the length be x and the breadth be y. Maximise f=xy subject to 2(x+y)=20, that is g=x+y−10=0.
L=xy+λ(x+y−10)Lx=y+λ=0,Ly=x+λ=0⇒x=y=−λ
The constraint gives −2λ=10, so λ=−5 and
x=y=5m,area=25m2
The best rectangle is a square.
Note on the source. One line of the notes read "x−x−10=0". It should be x+x−10=0 (the next line, −λ−λ−10=0, is correct).
Watch out. When the quantity to optimise is a distance, minimise d2 instead of d. The square root only makes the derivatives difficult and does not change the place where the minimum comes.
Lagrange multipliers with two constraints
Method
To optimise f(x,y,z) subject to two constraints g(x,y,z)=0 and h(x,y,z)=0, use one multiplier for each:
L(x,y,z,λ,μ)=f+λg+μh
and solve the five equations
Lx=0,Ly=0,Lz=0,Lλ=0,Lμ=0
The last two are the constraints themselves.
Key idea. Each constraint takes away one degree of freedom. In three variables with two constraints, the allowed points form a curve (usually a line, where two planes meet), and we optimise f along it.
Examples
Example 1. Find the extreme value of f(x,y)=x2+y2 subject to x+y=1 and x−y=1.
This is the minimum: the two planes meet in a line, and (1,1,1) is the point on that line nearest to the origin. There is no maximum, because the line goes to infinity.
Example 3. Find the extremum of f(x,y,z)=x2+y2+z2 subject to x+y+z=1 and x−y=0.
Note on the source. The copied page with Examples 2 and 3 was not clear. The working above is rebuilt from the equations that were readable, and both answers have been checked again: (1,1,1) with value 3, and (31,31,31) with value 31.
Watch out. Number your equations and write which ones you are combining. With five equations it is easy to miss one, and a missing equation usually gives a wrong point.
Linear programming: the terms
The idea
A linear programming problem (LPP) asks for the best value of a linear function when the variables must obey several linear inequalities. It models production planning, diets, staffing, transport and many other decisions.
The parts of an LPP
Term
Meaning
Example
Decision variables
the unknown quantities that we choose; they are usually required to be ≥0
x1 = units of product 1, x2 = units of product 2
Objective function
the linear function to maximise or minimise
profit z=3x1+5x2
Constraints
linear equations or inequalities that the variables must satisfy
A feasible solution is any values of the variables that satisfy all the constraints, including non-negativity. The set of all feasible solutions is the feasible region.
Basic feasible solution
For a basic feasible solution with n variables and m equality constraints, put n−m of the variables equal to 0 and solve for the rest. If the result is feasible, it is a basic feasible solution. In the graph, these are the corner points of the feasible region.
Optimal solution
An optimal solution is a feasible solution that gives the largest value (for maximise) or the smallest value (for minimise) of the objective.
Each inequality is a half-plane
A single linear inequality in two variables is satisfied on one side of its boundary line. To find which side, test a point not on the line, usually the origin: if (0,0) satisfies the inequality, shade the side containing the origin; otherwise shade the other side. The feasible region is where all the shaded sides overlap.
Watch out. "≤" does not always mean "shade below". For x1−3x2≥−6, the origin gives 0≥−6, which is true, so the side of the origin is shaded even though the line slopes upward. Always test a point.
Formulating an LPP from a word problem
Method
Name the decision variables: which quantities can we choose? Write what each one means.
Write the objective function: the profit, cost or number to be maximised or minimised, in terms of the variables.
Write one constraint for each limited resource or requirement. "Available" or "at most" gives ≤. "At least" or "required" gives ≥.
Add non-negativity:x1,x2,⋯≥0.
Examples
Example 1. Manufacturing.
A factory makes products P1 and P2, with profit Rs 3 and Rs 5 per unit. P1 needs 1 unit of resource 1 and 2 units of resource 2; P2 needs 2 units of resource 1 and 1 unit of resource 2. Only 4 units of resource 1 and 6 units of resource 2 are available. Write the LPP to maximise the profit.
Let x1, x2 be the numbers of units of P1 and P2 produced.
(It is solved on the practice page: the best profit is 334 at x1=38, x2=32.)
Example 2. Diet problem.
A hospital diet must provide at least 2000 calories, 50 g of protein and 300 g of carbohydrate per day, at minimum cost. Food 1 costs Rs 3 per unit and gives 500 cal, 20 g protein and 30 g carbohydrate. Food 2 costs Rs 4 per unit and gives 600 cal, 30 g protein and 40 g carbohydrate. Write the LPP.
Let x1, x2 be the units of food 1 and food 2 per day.
(It is solved graphically on the "word problems" page.)
Example 3. Staff scheduling.
A company needs at least 5 employees from 8 am to 12 noon, 3 from 12 noon to 4 pm, and 4 from 4 pm to 8 pm. Each employee works an 8-hour shift starting at 8 am, 12 noon or 4 pm. Minimise the number of employees.
Let x1, x2, x3 be the numbers starting at 8 am, 12 noon and 4 pm. A person starting at 8 am works from 8 am to 4 pm, so covers the first two periods. A person starting at noon covers the second and third periods. A person starting at 4 pm covers the third period.
Minimisez=x1+x2+x3
subject to
x1x1+x2x2+x3x1,x2,x3≥5(8 am to 12 noon)≥3(12 noon to 4 pm)≥4(4 pm to 8 pm)≥0
The minimum is 9 employees, for example x1=5, x2=0, x3=4: the first constraint forces x1≥5 and the third forces x2+x3≥4.
Note on the source. The handwritten question said employees "can't start" at 8 am, 12 noon or 4 pm, and named x1,x2,x3 by the four-hour periods. The constraints in the notes make sense only if shifts start at those times, so we have used that meaning here.
Watch out. Write what each variable means, with units. Most mistakes in writing the LPP come from a variable whose meaning changes in the middle of the working.
The graphical method
The idea
With two decision variables, we can draw the feasible region. For a linear objective, the lines z=constant are parallel. If we move them in the direction in which z increases, the last point of the region that they touch is a corner.
Key idea (corner-point theorem). If an LPP has an optimal solution, then one occurs at a corner point (vertex) of the feasible region. So we only need to find z at the corners.
Method
Change each inequality to an equation and draw the line, using its two intercepts (put x1=0, and then x2=0).
Shade the side of each line that satisfies the inequality (test the origin). Also include x1,x2≥0.
The common part is the feasible region. Write its corner points. Find each one by solving the equations of the two lines that meet there.
Find z at every corner. The largest (or smallest) value is the optimum.
Examples
Example 1
Maximise z=3x1+4x2 subject to 4x1+2x2≤80, 2x1+5x2≤180, x1,x2≥0.
Intercepts: 4x1+2x2=80 passes through (20,0) and (0,40); 2x1+5x2=180 passes through (90,0) and (0,36).
The two lines meet where 4x1+2x2=80 and 2x1+5x2=180. Multiply the second by 2 to get 4x1+10x2=360. Subtracting the first, 8x2=280, so x2=35 and x1=25.
Feasible region ABCD; the steep line is 4x₁ + 2x₂ = 80
Corner
z=3x1+4x2
A(0,0)
0
B(20,0)
60
C(25,35)
7.5+140=147.5
D(0,36)
144
Maximum z=147.5 at x1=2.5, x2=35.
Example 2
Maximise z=3x+2y subject to x+2y≤10, 3x+y≤15, x,y≥0.
Intercepts: x+2y=10 through (10,0) and (0,5); 3x+y=15 through (5,0) and (0,15).
They meet where 6x+2y=30 and x+2y=10. Subtracting, 5x=20, so x=4, y=3.
Corner
z=3x+2y
(0,0)
0
(5,0)
15
(4,3)
18
(0,5)
10
Maximum z=18 at (4,3).
Watch out. An intercept of a constraint line is a corner only if it satisfies every other constraint. In Example 2, (10,0) is on x+2y=10 but does not satisfy 3x+y≤15, so it is not a corner.
Graphical method: more examples
Example 1
Maximise z=15x1+10x2 subject to 4x1+6x2≤360, 3x1≤180, 5x2≤500, x1,x2≥0.
The constraints say 4x1+6x2≤360 (through (90,0) and (0,60)), x1≤60, and x2≤100. The last one is never the deciding one, because 4x1+6x2≤360 already forces x2≤60.
The line x1=60 meets 4x1+6x2=360 at 240+6x2=360, so x2=20.
Feasible region ABCD for 4x₁ + 6x₂ ≤ 360 and x₁ ≤ 60
Corner
z=15x1+10x2
(0,0)
0
(60,0)
900
(60,20)
900+200=1100
(0,60)
600
Maximum z=1100 at x1=60, x2=20.
Note on the source. The class notes listed the corners as (0,0), (90,0), (60,20), (40,30), (0,40) and chose 1350 at (90,0). But (90,0) does not satisfy 3x1≤180, the point (40,30) is not where any two constraint lines meet, and (0,40) is not on any boundary. The correct corners are those in the table, and the maximum is 1100.
Example 2
Maximise z=2x+3y subject to x+y≤30, 3≤y≤12, x−y≥0, 0≤x≤20.
The region lies between the horizontal lines y=3 and y=12, to the right of the line y=x (because x≥y), to the left of x=20, and below x+y=30. Its corners are:
y=3 meets y=x at A(3,3) and meets x=20 at B(20,3).
x=20 meets x+y=30 at C(20,10).
x+y=30 meets y=12 at D(18,12).
y=12 meets y=x at E(12,12).
Feasible region ABCDE between y = 3 and y = 12
Corner
z=2x+3y
A(3,3)
15
B(20,3)
49
C(20,10)
70
D(18,12)
72
E(12,12)
60
Maximum z=72 at (18,12). (The minimum, if asked, is 15 at (3,3).)
Note on the source. The notes used E(3,12) as a corner, with z=42. That point does not satisfy x≥y. The correct corner is E(12,12) with z=60. The maximum does not change.
Example 3
Maximise f=5x1+25x2 subject to x1−3x2≥−6, x1+x2≤6, x1,x2≥0.
The line x1−3x2=−6 passes through (0,2) and (−6,0), and the origin satisfies 0≥−6, so the feasible side is below this line that goes up. The line x1+x2=6 passes through (6,0) and (0,6). The two lines meet where x1=3x2−6 and x1+x2=6: 4x2=12, so x2=3, x1=3.
Feasible region ABCD
Corner
f=5x1+25x2
(0,0)
0
(6,0)
30
(3,3)
15+75=90
(0,2)
50
Maximum f=90 at (3,3).
Note on the source. The notes gave the x2-intercept of x1−3x2=−6 as (0,−2). It is (0,2) (put x1=0: −3x2=−6). The corner D(0,2) in the notes was correct.
Word problems solved graphically
Example 1: Chairs and tables
A manufacturer makes chairs and tables on machines A and B. A chair needs 2 hours on A and 6 hours on B; a table needs 5 hours on A and 1 hour on B. Machine A is available 16 hours a day and machine B 30 hours. The profit is Rs 2 per chair and Rs 10 per table. Write the LPP and solve it.
Intercepts: 2x1+5x2=16 through (8,0) and (0,516); 6x1+x2=30 through (5,0) and (0,30).
The two lines meet here: from the second, x2=30−6x1; then 2x1+150−30x1=16, so x1=28134=1467≈4.79 and x2=79≈1.29.
Feasible region ABCD; the shallow line is 2x₁ + 5x₂ = 16
Corner
z=2x1+10x2
(0,0)
0
(5,0)
10
(1467,79)
767+790=7157≈22.43
(0,516)
10×516=32
Maximum profit is Rs 32, by making no chairs and 3.2 tables a day (that is, 16 tables in five days).
Note on the source. The notes wrote the value at D as "2×516=532=32". The correct working is z=2(0)+10(516)=32. They also rounded C to (4.78,1.28) with z=22.36, but the exact value is 7157≈22.43. The conclusion (maximum 32) is correct.
Example 2: The diet problem, solved
Minimise z=3x1+4x2 subject to 500x1+600x2≥2000, 20x1+30x2≥50, 30x1+40x2≥300, x1,x2≥0 (from the formulation page).
The carbohydrate line 30x1+40x2=300 passes through (10,0) and (0,7.5). Every point on or above it automatically satisfies the calorie line (through (4,0) and (0,3.3)) and the protein line (through (2.5,0) and (0,1.6)), which lie below it. So the feasible region is everything on or above the carbohydrate line. It is an unbounded region.
Feasible region (shaded, continuing upwards) on or above 30x₁ + 40x₂ = 300
Corner
z=3x1+4x2
(0,7.5)
30
(10,0)
30
Both corners give 30. Notice that z=3x1+4x2=101(30x1+40x2)≥10300=30 everywhere in the region, and it is equal to 30 along the whole carbohydrate line. So the minimum cost is Rs 30, and it is reached at every point of the segment from (10,0) to (0,7.5). This LPP has multiple optimal solutions.
Watch out. For a minimisation over an unbounded region, a minimum can still exist (as here), because the cost increases as you go further into the region. It is a maximisation over an unbounded region that may have no answer.
Special cases of the graphical method
Not every LPP has one single answer.
Case
What the graph shows
What to say
Unique optimum
one corner gives the best value
"the optimum is z∗ at (x1,x2)"
Multiple optima
two neighbouring corners give the same best value: the objective lines are parallel to an edge
every point of that edge is optimal (diet problem)
Unbounded
the region goes on forever in the direction in which z improves
no finite optimum
Infeasible
the constraints have no common point, so there is no feasible region at all
the LPP has no feasible solution
Example 1. An infeasible problem. Maximise z=6x1−4x2 subject to 2x1+4x2≤4, 4x1+8x2≥15, x1,x2≥0.
Divide the constraints by 2 and 4:
x1+2x2≤2andx1+2x2≥3.75
No pair (x1,x2) can make x1+2x2 both at most 2 and at least 3.75. The boundary lines are parallel (through (2,0), (0,1) and through (3.75,0), (0,1.875)). The first constraint allows only the triangle below the lower line, and the second allows only the region above the upper line.
Shaded: 2x₁ + 4x₂ ≤ 4. The second constraint needs points above the upper line, so the regions never meet
The LPP is infeasible: it has no solution.
Note on the source. The class notes concluded "there is no bounded region". The correct statement is stronger: there is no feasible region at all, so the problem is infeasible (not just unbounded).
Watch out. "Unbounded" and "infeasible" are different. Unbounded means feasible points exist but z can be made as large as we like. Infeasible means there are no feasible points.
Gradient descent (method of steepest descent)
The idea
From Module 3, ∇f points in the direction in which fincreases fastest, so −∇f points in the direction in which it decreases fastest. To find a minimum, start at any point and keep taking small steps downhill.
∇f=(∂x∂f,∂y∂f)
Update rule. From the current point (xk,yk),
(xk+1,yk+1)=(xk,yk)−α∇f(xk,yk)
where α>0 is the step size (also called the learning rate).
Method
Find ∇f(x,y) as a formula.
Start at the given (x0,y0).
At each step, find ∇f at the current point, multiply by α, and subtract.
Repeat for the required number of iterations, or until the steps become very small.
Write the work in a table: point, gradient, new point.
Examples
Example 1. Find the minimum of f(x,y)=x2+3y2 by steepest descent from (x0,y0)=(6,3), with α=0.1, for five iterations.
The points move towards the true minimum (0,0), where f=0. The y-coordinate decreases faster because f is steeper in the y-direction.
Note on the source. No step size was given in this question. The class notes took α=0.1, and we have kept that assumption. One line of the notes copied y4 as 0.0761, but it is 0.0768. The value y5=0.03072 is correct.
Example 2. Minimise f(x,y)=x2+y2 from (1,1) with α=0.1, for three iterations.
∇f=(2x,2y), so each step multiplies both coordinates by 1−0.2=0.8:
(1,1)→(0.8,0.8)→(0.64,0.64)→(0.512,0.512)
approaching the minimum at the origin.
Watch out. Find the gradient at the current point in every step. A common mistake is to keep using ∇f(x0,y0), or to write the new point in place of the gradient.
Gradient descent: more examples
Example 1
Minimise f(x,y)=3x2+4y2 from (x0,y0)=(1,1) with fixed step α=0.01, for five iterations.
∇f=(6x,8y). So xk+1=xk−0.06xk=0.94xk and yk+1=yk−0.08yk=0.92yk.
k
(xk,yk)
∇f(xk,yk)
0
(1,1)
(6,8)
1
(0.94,0.92)
(5.64,7.36)
2
(0.8836,0.8464)
(5.3016,6.7712)
3
(0.830584,0.778688)
(4.983504,6.229504)
4
(0.780749,0.716393)
(4.684494,5.731144)
5
(0.733904,0.659082)
With such a small step, the progress towards (0,0) is slow.
Note on the source. At step 3 the notes used 4.672128 for the y-component of the gradient, but it is 8×0.778688=6.229504. This mistake made y4 and y5 wrong (0.73196672 and 0.6733 in the notes). The corrected values are in the table.
Example 2
Minimise f(x,y)=(x−2)2+(y+3)2 from (0,0) with learning rate 0.1.
∇f=(2(x−2),2(y+3))=(2x−4,2y+6).
k
(xk,yk)
∇f(xk,yk)
0
(0,0)
(−4,6)
1
(0.4,−0.6)
(−3.2,4.8)
2
(0.72,−1.08)
(−2.56,3.84)
3
(0.976,−1.464)
(−2.048,3.072)
4
(1.1808,−1.7712)
The points come closer to the true minimum (2,−3), where f=0. Each step reduces the remaining gap by 20 %, since xk+1−2=0.8(xk−2) and yk+1+3=0.8(yk+3).
Note on the source. The notes wrote the second step as (0.4,−0.6)−0.1(0.72,−1.08), where the next point was written in the place of the gradient. The gradient at (0.4,−0.6) is (−3.2,4.8), which gives the point (0.72,−1.08).
Watch out. The step size is important. If it is too small, the method is slow (Example 1). If it is too large, the points go beyond the minimum: for f=x2, any α>1 makes ∣xk∣ increase instead of decrease.
Practice questions and formula sheet
Practice questions
Try these without looking at the answers. The answers are given below.
A. Lagrange multipliers
Find the maximum and minimum of f(x,y)=x+y on the circle x2+y2=8.
Find the point of the line 2x+3y=13 closest to the origin.
Three positive numbers add up to 12. Use Lagrange multipliers to find the largest product.
Minimise x2+y2+z2 subject to x+y=2 and y+z=2.
B. Linear programming
Solve the manufacturing problem: maximise z=3x1+5x2 subject to x1+2x2≤4, 2x1+x2≤6, x1,x2≥0.
Minimise z=2x+3y subject to x+y≥6, x+3y≥12, x,y≥0.
Show that the LPP "maximise x+y subject to x+y≤2, x+y≥5, x,y≥0" has no solution.
C. Gradient descent
Take two steps of steepest descent for f(x,y)=(x−1)2+2y2 from (0,1) with α=0.1.
Answers
Lx=1+2λx=0, Ly=1+2λy=0 give x=y; then 2x2=8. Maximum 4 at (2,2), minimum −4 at (−2,−2).
Minimise x2+y2: 2x+2λ=0, 2y+3λ=0 give x=2t, y=3t; the line gives 13t=13. The point is (2,3), at distance 13.
L=xyz+λ(x+y+z−12): yz=xz=xy gives x=y=z=4. Maximum product 64.
2x+λ=0, 2y+λ+μ=0, 2z+μ=0 give y=x+z; with x+y=2, y+z=2: x=z=32, y=34. Minimum 38 at (32,34,32).
Corners (0,0), (3,0), (38,32), (0,2) with z=0,9,334,10. Maximum 334≈11.33 at (38,32).
The region is unbounded above, with corners (0,6), (3,3), (12,0) and z=18,15,24. Minimum 15 at (3,3).
The constraints require x+y≤2 and x+y≥5 at once, which is impossible: the LPP is infeasible.
∇f=(2(x−1),4y). From (0,1): gradient (−2,4), new point (0.2,0.6). Then gradient (−1.6,2.4), new point (0.36,0.36). (The minimum is at (1,0).)
Study tip. For LPPs, always make the corner table: corner, how you found it (which two lines), and value of z. This makes the answer easy to check and easy to mark.
Formula sheet
Lagrange multipliers
Topic
Formula / Rule
One constraint
L=f+λg; solve Lx=Ly=Lλ=0
Condition
∇f=−λ∇g at the optimum
Three variables
add Lz=0
Two constraints
L=f+λg+μh; solve Lx=Ly=Lz=Lλ=Lμ=0
Distance problems
minimise d2=x2+y2+z2, not d
Linear programming
Concept
Description
General form
optimise z=∑cjxj subject to ∑aijxj≤bi (or ≥, =), xj≥0
Feasible region
intersection of the half-planes of all constraints
Corner-point theorem
if an optimum exists, one occurs at a corner of the feasible region
Graphical method
draw lines by intercepts, test the origin, list corners, evaluate z at each