# Alloy composition from component densities (Lagrange Multipliers)

1. Apr 7, 2014

### JasonB

1. The problem statement, all variables and given/known data

An alloy of gold, aluminum, and copper has a density of 10,000 kg/m3. The alloy contains at least 10% aluminum and 5% copper by mass. The densities for the three metals are respectively ρAu = 19320 kg/m3, ρAl = 2712 kg/m3, ρCu = 8940 kg/m3. Find the maximum and minimum percentage of gold by mass. Show all work and carefully explain your logic.

2. Relevant equations

ρ=Mass/Volume

Lagrange Multipliers

3. The attempt at a solution

I am struggling to form the initial functions. I suspect the professor intends for us to use Lagrange multipliers, and I am confident I can find the gradients and drudge through the resulting algebra, but I am struggling to get started.

I understand density is mass per volume, and that percent by mass is the mass of a component divided by the total mass.

I imagine I will take the three metals to be the variables x, y, and z. And I suspect optimizing over a single cubic meter would be the best approach.

I found some guidance online suggesting I use the sum of the masses and the sum of the volumes. This gives me:

MAu = ρAu * VAu
MAl = ρAl * VAl
MCu = ρCu * VCu

MAu + MAl + MCu = 10,000 kg

ρAu * VAu + ρAl * VAl + ρCu * VCu = 10,000 kg

19320VAu + 2712VAl + 8940VCu = 10,000 kg

and

VAu + VAl + VCu = 1 m3

Both of these seem to be constraint equations and I am confused as to what the function to be optimized will look like.

Other constraints would be: (assuming optimization over a single cubic meter)

MCu ≥ 500 kg
MAl ≥ 1000 kg
MAu ≤ 8500 kg

The Lagrange Multiplier method requires two functions. One function constrained by another function.

I have found help here before, but this is my first post. I would appreciate any insight regarding the initial functions. Thank you.

File size:
35.7 KB
Views:
50
2. Apr 7, 2014

### az_lender

I am going to approach this as I'd have done in secondary school. The minimum percentage of gold will be associated with as little aluminum as possible, since the density of the alloy is higher than that of either Cu or Al, and Al is the lightest. So let's assume we have 10% Al by mass, for your hypothetical 1 m3 of alloy. The mass of the aluminum will be 1000 kg, and it will occupy
V(Al) = (1000 kg)/(2912 kg/m3) = 0.3434 m3.
The remaining 0.6566 m3 must have a mass of 9000 kg, so its density is 13707 kg/m3. It will be quite easy for you to find the necessary fractions of gold and copper.

For the maximum percentage of gold, assume you have as little copper as possible, and follow an analogous line of reasoning to that above. Nothing as fancy as Lagrange multipliers is needed to solve this problem!

3. Apr 7, 2014

### JasonB

Az_Lender,

Thank you for responding. Your logic is sound. I guess I assumed the problem was more complicated than it is.

In order to minimize gold content, we need to maximize copper content. I came up with two equations:

19320Vg + 8940Vc = 9000 kg
Vg + Vc = 0.6313 m3

Solving for Vg and substituting into the first equation I arrived at:

Vc = 0.3079 m3 and Vg = 0.3234 m3

The mass of the gold would then be 6247.48 kg and the mass percent would be 62.47%

Likewise, to maximize gold content, we need to maximize aluminum content.

19320Vg + 2712Va = 9500 kg
Vg + Va = 0.9441 m3

Solving for Vg and substituting:

Va = 0.5262 m3 and Vg = 0.4179 m3

The mass of the gold would then be 8072.89 kg and the mass percent would be 80.73%

I appreciate your response. If there is a method to solve this using calculus I would like to understand how to go about it. If I fail to find such a calculus approach I will certainly follow this approach. Thank you again.

4. Apr 7, 2014

### Ray Vickson

You should not have a constraint $M_{Au} \leq 8500$ because it is already implied by the other two restrictions on aluminum and copper. It is an example of a redundant constraint. Including it just makes the problem harder to solve and for no good reason. Of course, you do need the constraint $V_{Au} \geq 0$ in order to prevent a negative value in the minimization problem.

As it stands you have a simple linear programming problem which is readily solvable using non-calculus high-school algebra methods; Google “simplex method” to see many examples. However, if you do insist on approaching it using calculus and Lagrange multipliers, you should realize that it is trickier than you may think. The inequality constraints prevent you from just setting derivatives to zero, so you need to resort to the so-called “Karush-Kuhn-Tucker” (KKT) conditions. You can do it, but it will take much more work than just using the simplex method of linear programming. For a look at the KKT conditions, see, eg., http://www.onmyphd.com/?p=kkt.karush.kuhn.tucker or http://ocw.mit.edu/courses/mechanical-engineering/2-854-introduction-to-manufacturing-systems-fall-2010/lecture-notes/MIT2_854F10_kkt_ex.pdf [Broken] .

