# Statistical Thermodynamics and Rate Theories/Lagrange multipliers

## Constrained Optimization

When constraints are imposed on a system, Lagrange multipliers can be incorporated to determine the maximum of the multivariable function. The new process for determining maximum of this function within the constraint becomes:

1. Write the constraint as a function. i.e., ${\displaystyle g(x,y)=c}$
2. Define a new equation. ${\displaystyle f(x,y)+{\alpha }({g(x,y)}-{c})}$  where ${\displaystyle \alpha }$  is an undefined constant
3. Solve this set of equations to find the maximum, using the previous three steps for determining the maximum of an unconstrained system.

For example, suppose we have a function ${\displaystyle f(x,y)=-{2x}^{2}-{y}^{2}-{xy}-{10y}}$  and we impose the following constraint upon the function: ${\displaystyle y=x+5}$

The constraint would be written as ${\displaystyle g(x,y)=x+y=5}$

We would then define the new equation following the constraint as ${\displaystyle (-{2x}^{2}-{y}^{2}-{xy}-{10y})+{\alpha }({x}+{y}-{5})}$

Next, we take the partial derivative with respect for both x and y, set it to zero, and solve for x and y.

First of all taking the partial derivative with respect for x set to zero:

${\displaystyle {\frac {\partial }{\partial x}}[(-{2x}^{2}-{y}^{2}-{xy}-{10y})+{\alpha }({x}+{y}-{5})]=0}$

Evaluating this will give:

${\displaystyle {\alpha }-4x-y=0}$

${\displaystyle {\alpha }=4x+y}$

Now, the partial derivative with respect for y set to zero will be taken:

${\displaystyle {\frac {\partial }{\partial y}}[(-{2x}^{2}-{y}^{2}-{xy}-{10y})+{\alpha }({x}+{y}-{5})]=0}$

${\displaystyle {\alpha }-x-2y-10=0}$

${\displaystyle {\alpha }=x+2y+10}$

This leads to the following system of equations that can be solved to determine the maximum:

${\displaystyle {\alpha }=4x+y}$

${\displaystyle {\alpha }=x+2y+10}$

${\displaystyle x+y=5}$

From Solving this set of equations the maximum subjected to the constraint of ${\displaystyle x+y=5}$  is found to be:

${\displaystyle (x,y)=\left({\frac {-35}{8}},{\frac {5}{8}}\right)}$

## Unconstrained Optimization

Determining the maximum of an unconstrained system follows very similar steps it just will not have a lagrange multiplier as the system is not subjected to the

maximum along a given line, rather the maximum of the system itself. The steps to solve an unconstrained system becomes:

1. Calculate the partial derivatives
2. set them to zero
3. solve for the variables

For example given the same function of ${\displaystyle f(x,y)=-{2x}^{2}-{y}^{2}-{xy}-{10y}}$  first the partial derivatives will be calculated to be:

${\displaystyle ({\frac {\partial f}{\partial x}})_{y}=-4x-y}$

${\displaystyle ({\frac {\partial f}{\partial y}})_{x}=-2y-x}$

Let both partial derivatives be zero:

${\displaystyle -4x-y=0}$

${\displaystyle -2y-x=0}$

Finally the variables will be solved for. Giving a maximum that is different than that of the constrained system:

${\displaystyle (x,y)=\left({\frac {10}{7}},{\frac {-40}{7}}\right)}$