# validating a mathematical model (Lagrange formulation and geometry)

I am working on computing phase diagrams for alloys. These are blueprints for a material that show what phase, or combination of phases, a material will exist in for a range of concentrations and temperatures (see this pdf presentation).

The crucial step in drawing the boundaries that separate one phase from another on these diagrams involves minimizing a free energy function subject to basic physical conservation constraints. I am going to leave out the chemistry/physics and hope that we can move forward with the minimization using Lagrange multipliers.

The free energy that is to be minimized is this:

$\widetilde{G}(x_1, x_2) = f^{(1)}G_{1}(x_1) + f^{(2)}G_{2}(x_2),$

subject to:

$f^{(1)}x_1 + f^{(2)}x_2 = c_1,$

$f^{(1)} + f^{(2)} = 1.$

(and also that the $x_{i} > 0$ and $f^{(i)} > 0$, for $i=1,2$.)

The Lagrange formulation is:

$L(x_1,x_2,f^{(1)},f^{(2)},\lambda_1, \lambda_2, \lambda_3) = f^{(1)}G_{1}(x_1) + f^{(2)}G_{2}(x_2)$

$- \lambda_{1}(f^{(1)}x_1 + f^{(2)}x_2 - c_1)$

$- \lambda_{2}(f^{(1)} + f^{(2)} - 1)$

The minimization of $\widetilde{G}$ follows from finding the $x_{i}$'s that satisfy $\nabla L = 0:$

$\frac{\partial L}{\partial x_{1}} = f^{(1)}G_{1}'(x_1) - \lambda_{1}f^{(1)} = 0$

$\frac{\partial L}{\partial x_2} = f^{(2)}G_{2}'(x_2) - \lambda_{1}f^{(2)} = 0$

$\frac{\partial L}{\partial f^{(1)}} = G_{1}(x_1) - \lambda_{1}x_{1} - \lambda_2 = 0$

$\frac{\partial L}{\partial f^{(2)}} = G_{2}(x_2) - \lambda_{1}x_{2} - \lambda_2 = 0$

which yields:

$(*) f^{(1)}\left[G_{1}'(x_1) - \lambda_1 \right] = 0$

$(**) f^{(2)}\left[G_{2}'(x_2) - \lambda_1 \right]= 0$

$(***) G_{1}(x_1) - G_{2}(x_2) = \lambda_1 \left[ x_1 - x_2\right]$

Because $f^{(1)}$ and $f^{(2)}$ are not to be zero, from (*) and (**) we have that

$G_{1}'(x_1) = G_{2}'(x_2) = \lambda_{1}.$

And, a manipulation of equation (***) looks like

$\frac{G_{1}(x_1) -G_{2}(x_2)}{x_1 - x_2} = \lambda_{1}.$

Now, think of $G_{i}$ as an even degree polynomial (which it isn't, but it's graph sometimes resembles one) in the plane. Let the points $x_1$ and $x_2$ be locations along the x-axis that lie roughly below the minima of this curve. The constraints (*),(*), and (**) describe the condition that the line drawn between $(x_1,G_{1}(x_1))$ and $(x_2,G_{2}(x_2))$ form a common tangent to the "wells" of the curve. It is these points $x_1$ and $x_2$, which represent concentrations of pure components in our alloy, that become mapped onto a phase diagram. It is essentially by repeating this procedure for many temperatures that we can trace out the boundaries in the desired phase diagram.

The question is: Looking at this from a purely analytic geometry perspective, how would one derive the "variational" approach to find a common tangent line that we seem to have found using the above Lagrangian? (warning: I don't really know how to model things using variational methods.)

And, secondly: I have presented a model of a binary alloy, meaning two variables to keep track of representing concentrations. I have been working on ternary alloys, where this free energy $\widetilde{G}$ is a function of three variables (two independent: $x_1,x_2,x_3$, where $x_3 = 1- x_1 - x_2$) and is therefore a surface over a Gibbs triangle. Then $\nabla L = 0$ produces partial derivatives that no longer "speak geometry" to me, although the solution is a common tangent plane. (I have attempted to characterize a common tangent plane based purely in analytic geometry - completely disregarding the Lagrangian - and have come up with several relations between directional derivatives... How might directional derivatives relate to the optimality conditions set forth by the Lagrangian?)

EDIT: Thank you Greg Graviton for wading through this sub-optimal notation and pointing out several mistakes in the statement of the problem. (Also, thank you for the excellent discussion below.)

-
yeah the latex, so I'll start by asking are you trying to get help solving a Lagrangian, or do you need help choosing an objective function, or are you trying to understand what an intuitive explanation for why the calculus of variations is finding a extrema? Or something else...? – Jonathan Fischoff Jul 24 '10 at 5:19
I can solve the Lagrangian, and I have the proper objective function, I just don't find it obvious how the solution to the Lagrangian applied to my objective function manifests itself as this common tangent between two "wells" on a curve. When we get to common tangent planes to surfaces, it is even less clear. – Tom Stephens Jul 24 '10 at 5:29
Some of your formulas look fishy to me, I think the constraint $x_1+x_2=1$ shouldn't be there. Also, you dropped the difference between $G_1(x_1)$ and $G_2(x_2)$ when minimizing the Lagrangian, huh? – Greg Graviton Jul 30 '10 at 16:21
Also, the derivative with respect to $x_1$ should read $\frac{\partial L}{\partial x_2} = f^{(1)}G_1'(x_1) - \lambda_1f^{(1)}$ and similar for $x_2$. – Greg Graviton Jul 30 '10 at 17:32

Concerning the physical meaning, I take it that $f_1$ and $f_2$ represent the fractions of the two phases in the alloy (this implies $f_1 + f_2 = 1$). I imagine $x_1$ and $x_2$ to correspond to an intensional variable like pressure, whose average $f_1x_1 + f_2x_2 =: \bar x$ is held constant in the experiment. Now, the alloy minimizes the free energy under these constraints.

To answer your first question: there is a geometric reason why the solution is the common tangent to $G_1$ and $G_2$ in the case of two dimensions. Namely, the fractions $f_1$ and $f_2$ are exactly the Barycentric coordinates of the average $\bar x$ sitting between $x_1$ and $x_2$. In particular, the value of the total energy $\tilde G$ is the height of the line drawn between $(x_1,G_1(x_1))$ and $(x_2,G_2(x_2))$ evaluated at $\bar x$. Here's a sketch:

From this picture, it is clear that if this line is not tangent to both $G_1$ and $G_2$, then you can move it a bit so that the value at $\bar x$ will decrease.

To answer your second question, the geometry readily extends to higher dimensions. For instance, for an alloy of three compounds, one has to consider the triangle enclosed by the three points $(x_1,G_1(x_1))$, $(x_2,G_2(x_2))$ and $(x_3,G_3(x_3))$. The situation is a bit degenerate here, any point inside this triangle whose first coordinate is $\bar x$ represents a valid value of $\tilde G$. Of these, nature will choose the smallest one. Consequently, the lower side of the triangle has to be tangent to two of the individual free energies.

Similar reasoning applies when the variable $x$ is not just a number, but, say, a pair of numbers, then we're dealing with a plane tangent to three individual Gibbs functions.

While not terribly useful in this case, there is also a very general geometric interpretation of the method of Lagrange multipliers. Namely, consider a goal function $f$ and a holonomic constraint $g$. Then, the Euler-Lagrange-equations give $\nabla f = \lambda \nabla g$ which means that $f$ changes only in directions orthogonal to the surface $g$. But since we're confined to the surface $g$, this must be an extremum. Wikipedia has a picture.

-
Thank you Greg. I will post some comments later, gotta get back to work right now! – Tom Stephens Jul 30 '10 at 18:57
You're welcome. :-) I've added a remark on the higher-dimensional case. – Greg Graviton Aug 1 '10 at 12:54
+1 for the hand-drawn figures. :-) (No seriously, your answer is useful.) – ShreevatsaR Aug 1 '10 at 13:05
I fixed the errors but I will keep the notation the same so your answer remains consistent with the problem. The $x$'s represent concentration of the components in the alloy. Regarding your reply, thank you for pointing out the fact that the $f$'s are barycentric coordinates and describing how minimizing $\widetilde{G}$ results in the common tangent line - especially helpful is considering this interpretation in higher dimensions. – Tom Stephens Aug 1 '10 at 19:09