You are on page 1of 5

Optimization Using the Arithmetic Mean Geometric Mean Inequality

(AM/GM/I)
Denition: Let x = (x
1
, x
2
, . . . , x
n
) (n 1) be a vector of real numbers. The arithmetic
mean of x is computed as
AM(x) =
1
n
n

j=1
x
j
.
If, in addition x
j
0 for all j then the geometric mean of x is computed as
GM(x) =
_
n

j=1
x
j
_1
n
.
Theorem (AM/GM/I): For all x R
n
, x 0, AM(x) GM(x) with equality if and
only if all the x
j
are equal.
The theorem is obviously when n = 1. It is also obvious that when all the x
j
are equal, the
two means are equal.
When n = 2, we can easily show

x
1
x
2

1
2
(x
1
+ x
2
) with equality if and only if x
1
= x
2
:
(

x
1

x
2
)
2
0
x
1
2

x
1
x
2
+ x
2
0
x
1
+ x
2
2

x
1
x
2
1
2
(x
1
+ x
2
)

x
1
x
2
The rst inequality is true becase a squared quantity is always nonnegative. The remain-
ing inequalities arise from expansion and/or rearrangement of terms in the rst inequality.
When the two means are equal, (

x
1

x
2
)
2
= 0. That is, x
1
= x
2
, which proves the only
if part of the statement.
One of the most popular proofs of the inequality uses induction. Instead we present two
dierent approaches, one using unconstrained optimization and the second using computer
programming.
Proof Number 1: Proof of AM/GM/I using Unconstrained Optimization
Let y
j
= ln x
j
so that x
j
= e
y
j
. Then AM/GM/I is equivalent to
_
n

j=1
e
y
j
_
1/n

1
n
n

j=1
e
y
j
1
or
exp
_
1
n
n

j=1
y
j
_

1
n
n

j=1
e
y
j
.
Consider the optimization problem
min AM(x) GM(x) s.t. x 0.
This problem is equivalent to
min f(y) =
1
n
n

j=1
e
y
j
exp
_
1
n
n

j=1
y
j
_
(where the change of variables eliminates the need for nonnegativity requirements).
We want to show that the optimal value of the optimization problem is zero. This would
imply that for all x 0 (or for all y), the objective function is nonnegative and establish
AM/GM/I.
Instead of minimizing f(y), we instead consider the related problem
min
n

j=1
e
y
j
s.t.
n

j=1
y
j
= s
for some arbitrary scalar s. Observe that
y
n
= s y
1
y
2
y
n1
and the new unconstrained optimization problem is
min g(y) = e
y
1
+ + e
y
n1
+ e
sy
1
y
2
y
n1
.
The objective function is a positive sum of convex functions so it is convex. Thus we need
only check the rst order conditions to nd an optimum solution. For i = 1, . . . , n 1
g
y
i
= e
y
i
e
y
n1
+ e
sy
1
y
2
y
n1
and
g
y
i
= 0 when y
i
= s y
1
y
2
y
n1
.
Thus y
1
= y
2
= = y
n1
which means that
y
i
= s (n 1)y
i
or y

i
=
s
n
, i = 1, . . . , n 1.
Using the above expression shows that y

n
= s/n as well.
2
As mentioned before, when all the variables have the same value, AM=GM. Since the above
minimizer is unique, we have shown that the ONLY time AM=GM is when all the variables
are equal. In conclusion f(y) 0 for all y and f(y) = 0 if and only if all the y
i
take on the
same value.
Proof Number 2: Proof of AM/GM/I using Computer Programming
The following code is written for MATLAB. The function takes as input the vector x of
nonnegative numbers and a small positive constant tol which prevents innite looping due
to round-o error. The values in x are sorted so that x(1) is the smallest of the variables
and x(n) the largest.
The while loop runs until x(n) - x(1) tol. (If there is no round-o error, the loop ends
when x(n) - x(1) is zero.) During the loop, the values of x(n) and x(1) are both changed
to a new value: 0.5(x(1) + x(n)), and then the values in x are re-sorted.
function amgmi(x, tol)
% x is a vector of nonnegative values
% tol is a user defined tolerance (should be a small positive number)
n = length(x);
x = sort(x);
while x(n) - x(1) > tol
amean = mean(x);
gmean = prod(x)^(1/n);
x(1) = 0.5(x(1) + x(n));
x(n) = x(1);
x = sort(x);
end
Claim: The algorithm terminates when all of the variables are (approximately) equal and
AM(x) GM(x).
Proof: As mentioned previously, the WHILE loop will run as long as x
j
= x
l
for some
1 j < l n (In particular x
n
= x
1
.) If we let x
j
and x

