#set document(title: "4.3 Lagrange Multipliers", author: "XYZ Homework") #set page(width: 8.5in, height: auto, margin: 1in) #import "@preview/cetz:0.5.2" #set text(font: ("STIX Two Text", "Libertinus Serif", "New Computer Modern"), size: 10.5pt, lang: "en") #show math.equation: set text(font: ("STIX Two Math", "New Computer Modern Math")) #set par(justify: true, leading: 0.62em, spacing: 0.9em) #set enum(spacing: 1.1em) // room between list items so tall inline fractions don't collide #set list(spacing: 1.1em) #set table(stroke: 0.5pt + rgb("#c7ccd3")) #let BLUE = rgb("#183B6F") // brand navy — section bars + example/solution labels (white on navy 11.09:1) #let ORANGE = rgb("#A94509") // brand primary-700 — AA-safe deep orange for TEXT (5.93:1 on white; raw brand #F37021 is 2.94:1 and must never carry text) #let RED = rgb("#DC2626") // brand error-600 #let GREEN = rgb("#059669") // brand success-600 (decoration only; small green text uses green-text #007942) #show heading.where(level: 1): it => block(width: 100%, above: 0pt, below: 16pt, fill: gradient.linear(BLUE, rgb("#2C5AA0")), inset: (x: 14pt, y: 12pt), radius: 3pt, text(fill: white, weight: "bold", size: 19pt, it.body)) #show heading.where(level: 2): it => block(width: 100%, above: 18pt, below: 10pt, fill: BLUE, inset: (x: 10pt, y: 6pt), radius: 2pt, text(fill: white, weight: "bold", size: 12pt, it.body)) #show heading.where(level: 3): it => text(fill: ORANGE, weight: "bold", size: 12.5pt, it.body) #show heading.where(level: 4): it => text(fill: BLUE, weight: "bold", size: 10.5pt, it.body) #let examplebox(label, title, body) = block(width: 100%, breakable: true, fill: rgb("#EFF1F5"), stroke: 0.5pt + rgb("#CFDDF0"), radius: 4pt, inset: 10pt, above: 12pt, below: 12pt)[ #block(below: 6pt)[#box(fill: BLUE, inset: (x: 6pt, y: 2pt), radius: 2pt, text(fill: white, weight: "bold", size: 8.5pt, label)) #h(0.4em) #strong[#title]] #body] // rail = decorative left rule (raw brand token); labelcolor = AA-safe label text shade #let notebox(label, rail, labelcolor, tint, body) = block(width: 100%, breakable: true, fill: tint, stroke: (left: 3pt + rail), inset: (left: 10pt, rest: 8pt), radius: (right: 4pt), above: 11pt, below: 11pt)[ #text(fill: labelcolor, weight: "bold", size: 7.5pt, tracking: 0.5pt)[#upper(label)] #linebreak() #body] #let solutionbox(body) = block(above: 4pt, below: 8pt)[ #text(fill: BLUE, weight: "bold", size: 8.5pt)[Solution] #linebreak() #body] #let figph(msg) = block(width: 100%, height: 60pt, fill: rgb("#f6f7f9"), stroke: (paint: rgb("#c7ccd3"), dash: "dashed"), radius: 4pt, inset: 10pt)[ #align(center + horizon, text(fill: rgb("#889"), style: "italic", size: 9pt, msg))] // Standardize inlined figure sizes: measure the natural CeTZ canvas, then scale to a // consistent envelope (aspect-aware; see build_typst.py FIG_* constants). Unlike the // print preamble, dimensions are FLOORED: in an editor a user can trim a figure to a // degenerate 1-D shape (a bare line), and w/h or tw/w would then divide by zero. #let _STD_W = 3.5 #let _WIDE_W = 5.6 #let _MAX_H = 3.4 #let _ASPECT_WIDE = 2.2 #let _UPSCALE_MAX = 1.15 #let stdfig(body) = context { let m = measure(body) let w = calc.max(m.width / 1in, 0.01) let h = calc.max(m.height / 1in, 0.01) let tw = if w / h > _ASPECT_WIDE { _WIDE_W } else { _STD_W } let s = calc.min(tw / w, _MAX_H / h, _UPSCALE_MAX) align(center, box(scale(x: s * 100%, y: s * 100%, reflow: true, body))) } #show figure: set block(breakable: false) #set figure(gap: 8pt) #show figure.caption: set text(size: 8.5pt, fill: rgb("#555")) == 4.3#h(0.6em)Lagrange Multipliers #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[Objectives] - Locate constrained extrema geometrically, at the points where the constraint curve is tangent to a level curve of the objective. - Read the same condition off the lifted constraint curve as the points where the objective, followed along the constraint, stalls. - Translate the tangency picture into the Lagrange equations and solve them completely. ] Most optimization in practice comes with a leash: maximize #math.equation(block: false, alt: "f")[$f$], #emph[subject to] #math.equation(block: false, alt: "g equals c")[$g = c$]. The leash changes everything. A constrained maximum is almost never at a critical point of #math.equation(block: false, alt: "f")[$f$] itself — our specimen #math.equation(block: false, alt: "f open parenthesis x , y close parenthesis equals x y")[$f ( x , y ) = x y$] has only a saddle, no maximum at all — yet on the constraint circle #math.equation(block: false, alt: "x squared plus y squared equals 4")[$x^(2) + y^(2) = 4$] the problem has clean, finite answers. The question is where to look, and the figure answers it twice over: once on the map, once along a ribbon. {"camera":{"fov":50,"position":\[6,4.5,4.5\],"projection":"perspective","target":\[0,0,0\]},"grid":{"axisColors":{"x":"\#ef4444","y":"\#22c55e","z":"\#3b82f6"},"divisions":10,"gridColor":"\#e5e7eb","showAxes":true,"showLabels":true,"size":10,"visible":true},"id":"47639b26-8083-4e97-9e10-0671a36bd773","metadata":{"alt\_text":"A translucent red-and-blue saddle surface z = x\*y with seventeen dark contour lines on the z = 0 plane \\u2014 hyperbolas, plus a crossed pair of straight lines at level zero. A flat dark circle of radius 2 lies in that plane, and a thick red ribbon-like curve traces the value of x\*y above and below each point of the circle, rising to two crests of height 2 and dipping to two troughs of depth 2. Two red marker points at the crests are hidden.","created\_at":"2026-07-07T00:00:00.000Z","description":"Workbook scene for Lagrange multipliers: saddle f(x,y) = x\*y with its contour plot at z = 0, the constraint circle x^2 + y^2 = 4 drawn flat, and the lifted constraint curve (2cos t, 2sin t, 2sin 2t) showing f along the constraint; hidden points mark the two constrained maxima at (sqrt2, sqrt2) and (-sqrt2, -sqrt2).","tags":\["workbook","calc3","lagrange-multipliers","constrained-optimization","contours"\],"updated\_at":"2026-07-07T00:00:00.000Z"},"objects":\[{"expression":"x\*y","id":"810c4e05-105c-43c6-9918-8382e4cba874","kind":"explicit-surface","label":{"text":"z = x\*y","visible":true},"resolution":128,"style":{"colormap":"coolwarm","doubleSided":true,"opacity":0.45,"wireframe":false,"wireframeColor":"\#000000"},"visible":true,"xDomain":\[-3,3\],"yDomain":\[-3,3\]},{"expression":"x\*y","id":"9217b423-7fbb-4d03-930a-92324db8c836","kind":"contour-plot","label":{"text":"level curves of f","visible":true},"levels":17,"style":{"color":"\#0f172a","dash":\[\],"lineWidth":2},"visible":true,"xDomain":\[-3,3\],"yDomain":\[-3,3\],"zOffset":0},{"id":"8f0f01a4-b345-4485-a5bf-7af87343a41e","kind":"parametric-curve","label":{"text":"constraint x^2 + y^2 = 4","visible":true},"samples":300,"style":{"color":"\#111827","dash":\[\],"lineWidth":3},"tDomain":\[0,6.283185307179586\],"visible":true,"xExpr":"2\*cos(t)","yExpr":"2\*sin(t)","zExpr":"0"},{"id":"615e9112-e32e-4073-9e2a-d3f6801f4db4","kind":"parametric-curve","label":{"text":"f on the constraint","visible":true},"samples":400,"style":{"color":"\#ef4444","dash":\[\],"lineWidth":4},"tDomain":\[0,6.283185307179586\],"visible":true,"xExpr":"2\*cos(t)","yExpr":"2\*sin(t)","zExpr":"2\*sin(2\*t)"},{"color":"\#ef4444","id":"3b6ec9bd-f540-4df1-b74c-0e9421fa4faa","kind":"point","label":{"text":"constrained max","visible":true},"radius":0.09,"visible":false,"x":1.4142135623730951,"y":1.4142135623730951,"z":2},{"color":"\#ef4444","id":"530a7e59-19fe-4613-99c6-9943a7eb9861","kind":"point","label":{"text":"constrained max","visible":true},"radius":0.09,"visible":false,"x":-1.4142135623730951,"y":-1.4142135623730951,"z":2}\],"title":"Where the constraint kisses the contour","version":1} The translucent red-and-blue saddle #math.equation(block: false, alt: "z equals x y")[$z = x y$], its seventeen dark level curves on the plane #math.equation(block: false, alt: "z equals 0")[$z = 0$] (hyperbolas, plus a crossed pair of lines at level #math.equation(block: false, alt: "0")[$0$]), a flat dark circle of radius #math.equation(block: false, alt: "2")[$2$] in that same plane — the constraint #math.equation(block: false, alt: "x squared plus y squared equals 4")[$x^(2) + y^(2) = 4$] — and a thick red ribbon that follows the circle while rising and falling with the surface: #math.equation(block: false, alt: "f")[$f$] evaluated along the constraint, the only part of the surface the problem is allowed to use. Two marker points at the constrained maxima hide in the object list. === Explore + Orbit to a low side view and follow the red ribbon once around. How many crests and how many troughs does it have? Note roughly where the crests sit over the dark circle. + A crest is where #math.equation(block: false, alt: "f")[$f$], walking along the constraint, stops increasing and starts decreasing — it #emph[stalls]. What is the ribbon's slope, measured along the walk, at a stall? + The ribbon's height over the circle is #math.equation(block: false, alt: "x y")[$x y$]. Using symmetry — the product is largest where #math.equation(block: false, alt: "x")[$x$] and #math.equation(block: false, alt: "y")[$y$] are equal and share a sign — predict the exact coordinates of the two crests and the value of #math.equation(block: false, alt: "f")[$f$] there. Commit before revealing. + Reveal the two hidden points with their eye toggles. They sit at the crests; zoom in and read their positions against the grid. Do they match your #math.equation(block: false, alt: "open parenthesis ± the square root of 2 , ± the square root of 2 close parenthesis")[$( ± sqrt(2) , ± sqrt(2) )$], #math.equation(block: false, alt: "f equals 2")[$f = 2$]? + Now the map view: orbit to look straight down and drag the contour plot's z-offset from #math.equation(block: false, alt: "0")[$0$] up to #math.equation(block: false, alt: "2")[$2$]. The whole family of level curves rides up the saddle as one sheet. As it reaches crest height, the curve #math.equation(block: false, alt: "x y equals 2")[$x y = 2$] meets the circle at exactly the two marked points — does it #emph[cross] the circle there, or kiss it tangentially? + Drag the z-offset back to about #math.equation(block: false, alt: "1")[$1$] and look at where #math.equation(block: false, alt: "x y equals 1")[$x y = 1$] meets the circle: four honest crossings. Check against the ribbon — over those four points, is it at a crest, or still climbing? Say the connection out loud: crossing a level curve means the walk is still changing #math.equation(block: false, alt: "f")[$f$]. (The 17 levels put drawn curves exactly at the integer values #math.equation(block: false, alt: "minus 8 , … , 8")[$− 8 , … , 8$], so both curves in this step and the last are actually drawn; other level counts can hide them.) === From kiss to equations At a tangency the constraint curve and the level curve share a tangent line, so their normals point along one line. Those normals are gradients — #math.equation(block: false, alt: "∇ f")[$∇ f$] for the level curve, #math.equation(block: false, alt: "∇ g")[$∇ g$] for the constraint — so at a constrained extremum #math.equation(block: true, alt: "∇ f equals λ ∇ g")[$∇ f = λ ∇ g$] for some scalar #math.equation(block: false, alt: "λ")[$λ$], the #strong[Lagrange multiplier], solved together with #math.equation(block: false, alt: "g equals c")[$g = c$]. The logic runs through step 6: where the level curve #emph[crosses] the constraint, level curves of larger and smaller value lie on either side, so sliding along the constraint still changes #math.equation(block: false, alt: "f")[$f$] — no extremum there. Only a kiss can stop the walk, and the ribbon says the same thing in its own language: kisses on the map are stalls on the ribbon. #examplebox("Example 1")[The full Lagrange computation on the circle][ Find the maximum and minimum of #math.equation(block: false, alt: "f open parenthesis x , y close parenthesis equals x y")[$f ( x , y ) = x y$] on the circle #math.equation(block: false, alt: "x squared plus y squared equals 4")[$x^(2) + y^(2) = 4$], with the multiplier at each. With #math.equation(block: false, alt: "g equals x squared plus y squared")[$g = x^(2) + y^(2)$], the equations #math.equation(block: false, alt: "∇ f equals λ ∇ g")[$∇ f = λ ∇ g$] and the constraint read #math.equation(block: true, alt: "y equals 2 λ x , x equals 2 λ y , x squared plus y squared equals 4 .")[$y = 2 λ x , #h(2em) x = 2 λ y , #h(2em) x^(2) + y^(2) = 4 .$] Substituting the first into the second gives #math.equation(block: false, alt: "x equals 4 λ squared x")[$x = 4 λ^(2) x$]. If #math.equation(block: false, alt: "x equals 0")[$x = 0$] the first equation forces #math.equation(block: false, alt: "y equals 0")[$y = 0$], violating the constraint — so #math.equation(block: false, alt: "λ squared equals the fraction 1 over 4")[$λ^(2) = frac(1, 4)$], i.e. #math.equation(block: false, alt: "λ equals ± the fraction 1 over 2")[$λ = ± frac(1, 2)$]. For #math.equation(block: false, alt: "λ equals the fraction 1 over 2")[$λ = frac(1, 2)$] the equations give #math.equation(block: false, alt: "y equals x")[$y = x$], and the constraint gives #math.equation(block: false, alt: "2 x squared equals 4")[$2 x^(2) = 4$]: the points #math.equation(block: false, alt: "open parenthesis the square root of 2 , the square root of 2 close parenthesis")[$( sqrt(2) , sqrt(2) )$] and #math.equation(block: false, alt: "open parenthesis minus the square root of 2 , minus the square root of 2 close parenthesis")[$( − sqrt(2) , − sqrt(2) )$], where #math.equation(block: false, alt: "f equals 2")[$f = 2$]. For #math.equation(block: false, alt: "λ equals minus the fraction 1 over 2")[$λ = − frac(1, 2)$], #math.equation(block: false, alt: "y equals minus x")[$y = − x$] yields #math.equation(block: false, alt: "open parenthesis the square root of 2 , minus the square root of 2 close parenthesis")[$( sqrt(2) , − sqrt(2) )$] and #math.equation(block: false, alt: "open parenthesis minus the square root of 2 , the square root of 2 close parenthesis")[$( − sqrt(2) , sqrt(2) )$], where #math.equation(block: false, alt: "f equals minus 2")[$f = − 2$]. So the constrained maximum is #math.equation(block: false, alt: "2")[$2$] and the minimum #math.equation(block: false, alt: "minus 2")[$− 2$]. The ribbon confirms it in one variable: on the circle, #math.equation(block: false, alt: "f open parenthesis 2 cos t , 2 sin t close parenthesis equals 4 cos t sin t equals 2 sin 2 t")[$f ( 2 cos t , 2 sin t ) = 4 cos t sin t = 2 sin 2 t$], which crests at #math.equation(block: false, alt: "2")[$2$] and bottoms at #math.equation(block: false, alt: "minus 2")[$− 2$], four stalls per lap — exactly the four kisses. ] #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ Crossing means you can still improve; only tangency can stop you. That single sentence is the whole theory: #math.equation(block: false, alt: "∇ f equals λ ∇ g")[$∇ f = λ ∇ g$] is tangency written in vectors, and #math.equation(block: false, alt: "λ")[$λ$] is the exchange rate between a unit of constraint and a unit of objective. ]