Google

main
dspblog
cyclic_signals
FFT_interpolation
FFT_interpolation_how_does_it_work
FFT_smoothness_cyclic
discrete_time_reconstruction
discrete_time_reconstruction2
Nyquist_on_the_edge
FFT_delay_special_case
Fourier_reconstruction
pulse_and_Nyquist
FFT_complexError
matlabOctave
matlab_upsampling
matlab_downsampling
FFT_delay
FFT_filter_example
FFT_interpolation_example
FFT_bin_frequencies
fit_signal
FFT_peaksearch_audio_example
matlab_binary_readwrite
Octavesvg
C
FFTW_example
looprecord
SNR
SNR3
SNR_example_96kAudio
SNR_FFT_correlation_example
lua
luagpib
luasplit
luadump
mnoofltk
wxLuaDll
wxLua_loadAsDll
wxLua_HelloWorld
wxLua_simpleButton
wxLua_resourceManagement
wxLua_XMLparser
DSP
IQ_LO
IQ_LO_2
optimum_receiver
DSP_basics
sampleRateChange_terms
dirac_pulse
freqresp_s
zfilter_example
freqresp_z
freqresp_z_sign
misc
zero_forcing_equalizer_example
nonminphase_inverse
periodic_spectrum
lagrange_multipliers
Entropy
RC_chopper
TRex450_setup
EP100
EP100SE
EP100Gremlins
essential_spares
tail_rotor
motoradjustment
blade_balancing
blade_repair
GAUI_SAE12A
Walkera43


valid html (click to verify)



prevupnextdisable ads

Lagrange Multipliers: constrained optimization

Summary:

Lagrange multipliers are a mathematical technique to minimize an expression, while meeting constraints.
This page shows a worked out example using the Maxima computer algebra system.
The approach outlined below is straightforward to implement in a computer algebra system.
However, it may be not the shortest way for a pen-and-paper calculation.

Lagrange Multipliers

Consider the following example:
Our task is to find the length, width and height x, y and z. of a milk box.
The following requirements have been given:
  • a target volume V, for example one liter
  • the width y should be twice as long as the length x
  • The total surface area of all sides A should be as small as possible
Written as equations, we get one expression for the area, that is to be minimized:
A=2(xy+xz+yz)
Further, there are two constraints:
  • meeting the target volume: V=xyz
  • the width / length requirement: x=2y
The constraint equations can be moved over to one side: V-xyz=0 and x-2y=0
It follows, that for x, y and z solving the problem, the left-hand sides will become zero.

Next they are multiplied with the so-called "Lagrange Multipliers" \lambda_1, \lambda_2 , and subtracted from the expression we want to minimize.
The following expression results:
2(xy+xz+yz)-(xyz-V)\lambda_1-(x-2y)\lambda_2

Now the derivative is taken with regard to all unknown variables x, y, z, \lambda_1, \lambda_2. The derivatives are set equal to zero, leading to five equations.
Intuitively, the reasoning behind this step is:
  • The derivative of the original "cost equation" in all variables must be zero for a minimum
  • Since the constraints are met in a solution point, the cost expressions are zero, and so are their derivatives, taken against the Lagrange Multipliers
At this point we are dealing with a system of five (nonlinear!) equations in five variables, which isn't that easy to solve.
Now \lambda_1 and \lambda_2 can be eliminated from the equation system, since we are not interested in their actual values.
What remains is a system of three equations in three variables x, y, z , its solution solves also the initial problem.

Verifying the result

Putting the result back into the constraint equations shows that they are met. Also, A has a minimum, as expected.
When dealing with more complex problems, one needs to check also the 2nd derivative.

Maxima CAS script

Download

prevupnextdisable ads

© Markus Nentwig 2007-2008
The content of this page is provided without any warranty and may not be reproduced without permission.

Comments? Questions?

Please send me a mail! mnentwig@elisanet.fi