j
represent the value of the j-th
variable at the begin and end of an iteration respectively, then we see that
1. The arithmetic mean never changes from its initial value:
1
n
n

j=1
x

j
=
1
n
_
x

1
+ x

n
+
n1

j=2
x
j
_
=
1
n
_
x
1
+ x
n
+
n1

j=2
x
j
_
=
1
n
n

j=1
x
j
3
2. The geometric mean increases in value:
_
n

j=1
x

j
_1
n
=
_
x
1
+ x
n
2
_
2
_
n1

j=2
x
j
_1
n
>
_
n

j=1
x
j
_1
n
(The inequality in the second line is true if and only if
_
x
1
+ x
n
2
_
2
> x
1
x
n
,
That is, if
x
1
+ x
n
2
>

x
1
x
n
.
But this is AM/GM/I when n = 2!)
Thus, we conclude that AM(x) GM(x) throughout the algorithm and equality only
comes about when all the variables have the same value.
AM/GM/I can be used to solve two types of optimization problems:
1. maximize the product of n nonnegative variable subject to the sum of these n variables
is constant.
2. minimize the sum of n nonnegative variable subject to the product of these n variables
is constant.
We show the method through several examples.
Example 1
min f(Q) = cD +
KD
Q
+
h
2
Q s.t. Q > 0.
We encountered this problem in our discussion of the EOQ inventory model. Since cD is
constant, we need only minimize the variable costs. Let
x
1
=
KD
Q
x
2
=
h
2
Q.
According to AM/GM/I
x
1
+ x
2
2

x
1
x
2
with equality if and only if x
1
= x
2
. Thus f(Q) is smallest when
KD
Q
=
h
2
Q that is, when Q

2KDh,
4
a result easily veried using classical optimization techniques.
Example 2
max A(a, b, c) =
_
s(s a)(s b)(s c) s.t. a, b, c > 0.
This is the problem of determining the dimensions. a, b, c, of a triangle with xed semi-
perimeter s = (a + b + c)/2 so as to maximize the area of the triangle. Let
x
1
= (s a) x
2
= (s b) x
3
= (s c).
According to AM/GM/I
x
1
+ x
2
+ x
3
3

3

x
1
x
2
x
3
with equality if and only if x
1
= x
2
= x
3
. The area of the triangle may be written as

s(GM((x
1
, x
2
, x
3
))
3/2
. Alternatively
GM(x) =
_
A
2
s
_
1/3
and we see that area is maximized when GM(x) is maximized: when all the x
j
s are equal.
Thus a

= b

= c

and since s = (a + b + c)/2, this means a

= (2s)/3.
Example 3
max xy(72 3x 4y) s.t. x, y > 0.
If we let z
1
= x, z
2
= y and z
3
= 72 3x 4y, we see that z
1
+ z
2
+ z
3
is not a constant.
However, if we let z
1
= 3x, z
2
= 4y and z
3
= 72 3x 4y, then the objective function is
(z
1
z
2
z
3
)/12 and z
1
+ z
2
+ z
3
IS constant.
The maximum value is obtained when
3x = 4y = 72 3x 4y
which means that x

= 8 and y

= 6.
For the Student:
1. Verify the optimal solution for Example 3 using calculus.
2. Verify for Example 3 that z
1
, z
2
, z
3
0 (one of the requirements of AM/GM/I).
3. Use AM/GM/I to solve
min 5x +
16
x
+ 21 s.t. x > 0.
4. Use AM/GM/I to solve
min x
2
+
a
x
s.t. x > 0.
(Here, a is a positive constant.)
5

You might also like