It is easiest to just use the simplex method of linear programming in this case. In fact, you can reduce it to a two-dimensional problem and so solve it graphically. Basically, you can use one of the constraints to express a variable in terms of the other two, then substitute that expression everywhere else that variable appears. The result will be a problem having one equality and three inequalities in two variables. Therefore, you can plot the feasible region of the constraints as a polygon in a two-dimensional space. Then you can look at the geometry to get the maximal and minimal solutions. See, eg., http://spartan.ac.brocku.ca/~pscarbrough/scarb-alp-burch/Chapters 1-24-16.htm or
http://ir.library.oregonstate.edu/xmlui/bitstream/handle/1957/20084/em8719-e.pdf for some simple examples of the method.

Finally: lose the units. Define the variables as so many m^3, etc, so there is no m^3 unit attached to the volume constraint, and define the masses as being measured in kg, so there are no kg units attached to the other constraints. In other words, just write $V_{Au} + V_{Al} + V_{Cu} = 1$, etc. It is important to do this because if you were to submit the problem (exactly as you wrote it) to a solver, it would choke.

Last edited by a moderator: May 6, 2017
5. Apr 8, 2014

### JasonB

Ray Vickson,

Thank you. I appreciate the feedback. I will dig into your links and let you know what I come to.

6. Apr 8, 2014

### Ray Vickson

In this particular case it is very easy: in the simplex method, we use the system of (more unknowns than equations) so solve for some variables in terms of others. When adapted to this problem in the most simple way, it just amounts to solving for $V_{Al}, V_{Cu}$ in terms of $V_{Au}$ by using the two equality constraints. These give you two expressions that are linear in the variable $V_{Au}$, one for $V_{Al}$ and one for $V_{Cu}$. The inequalities on these two variables will give two simple inequalities on $V_{Au}$, and these yield the upper and lower bounds.

7. Apr 9, 2014

### JasonB

The KKT Conditions are a bit beyond my current ability level. I chose to follow your advice regarding manipulation of the inequalities. I am currently watching videos on the simplex method for my own understanding.

I defined the variables as cubic meters of the three metals:

Vg = m3 of Gold
Vc = m3 of Copper
Va = m3 of Aluminum

The masses are defined in kg. Our two equalities:

19320Vg + 8940Vc + 2712Va = 10,000
Vg + Vc + Va = 1

Solving for Va, substituting, and solving for Vc:

Va = 1 - Vc - Vg
19320Vg + 8940Vc + 2712(1 - Vc - Vg) = 10,000
16608VG + 6228Vc = 7288
Vc = 1.17 - 2.67Vg

Solving for Vc, substituting, and solving for Va:

Vc = 1 - Va - Vg
19320Vg + 8940(1 - Va - Vg) + 2712Va = 10,000
10380Vg - 6228Va = 1060
Va = 1.67Vg - 0.17

State our three inequalities:

$\text{Mass of Aluminum} \geq \text{1000 kg}$
$\text{1000 kg}~\big({\frac{1 m^3}{2712 kg}}\big)=0.3687 m^3$
$Va \geq 0.3687$

$\text{Mass of Copper} \geq \text{500 kg}$
$\text{500 kg}~\big({\frac{1 m^3}{8940 kg}}\big)=0.05593 m^3$
$Va \geq 0.05593$

$Vg \geq 0$

Substitute:

1.67Vg - 0.17 ≥ 0.3687
Vg ≥ 0.3234

1.17 - 2.67Vg ≥ 0.05593
Vg ≤ 0.4178

These are volumes so multiply by density to find mass:

Mass of Gold ≤ 8071.45 kg
Mass of Gold ≥ 6247.28 kg

Divide by total mass to find percent mass:

Mass% of Gold ≤ 80.71%
Mass% of Gold ≥ 62.47%

These are the same results I had from Az_Lender's method so that is comforting. I prefer this approach because there are no assumptions involved.Thank you Ray Vickson.

8. Apr 9, 2014

### Ray Vickson

These are OK, except for roundoff-error effects. It is a good idea to keep as many digits as you can during intermediate computations, and only round off the answers at the very end. Better still, use exact arithmetic as much as possible, so, for example, we have:
$$V_a = \frac{5}{3} V_g - \frac{265}{1557} \doteq 1.666666667 \,V_g-.1701991008\\ V_c = -\frac{8}{3} V_g + \frac{1822}{1557} \doteq -2.666666667\,V_g+1.170199101$$
In larger computations the kind of premature roundoff you did can lead to wildly incorrect answers. Aside from that, your method was OK.