## Lagrange multiplier

 LA home Computing Maths  Glossary  Calculus  Stats  N χ  Trig  Vectors  Matrices  Eigen v.  Ortho.  Least squares  Quaternions  Lagrange mult.  L. mult.
To minimise f(x), subject to the constraint g(x) = c, consider
Λ(x, λ) = f(x) + λ { g(x) - c }.
λ is known as the "Lagrange multiplier."

Solve
∇ Λ(x, λ) = (∂Λ/∂x1, ..., ∂Λ/∂xn, ∂Λ/∂λ) = 0

For example, given positive integers {n1, ..., nk}, minimise
n1 log p1 + ... + nk log pk
subject to
p1 + ... + pk = 1,
let
Λ(p, λ) = n1 log p1 + ... + nk log pk + λ{p1 + ... + pk - 1},
∇ Λ = (n1/p1 + λ, ..., nk/pk + λ, p1 + ... + pk - 1) = 0,
so
pi = - ni / λ ∝ ni   (λ can be negative)
and
∑ pi = 1,
giving
pi = ni / ∑j nj   (and λ = - ∑j nj).
(Also see the [multinomial] probability distribution.)

www:
 The C++ Cookbook mastering the language
 ↑ © L. Allison, www.allisons.org/ll/   (or as otherwise indicated). Created with "vi (Linux)",  charset=iso-8859-1,   fetched Monday, 09-Dec-2019 13:06:54 EST. Free: Linux, Ubuntu operating-sys, OpenOffice office-suite, The GIMP ~photoshop, Firefox web-browser, FlashBlock flash on/off.