Numerical Methods and Optimization An Introduction
Numerical Methods and Optimization An Introduction
AND OPTIMIZATION
An Introduction
CHAPMAN & HALL/CRC
Numerical Analysis and Scientific Computing
Editors
Choi-Hong Lai Frédéric Magoulès
School of Computing and Applied Mathematics and
Mathematical Sciences Systems Laboratory
University of Greenwich Ecole Centrale Paris
Proposals for the series should be submitted to one of the series editors above or directly to:
CRC Press, Taylor & Francis Group
3 Park Square, Milton Park
Abingdon, Oxfordshire OX14 4RN
UK
Published Titles
Classical and Modern Numerical Analysis: Theory, Methods and Practice
Azmy S. Ackleh, Edward James Allen, Ralph Baker Kearfott, and Padmanabhan Seshaiyer
Cloud Computing: Data-Intensive Computing and Scheduling
Frédéric Magoulès, Jie Pan, and Fei Teng
Computational Fluid Dynamics
Frédéric Magoulès
A Concise Introduction to Image Processing using C++
Meiqing Wang and Choi-Hong Lai
Coupled Systems: Theory, Models, and Applications in Engineering
Juergen Geiser
Decomposition Methods for Differential Equations: Theory and Applications
Juergen Geiser
Designing Scientific Applications on GPUs
Raphaël Couturier
Desktop Grid Computing
Christophe Cérin and Gilles Fedak
Discrete Dynamical Systems and Chaotic Machines: Theory and Applications
Jacques M. Bahi and Christophe Guyeux
Discrete Variational Derivative Method: A Structure-Preserving Numerical Method for
Partial Differential Equations
Daisuke Furihata and Takayasu Matsuo
Grid Resource Management: Toward Virtual and Services Compliant Grid Computing
Frédéric Magoulès, Thi-Mai-Huong Nguyen, and Lei Yu
Fundamentals of Grid Computing: Theory, Algorithms and Technologies
Frédéric Magoulès
Handbook of Sinc Numerical Methods
Frank Stenger
Introduction to Grid Computing
Frédéric Magoulès, Jie Pan, Kiat-An Tan, and Abhinit Kumar
Iterative Splitting Methods for Differential Equations
Juergen Geiser
Mathematical Objects in C++: Computational Tools in a Unified Object-Oriented Approach
Yair Shapira
Numerical Linear Approximation in C
Nabih N. Abdelmalek and William A. Malek
Numerical Methods and Optimization: An Introduction
Sergiy Butenko and Panos M. Pardalos
Numerical Techniques for Direct and Large-Eddy Simulations
Xi Jiang and Choi-Hong Lai
Parallel Algorithms
Henri Casanova, Arnaud Legrand, and Yves Robert
Parallel Iterative Algorithms: From Sequential to Grid Computing
Jacques M. Bahi, Sylvain Contassot-Vivier, and Raphaël Couturier
Particle Swarm Optimisation: Classical and Quantum Perspectives
Jun Sun, Choi-Hong Lai, and Xiao-Jun Wu
XML in Scientific Computing
C. Pozrikidis
This page intentionally left blank
NUMERICAL METHODS
AND OPTIMIZATION
An Introduction
Sergiy Butenko
Texas A&M University
college Station, USA
Panos M. Pardalos
University of Florida
Gainesville, USA
MATLAB® is a trademark of The MathWorks, Inc. and is used with permission. The MathWorks does
not warrant the accuracy of the text or exercises in this book. This book’s use or discussion of MAT-
LAB® software or related products does not constitute endorsement or sponsorship by The MathWorks
of a particular pedagogical approach or particular use of the MATLAB® software.
CRC Press
Taylor & Francis Group
6000 Broken Sound Parkway NW, Suite 300
Boca Raton, FL 33487-2742
© 2014 by Taylor & Francis Group, LLC
CRC Press is an imprint of Taylor & Francis Group, an Informa business
This book contains information obtained from authentic and highly regarded sources. Reasonable
efforts have been made to publish reliable data and information, but the author and publisher cannot
assume responsibility for the validity of all materials or the consequences of their use. The authors and
publishers have attempted to trace the copyright holders of all material reproduced in this publication
and apologize to copyright holders if permission to publish in this form has not been obtained. If any
copyright material has not been acknowledged please write and let us know so we may rectify in any
future reprint.
Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced,
transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or
hereafter invented, including photocopying, microfilming, and recording, or in any information stor-
age or retrieval system, without written permission from the publishers.
For permission to photocopy or use material electronically from this work, please access www.copy-
right.com (http://www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222
Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that pro-
vides licenses and registration for a variety of users. For organizations that have been granted a pho-
tocopy license by the CCC, a separate system of payment has been arranged.
Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are
used only for identification and explanation without intent to infringe.
Visit the Taylor & Francis Web site at
http://www.taylorandfrancis.com
and the CRC Press Web site at
http://www.crcpress.com
Dedicated to the memory of our grandmothers,
Uliana and Sophia,
who taught us how to count.
This page intentionally left blank
Preface
Sergiy Butenko
Panos Pardalos
ix
This page intentionally left blank
Contents
I Basics 1
1 Preliminaries 3
1.1 Sets and Functions . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Fundamental Theorem of Algebra . . . . . . . . . . . . . . . 6
1.3 Vectors and Linear (Vector) Spaces . . . . . . . . . . . . . . 7
1.3.1 Vector norms . . . . . . . . . . . . . . . . . . . . . . . 10
1.4 Matrices and Their Properties . . . . . . . . . . . . . . . . . 12
1.4.1 Matrix addition and scalar multiplication . . . . . . . 12
1.4.2 Matrix multiplication . . . . . . . . . . . . . . . . . . 13
1.4.3 The transpose of a matrix . . . . . . . . . . . . . . . . 14
1.4.4 Triangular and diagonal matrices . . . . . . . . . . . . 15
1.4.5 Determinants . . . . . . . . . . . . . . . . . . . . . . . 16
1.4.6 Trace of a matrix . . . . . . . . . . . . . . . . . . . . . 17
1.4.7 Rank of a matrix . . . . . . . . . . . . . . . . . . . . . 18
1.4.8 The inverse of a nonsingular matrix . . . . . . . . . . 18
1.4.9 Eigenvalues and eigenvectors . . . . . . . . . . . . . . 19
1.4.10 Quadratic forms . . . . . . . . . . . . . . . . . . . . . 22
1.4.11 Matrix norms . . . . . . . . . . . . . . . . . . . . . . . 24
1.5 Preliminaries from Real and Functional Analysis . . . . . . . 25
1.5.1 Closed and open sets . . . . . . . . . . . . . . . . . . . 26
1.5.2 Sequences . . . . . . . . . . . . . . . . . . . . . . . . . 26
1.5.3 Continuity and differentiability . . . . . . . . . . . . . 27
1.5.4 Big O and little o notations . . . . . . . . . . . . . . . 30
1.5.5 Taylor’s theorem . . . . . . . . . . . . . . . . . . . . . 31
xi
xii
4 Solving Equations 87
4.1 Fixed Point Method . . . . . . . . . . . . . . . . . . . . . . 88
4.2 Bracketing Methods . . . . . . . . . . . . . . . . . . . . . . . 92
4.2.1 Bisection method . . . . . . . . . . . . . . . . . . . . . 93
4.2.1.1 Convergence of the bisection method . . . . 93
4.2.1.2 Intervals with multiple roots . . . . . . . . . 95
4.2.2 Regula-falsi method . . . . . . . . . . . . . . . . . . . 96
4.2.3 Modified regula-falsi method . . . . . . . . . . . . . . 98
4.3 Newton’s Method . . . . . . . . . . . . . . . . . . . . . . . . 99
4.3.1 Convergence rate of Newton’s method . . . . . . . . . 103
4.4 Secant Method . . . . . . . . . . . . . . . . . . . . . . . . . . 105
4.5 Solution of Nonlinear Systems . . . . . . . . . . . . . . . . . 106
4.5.1 Fixed point method for systems . . . . . . . . . . . . . 106
4.5.2 Newton’s method for systems . . . . . . . . . . . . . . 107
Bibliography 389
Index 391
Part I
Basics
1
This page intentionally left blank
Chapter 1
Preliminaries
3
4
TABLE 1.1: Common set-theoretic notations, terminology, and the corresponding definitions.
A×B {(a, b) : a ∈ A, b ∈ B}
IR reals set of all real numbers
Z integers set of all integer numbers
Z+ positive integers set of all positive integer numbers
Preliminaries 5
Example 1.1 The set Z of all integers is countable. This can be shown using
the following one-to-one correspondence:
(n − 1)/2 if n is odd
f (n) = ∀n ∈ Z+ .
−n/2 if n is even
Example 1.2 To prove that the set [0, 1] of all reals between 0 and 1 is un-
countable, assume that there is a function f : Z+ → [0, 1] defining a one-to-one
correspondence between Z+ and [0, 1]. Let f (n) = αn = 0.an1 an2 . . . ann . . . be
the decimal representation of the image of n ∈ Z+ , where ank = 0 if αn
requires less than k digits to be represented exactly. We construct number
β = 0.b1 b2 . . . bn . . . by assigning bn = 2 if ann = 1 and bn = 1, otherwise.
Then for any n we have f (n) = β, thus β cannot be counted using f (i.e.,
β ∈ [0, 1] does not have a preimage under f ). This contradicts the assumption
that a one-to-one correspondence exists.
Example 1.4 We find the roots of the polynomial p(x) = x3 − 6x2 + 10x − 4.
First, we look for integer roots of p(x). If p(x) has an integer root x1 , then
this root has to be equal to one of the integers that divide −4, i.e., ±1, ±2, ±4.
It is easy to check that p(2) = 0, so x1 = 2. Next, we can divide p(x) by x − 2,
Preliminaries 7
obtaining p(x) = (x − 2)(x2 − 4x + 2). To find the two other roots,√we need to
solve the quadratic equation x2 − 4x + 2 = 0, yielding x2,3 = 2 ± 2.
Let a set V be given, and let the operations of addition and scalar mul-
tiplication be defined on V , such that for any x, y ∈ V and any scalar α we
have x + y ∈ V and αx ∈ V .
6. (α + β)x = αx + βx.
7. (αβ)x = α(βx).
8. 1 · x = x.
In this text we deal primarily with n-dimensional real vectors, defined next.
8 Numerical Methods and Optimization: An Introduction
x = [xi ]ni=1 .
For the sake of clarity, unless otherwise specified, by a vector we will mean a
column vector. For a vector x, the corresponding row vector will be denoted
by xT , which represents the transpose of x (see Definition 1.25 at page 14).
x + y = [xi + yi ]ni=1 .
c1 v (1) + . . . + ck v (k) = 0
c1 + c2 = 0
c1 v (1) + c2 v (2) = 0 ⇔ ⇔ c1 = c2 = 0.
2c1 + 3c2 = 0
The vectors
0 0
v (1) = and v (2) =
2 3
are linearly dependent, because for c1 = −3 and c2 = 2 we have c1 v (1) +
c2 v (2) = 0.
10 Numerical Methods and Optimization: An Introduction
2. αx = |α|x;
3. x + y ≤ x + y.
i=1
The most commonly used values for p are 1, 2, and ∞, and the correspond-
ing norms are
n
• 1-norm: x1 = |xi |;
i=1
n
• 2-norm: x2 = |xi |2 ;
i=1
for a matrix of m rows and n columns, and we say that the matrix A is
of order m × n.
Next we list the algebraic rules of matrix addition and and scalar multi-
plication.
AB = C = [cij ]m×q ,
where
n
cij = aik bkj , i = 1, 2, . . . , m, j = 1, 2, . . . , q.
k=1
In other words, the identity matrix is a square matrix which has ones on
the main diagonal and zeros elsewhere.
Example 1.8
⎡ ⎤ ⎡ ⎤⎡ ⎤ ⎡ ⎤
1 0 0 1 2 3 1 0 0 1 2 3
I3 = ⎣ 0 1 0 ⎦; ⎣ 4 5 6 ⎦⎣ 0 1 0 ⎦=⎣ 4 5 6 ⎦.
0 0 1 7 8 9 0 0 1 7 8 9
Theorem 1.5 Let α be a scalar, and assume that A, B, C and the iden-
tity matrix I are matrices such that the following sums and products are
defined. Then the following properties hold.
(i) (AB)C = A(BC) associativity
(ii) IA = AI = A identity matrix
(iii) A(B + C) = AB + AC left distributive property
(iv) (A + B)C = AC + BC right distributive property
(v) α(AB) = (αA)B = A(αB) scalar associative property
1.4.5 Determinants
For a square matrix A ∈ IRn×n the determinant of A is a real number,
which is denoted by det(A). If
⎡ ⎤
a11 a12 · · · a1n
⎢ a21 a22 · · · a2n ⎥
⎢ ⎥
A = [aij ]n×n = ⎢ . .. .. .. ⎥,
⎣ .. . . . ⎦
an1 an2 · · · ann
• If n ≥ 2, then
n
det(A) = (−1)i+j aij · det(Aij ), (1.3)
j=1
where Aij is the matrix obtained from A by removing its ith row and j th
column. Note, that i in the above formula is chosen arbitrarily, and (1.3)
is called the ith row expansion. We can similarly write the j th column
expansion as
n
det(A) = (−1)i+j aij · det(Aij ). (1.4)
i=1
n
det(A) = aii .
i=1
n
tr(A) = a11 + . . . + ann = aii .
i=1
Theorem 1.7 Let A = [aij ]n×n and B = [bij ]n×n be n × n matrices and
let α be a scalar. Then
is 2, since the first two rows are linearly independent, implying that rank(A) ≥
2, and the third row is the sum of the first two rows, implying that rank(A) = 3.
Note that A−1 is unique for any nonsingular A ∈ IRn×n , since if we assume
that B and C are both inverses of A, then we have
Av = λv.
Hence, the eigenvalues of a matrix A ∈ IRn×n are the roots of the charac-
teristic polynomial p(λ) = det(A − λIn ).
(b) The trace of any matrix is equal to the sum of its eigenvalues.
(c) The eigenvalues of a nonsingular matrix A are nonzero, and the
eigenvalues of A−1 are reciprocals of the eigenvalues of A.
det(A) = 1 · 1 · 5 = 5,
tr(A) = 1 + 1 + 5 = 7,
and the eigenvalues of A−1 are μ1 = μ2 = 1, μ3 = 1/5.
Preliminaries 21
Theorem 1.12 The eigenvalues of a real symmetric matrix are all real
numbers.
A = RDRT ,
√ √
v (2) = [1/ 2, 0, −1/ 2]T .
0 1 −1 (3)
v3 0
√ √ √
v (3) = [1/ 3, 1/ 3, 1/ 3]T .
Now we are ready to write matrices D and R from the eigenvalue decompo-
sition theorem. The matrix D is a diagonal matrix containing eigenvalues of
A, ⎡ ⎤
1 0 0
D = ⎣ 0 3 0 ⎦,
0 0 4
and R has corresponding normalized eigenvectors as its columns,
⎡ √ √ √ ⎤
1/ √6 1/ 2 1/√3
R = ⎣ −2/√ 6 0√ 1/√3 ⎦ .
1/ 6 −1/ 2 1/ 3
n
n
Q(x) = aij xi xj ,
i=1 j=1
Preliminaries 23
where aij , i, j = 1, . . . , n are the coefficients of the quadratic form, x =
[x1 , . . . , xn ]T is the vector of variables.
n
Q(x) = xT Qx = xT RT DRx = y T Dy = λi yi2 .
i=1
λ1 = 1, λ2 = 3 and λ3 = 4.
where λmin (Q) and λmax (Q) are the smallest and the largest eigenvalues
of Q, respectively.
Axp
Ap = max . (1.6)
x=0 xp
m
A1 = max |aij |
1≤j≤n
i=1
and ∞-norm,
n
A∞ = max |aij |,
1≤i≤m
j=1
we have
A1 = max{1 + 3, 6 + 2} = 8;
10 0 √ √
A2 = λmax = 40 = 2 10;
0 40
A∞ = max{1 + 6, 3 + 2} = 7;
√ √
AF = 1 + 36 + 9 + 4 = 50.
Example 1.18 For x̄ ∈ IRn and ε > 0, the open ε-neighborhood of x̄ or the
open ε-ball centered at x̄ defined by
is an open set.
Example 1.19 For x̄ ∈ IRn and ε > 0, the closed ε-neighborhood of x̄ or the
closed ε-ball centered at x̄ given by
is a closed set.
1.5.2 Sequences
A sequence in IRn is given by a set {xk : k ∈ I}, where I is a countable set
of indices. We will write {xk : k ≥ 1} or simply {xk } if I is the set of positive
integers. As in Definition 1.35, we call x̄ a limit (cluster, accumulation) point
of a sequence {xk } if every ε-neighborhood of x̄ contains infinitely many points
Preliminaries 27
of the sequence. If a sequence {xk } has a unique limit point x̄, we call x̄ the
limit of the sequence. In other words, a point x̄ ∈ IRn is said to be the limit
for a sequence {xk } ⊂ IRn if for every > 0 there exists an integer K such
that for any k ≥ K we have xk − x̄ < . In this case we write
xk → x̄, k → ∞ or lim xk = x̄
k→∞
xk+1 − x∗
≤ C,
xk − x∗ R
• If lim
xk −x∗
= 0, the rate of convergence is superlinear.
k→∞
xk+1 −x∗
• If lim ∗ = μ does not hold for any μ < 1, then the rate of
k→∞
xk −x
From a geometric perspective, the mean value theorem states that under
the given conditions there always exists a point c between a and b such that
the tangent line to f at c is parallel to the line passing through the points
(a, f (a)) and (b, f (b)). This is illustrated in Figure 1.1. For the function f in
this figure, there are two points c1 , c2 ∈ (a, b) that satisfy (1.7).
Now let X ⊆ IRn . Then a function f = [f1 , . . . , fm ]T : X → IRm is called
continuous at point x̄ ∈ X if lim f (x) = f (x̄). The function is continuous on
x→x̄
X, denoted by f ∈ C(X), if it is continuous at every point of X. In this case
the first-order derivative at x̄ ∈ IRn , called Jacobian, is given by the following
m × n matrix of partial derivatives:
⎡ ∂f1 (x̄) ∂f1 (x̄)
⎤
···
⎢ ∂x1 ∂xn
⎥
Jf (x̄) = ⎢
⎣
..
.
..
.
..
.
⎥.
⎦
∂fm (x̄) ∂fm (x̄)
∂x1 ··· ∂xn
Preliminaries 29
f (b)
f (c1 )
a c2
c1 b
f (c2 )
f (a)
If all partial derivatives exist and are continuous on an open set containing x̄,
then f is continuously differentiable. If m = 1, i.e., we have f : IRn → IR, the
Jacobian at x̄ ∈ IRn is given by the vector of partial derivatives
T
∂f (x̄) ∂f (x̄)
∇f (x̄) = ,...,
∂x1 ∂xn
at x̄ and is called the gradient of f at x̄.
For f : IRn → IR and x̄, d ∈ IRn , the directional derivative of f (x) at x̄ in
the direction d is defined as
∂f (x̄) f (x̄ + αd) − f (x̄)
= lim .
∂d α→0 α
(x̄)
If d = 1, then ∂f∂d is also called the rate of increase of f at x̄ in the
direction d.
Assume that f is differentiable. Denoting by φ(α) = f (x̄ + αd), we have
∂f (x̄) f (x̄ + αd) − f (x̄)
= lim
∂d α→0 α
φ(α) − φ(0)
= lim
α→0 α
= φ (0).
On the other hand, using the chain rule, according to which the derivative of
the composite function f (g(α)) is equal to the product of the derivatives of f
and g, we have
φ (α) = ∇f (x̄ + αd)T d ⇒ φ (0) = ∇f (x̄)T d.
30 Numerical Methods and Optimization: An Introduction
So, we obtain
∂f (x̄)
= ∇f (x̄)T d.
∂d
For f : IRn → IR, the second-order derivative of f at x̄ is given by the
matrix of second-order partial derivatives of f at x̄,
⎡ ∂ 2 f (x̄) ∂ 2 f (x̄)
⎤
∂x21
··· ∂x1 ∂xn
⎢ ⎥
∇2 f (x̄) = ⎢
⎣
..
.
..
.
..
.
⎥
⎦
∂ 2 f (x̄) ∂ 2 f (x̄)
∂xn ∂x1 ··· ∂x2n
|f (x)|
It is easy to show that if lim = c, where c < ∞ is a positive number,
x→x̄ |g(x)|
then f (x) = O(g(x)) and g(x) = O(f (x)) as x → x̄.
Example 1.20 For f (x) = 10x2 +100x3 , g(x) = x2 , we have f (x) = O(g(x))
as x → 0 since
f (x) 10x2 + 100x3
lim = lim = 10.
x→0 g(x) x→0 x2
For f (x) = 6x3 − 10x2 + 15x and g(x) = x3 , we have f (x) = O(g(x)) as
x → ∞ since
f (x) 6x3 − 10x2 + 15x
lim = lim = 6.
x→∞ g(x) x→∞ x3
For f (x) = x2 and g(x) = x, we have f (x) = o(g(x)) as x → 0.
Preliminaries 31
and
f (n+1) (ξ)
Rn (x) = (x − x0 )n+1 . (1.10)
(n + 1)!
The polynomial Pn (x) is called the Taylor polynomial of degree n.
For f : IRn → IR, we will use Taylor’s theorem for multivariate functions
in the following forms.
Example 1.21 Let f (x) = x31 + x32 + 3x1 x2 + x1 − x2 + 1, x̄ = [0, 0]T . Then
3x21 + 3x2 + 1 6x1 3
∇f (x) = , ∇ f (x) =
2
,
3x22 + 3x1 − 1 3 6x2
and
x1 6x̃1 3 x1
f (x) = 1 + [1, −1] + 12 [x1 , x2 ]
x2 3 6x̃2 x2
= 1 + x1 − x2 + 3x̃1 x1 + 3x̃2 x2 + 3x1 x2 .
2 2
for some x̃ between x and 0, i.e., x̃ = αx + (1 − α)0 = αx for some α ∈ (0, 1).
For x = [1, 2]T , we have f (x) = 15 and we can find x̃ by solving the following
equation for α:
3α + 24α + 6 = 15 ⇔ α = 1/3.
Thus, x̃ = [1/3, 2/3]T and, according to (1.12),
at x = [1, 2]T .
The linear approximation
in (1.13) and (1.14) works well if x√is very close to x̄. For example, for
x = [0.1, 0.1] with x − x̄ = 0.1 × 2 ≈ 0.1414, we have f (x) = 1.032,
while the linear approximation gives f (x) ≈ 1 with the error R1 (x) = 0.032.
Using the quadratic approximation (1.15) for x̄ = 0, we have
1
f (x) ≈ f (x̄) + ∇f (x̄)T (x − x̄) + (x − x̄)T ∇2 f (x̄)(x − x̄) = 1 + x1 − x2 + 3x1 x2 ,
2
and for x = [0.1, 0.1]T we obtain f (x) ≈ 1.03 with the error R2 (x) = 0.002.
Exercises
1.1. Let f : X → Y be an arbitrary mapping and X , X ⊆ X, Y , Y ⊆ Y .
Prove that
(a) f −1 (Y ∪ Y ) = f −1 (Y ) ∪ f −1 (Y );
Preliminaries 33
(b) f −1 (Y ∩ Y ) = f −1 (Y ) ∩ f −1 (Y );
(c) f (X ∪ X ) = f (X ) ∪ f (X );
(d) f (X ∩ X ) may not be equal to f (X ) ∩ f (X ).
1.2. Prove that the following sets are countable:
(a) the set of all odd integers;
(b) the set of all even integers;
(c) the set 2, 4, 8, 16, . . . , 2n , . . . of powers of 2.
1.3. Show that
(a) every infinite subset of a countable set is countable;
(b) the union of a countable family of countable sets A1 , A2 , . . . is
countable;
(c) every infinite set has a countable subset.
1.4. Show that each of the following sets satisfies axioms from Definition 1.4
and thus is a linear space.
(a) IRn with operations of vector addition and scalar multiplication.
(b) IRm×n with operations of matrix addition and scalar multiplication.
(c) C[a, b]–the set of all continuous real-valued functions defined on the
interval [a, b], with addition and scalar multiplication defined as
(αf )(x) = αf (x), x ∈ [a, b] for each f ∈ C[a, b] and any scalar α;
respectively.
(d) Pn –the set of all polynomials of degree at most n with addition
and scalar multiplication defined as
d(0) = p(0) ;
s−1 T
p(s) d(i) (i)
d(s) = p(s) − d(i)T d(i)
d , s = 1, . . . , k − 1
i=0
is orthogonal.
34 Numerical Methods and Optimization: An Introduction
1.6. Show that for p = 1, 2, ∞ the norm · p is compatible, that is for any
A ∈ IRm×n , x ∈ IRn :
Axp ≤ Ap xp .
1.7. Let ⎡ ⎤ ⎡ ⎤
a1 b1
⎢ ⎥ ⎢ .. ⎥
a = ⎣ ... ⎦ and b = ⎣ . ⎦
an bn
be two vectors in IRn .
1.8. Show that a square matrix A is orthogonal if and only if both the
columns and rows of A form sets of orthonormal vectors.
1.9. A company manufactures three different products using the same ma-
chine. The sell price, production cost, and machine time required to
produce a unit of each product are given in the following table.
The table below represents a two-week plan for the number of units of
each product to be produced.
Week 1 Week 2
Product 1 120 130
Product 2 100 80
Product 3 50 60
Use a matrix product to compute, for each week, the revenue received
from selling all items manufactured in a given week, the total production
cost for each week, and the total machine time spent each week. Present
your answers in a table.
Preliminaries 35
1 yard = 3 feet
1 foot = 12 inches
37
38 Numerical Methods and Optimization: An Introduction
where all ai ∈ {0, 1, . . . , 9}. The radix point is called the decimal point in
the decimal system.
However, the base 10 is not the only choice, and other bases can be used.
The majority of modern computers use the base-2 or binary system.
where all ai ∈ {0, 1}. In this case the radix point is called the binary
point.
(10110.1)2 = 1 × 24 + 0 × 23 + 1 × 22 + 1 × 21 + 0 × 20 + 1 × 2−1 .
n
N = an β + . . . + a0 β ≤ (β − 1)
n 0
β i = β n+1 − 1,
i=0
(10)2 = 1 × 21 + 0 × 20 = 2.
bn = an ;
bn−1 = an−1 + bn β = an−1 + an β;
bn−2 = an−2 + bn−1 β = an−2 + an−1 β + an β 2 ;
.. ..
. .
b0 = a 0 + b1 β = a0 + a1 β + a2 β 2 + . . . + an β n .
Algorithm 2.1 can be used to convert integers from the binary to the
decimal system.
i=3: N = 0 + 1 × 2 = 2;
i=2: N = 1 + 2 × 2 = 5;
i=1: N = 1 + 5 × 2 = 11;
i=0: N = 1 + 11 × 2 = 23.
(10110)2 = 1 × 24 + 0 × 23 + 1 × 22 + 1 × 21 + 1 × 20 .
N − βN/β,
where N/β is the integer part of N/β. If we apply the same procedure to
N/β, we can compute b1 , and so on, as in Algorithm 2.2.
Example 2.5 We convert the decimal 195 to the binary form using Algo-
rithm 2.2. We have:
i = 1 : N0 = 97, b1 = 97 − 297/2 = 1;
i = 2 : N0 = 48, b2 = 48 − 248/2 = 0;
i = 3 : N0 = 24, b3 = 24 − 224/2 = 0;
i = 4 : N0 = 12, b4 = 12 − 212/2 = 0;
i = 5 : N0 = 6, b5 = 6 − 26/2 = 0;
i = 6 : N0 = 3, b6 = 3 − 23/2 = 1;
x = xI + xF ,
where xI = x is the integer part x, and xF = {x} is the fractional part of
x. For example, for x = 5.3 we have xI = 5 and xF = 0.3. We can convert xI
and xF to another base separately and then combine the results. Note that
the xF part can be written in the form
∞
xF = a−k 10−k ,
k=1
i = 2: D = (1 + 0.3125)/2 = 0.65625;
i = 1: D = (1 + 0.65625)/2 = 0.828125.
Thus, D = 0.828125.
and a−2 is the integer part of F2 , etc. In summary, we obtain the procedure
described in Algorithm 2.4, where we assume that the given decimal fraction
xF terminates and use the same variable F for all Fi , i ≥ 1.
We see that F = 0.2 assumes the same value as for i = 1, therefore, a cycle
occurs. Hence we have
0.1 = (0.00011)2 ,
i.e., 0.1 = (0.00011 0011 0011 . . . 0011 . . .)2 .
Note that if we had to convert (0.00011)2 to a decimal, we could use a
trick called shifting, which works as follows. If we multiply (0.00011)2 by 2,
we obtain (0.0011)2 . Because of the cycle, multiplying (0.00011)2 by 25 = 32
gives a number with the same fractional part, (11.0011)2 . Hence, if we denote
the value of (0.00011)2 by A, we have
where
m = ±(0.d1 d2 . . . dn )β ,
and m is called the mantissa or significand; β is the base; n is the length or
precision; and e is the exponent, where s < e < S (usually s = −S).
The mantissa is usually normalized when its leading digit is zero. The next
example shows why.
0.02564 · 100 .
Obviously, the inclusion of the useless zero to the right of the decimal point
leads to dropping of the digit 1 in the sixth decimal place. But if we normalize
the number by representing it as
0.25641 · 10−1 ,
|xT − xC |
.
|xT |
Example 2.11 Consider a problem, in which one wants to find the smallest
value taken by some function y = f (x) defined over the interval [0, 1] (Figure
2.2). The set of all values taken by f (x) is given by X = {f (x), x ∈ [0, 1]}. Ob-
viously, the set X is infinite, and most of its elements are irrational numbers,
requiring infinitely many digits to be represented exactly.
0 x∗ x̂ 1
x0 x1 x2 x3 x4 x5 x6 x
In reality, any digital computer is finite by its nature. Thus, the infinite set
of values should be approximated by a finite set, in which, in its turn, each ele-
ment should be approximated by a numerical value representable with a finite
number of digits. This leads to two types of errors in numerical computation:
the round-off and truncation error.
Example 2.12 In the problem from Example 2.11, we can consider the set of
n + 1 mesh points {xi = ni , i = 0, 1, . . . , n}, and a finite set Xn = {f (xi ), i =
Numbers and Errors 47
Example 2.13 Assume that we want to write our answer f˘ to the problem in
the previous example as a five-digit decimal number instead of fˆ = 4/9. Then
f˘ = 0.4444 and the absolute round-off error is |fˆ − f˘| = 4/9 − 4444/10000 =
1/22500 ≈ 0.000044444, where the last number is an approximation of the
absolute round-off error.
The maximum possible |δ| is called unit round-off. The machine epsilon is
defined as the smallest positive number ε such that 1 + ε = 1.
Then
x ◦ y = x ⊗ y
x ⊗ y = f l(x ◦ y).
|z−zC |
and the relative round-off error is |z| = 0.3324 = 33.24%.
Exercises
2.1. Find the binary representations of the numbers
(a) a = 32170;
(b) b = 7/16;
(c) c = 75/128.
2.2. Find infinite repeating binary representations of the following numbers:
(a) a = 1/3;
(b) b = 1/10;
(c) c = 1/7.
2.3. Find the binary representation of 106 and 43 .
2.4. Convert (473)10 into a number with the base
(a) 2;
(b) 6;
(c) 8.
2.5. Find the decimal representations of the following numbers:
(a) a = (101011010101)2 ;
(b) b = (16341)8 ;
(c) c = (4523)6 .
2.6. Prove that any number 2−n , where n is a positive integer, can be repre-
sented as a n-digit decimal number 0.a1 a2 . . . an .
2.7. Prove that 2 = 1.999999 . . ..
2.8. For a decimal integer with m digits, how many bits are needed for its
binary representation?
2.9. Create a hypothetical binary floating-point number set consisting of 7-
bit words, in which the first three bits are used for the sign and the
magnitude of the exponent, and the last four are used for the sign and
magnitude of the mantissa. On the sign place, 0 indicates that the quan-
tity is positive and 1, negative. For example, the number represented in
1
the following figure is −(.100)2 × 2(1×2 ) = −(1 × 2−1 ) × 4 = −2.
± 21 20 ± 2−1 2−2 2−3
0 1 0 1 1 0 0
exponent mantissa
Numbers and Errors 51
2.10. Consider the quadratic equation ax2 + bx + c = 0. Its roots can be found
using the formula √
−b ± b2 − 4ac
x1,2 = .
2a
Let a = 1, b = 100 + 10−14 , and c = 10−12 . Then the exact roots of the
considered equation are x1 = −10−14 and x2 = −100.
(a) Use the above formula to compute the first root on a computer.
What is the relative round-off error?
(b) Use the following equivalent formula for the first root:
−2c
x1 = √ .
b + b2 − 4ac
What do you observe?
2.11. Use a computer to perform iterations in the form xk+1 = (0.1xk −
0.2)30, k ≥ 0 starting with x0 = 3. You could use, e.g., a spreadsheet
application. What do you observe after (a) 50 iterations; (b) 100 itera-
tions? Explain.
This page intentionally left blank
Part II
53
This page intentionally left blank
Chapter 3
Elements of Numerical Linear Algebra
In this system, the first two equations express the goal of obtaining the return
of 1.2 under scenarios I and II, respectively. The third equation indicates that
the total amount of the investment to be made is $1 million.
55
56 Numerical Methods and Optimization: An Introduction
Example 3.2 The system from Example 3.1 has the following matrix form:
⎡ ⎤⎡ ⎤ ⎡ ⎤
1.4 0.8 1.2 x1 1.2
⎣ 0.9 2 1.0 ⎦ ⎣ x2 ⎦ = ⎣ 1.2 ⎦ .
1 1 1 x3 1
has the solution x∗1 = 1/2, x∗2 = 1/4, x∗3 = 1/4, thus it is consistent.
Elements of Numerical Linear Algebra 57
(iii) det(A) = 0.
Some direct methods proceed by first reducing the given system to a spe-
cial form, which is known to be easily solvable, and then solving the resulting
“easy” system. Triangular systems of linear equations, discussed next, repre-
sent one such easily solvable case.
(1)
Without loss of generality we can assume that a11 = 0 (if this is not the case,
(1)
we can switch rows so that a11 = 0). In the Gaussian elimination method, we
(1)
first “eliminate” elements ai1 , i = 2, . . . , m in the first column, by turning
them into 0. This can be done by replacing the ith row, i = 2, . . . , m with the
(1)
ai1
row which is obtained by multiplying the first row by − (1) and adding the
a11
result to the ith row, thus obtaining
(1)
(2) (1) ai1 (1)
aij = aij − a ,
(1) 1j
i = 2, . . . , n, j = 1, 2, . . . , n, n + 1.
a11
60 Numerical Methods and Optimization: An Introduction
(2)
Next, assuming that a22 = 0, we use the second row to obtain zeros in rows
3, . . . , n of the second column of matrix M (2) :
(2)
(3) (2) ai2 (2)
aij = aij − a ,
(2) 2j
i = 3, . . . , n, j = 2, . . . , n, n + 1.
a22
Given two augmented matrices A1 and A2 , the fact that they correspond
Elements of Numerical Linear Algebra 61
row of M (1) , we multiply the first row by −5 and add the result to the second
row to obtain the second row of M (2) . This can be written as
⎡ ⎤ ⎡ ⎤
1 2 −4 −4 (2) (1) (1)
1 2 −4 −4
⎣ 5 11 −21 −22 ⎦ ∼R2 =−5R1 +R2 ⎣ 0 1 −1 −2 ⎦ .
3 −2 3 11 3 −2 3 11
M (1)
We proceed by eliminating the first element of the third row, thus obtaining
matrix M (2) :
⎡ ⎤ ⎡ ⎤
1 2 −4 −4 (2) (1) (1)
1 2 −4 −4
⎣ 0 1 −1 −2 ⎦ ∼R3 =−3R1 +R3 ⎣ 0 1 −1 −2 ⎦ .
3 −2 3 11 0 −8 15 23
M (2)
Finally,
Ā b̄
⎡ ⎤ ⎡ ⎤
1 2 −4 −4 (3) (2) (2)
1 2 −4 −4
⎣ 0 1 −1 −2 ⎦ ∼R3 =8R2 +R3 ⎣ 0 1 −1 −2 ⎦ .
0 −8 15 23 0 0 7 7
M (2) M (3)
which has the solution [x1 , x2 ] = [5, 1]. We use three-digit arithmetic to solve
this system using Gaussian elimination. We have
0.102 2.45 2.96 (2) (1)
R2 =R2 −198·R1
(1) 0.102 2.45 2.96
∼ ,
20.2 −11.4 89.6 0 −497 −496
as the pivotal element by switching the k th and lth rows. Then we have
(k)
a
pk
(k) ≤ 1, ∀p ≥ k.
a
lk
Thus the solution can be extracted from the right-hand-side vector of the last
matrix: [x1 , x2 , x3 ] = [2, −1, 1].
such that
AX = In ,
where In denotes the n × n identity matrix. Then in order to find the first
column of X, we can solve the system
⎡ ⎤⎡ ⎤ ⎡ ⎤
a11 a12 · · · a1n x11 1
⎢ a21 a22 · · · a2n ⎥ ⎢ x21 ⎥ ⎢ 0 ⎥
⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢ .. .. .. .. ⎥ ⎢ .. ⎥ = ⎢ .. ⎥ .
⎣ . . . . ⎦ ⎣ . ⎦ ⎣ . ⎦
an1 an2 ··· ann xn1 0
When the coefficient matrix is reduced to the identity matrix using elementary
row operations, the right-hand side of the resulting augmented matrix will
contain the inverse of A. So, starting with [A|In ], we use the Gauss-Jordan
method to obtain [In |A−1 ].
Elements of Numerical Linear Algebra 65
Let us eliminate the elements in rows 2 and 3 of the first column using a11 = 1
as the pivotal element:
⎡ ⎤
1 2 −4 1 0 0
⎣ 0 1 −1 −5 1 0 ⎦.
0 −8 15 −3 0 1
We can use the second row to eliminate non-diagonal elements in the second
column:
⎡ ⎤
1 0 −2 11 −2 0
⎣ 0 1 −1 −5 1 0 ⎦.
0 0 7 −43 8 1
Finally, we can divide row 3 by 7 and use this row to eliminate coefficients
for x3 in other rows:
⎡ ⎤
1 0 0 −9/7 2/7 2/7
⎣ 0 1 0 −78/7 15/7 1/7 ⎦ .
0 0 1 −43/7 8/7 1/7
A−1
Now to find the solution of (3.2) all we need to do is to multiply A−1 by the
right-hand-side vector b:
⎡ ⎤⎡ ⎤ ⎡ ⎤
−9/7 2/7 2/7 −4 2
x = A−1 b = ⎣ −78/7 15/7 1/7 ⎦ ⎣ −22 ⎦ = ⎣ −1 ⎦ .
−43/7 8/7 1/7 11 1
66 Numerical Methods and Optimization: An Introduction
from Example 3.5 (page 61). In this example, we replaced the second row of
M (1) by its sum with the first row multiplied by −5 to obtain
⎡ ⎤
1 2 −4 −4
C = ⎣ 0 1 −1 −2 ⎦.
3 −2 3 11
It is easy to check that the same outcome results from performing the following
matrix multiplication:
⎡ ⎤⎡ ⎤ ⎡ ⎤
1 0 0 1 2 −4 −4 1 2 −4 −4
⎣ −5 1 0 ⎦ ⎣ 5 11 −21 −22 ⎦ = ⎣ 0 1 −1 −2 ⎦ .
0 0 1 3 −2 3 11 3 −2 3 11
(−5) M (1) C
E21
Next, in Example 3.5, we replaced the third row of the current matrix C by
its sum with the first row of C multiplied by −3 to obtain M (2) , that is,
(−3) (−3) (−5)
M (2) = E31 C = E31 E21 M (1) .
Finally, we replaced the third row of M (2) by its sum with the second row of
M (2) multiplied by 8 to obtain M (3) :
(8) (8) (−3) (−5)
M (3) = E32 M (2) = E32 E31 E21 M (1) .
In the process of obtaining M (3) = [A(3) |b(3) ], the coefficient matrix A has
undergone the following transformations to become an upper triangular matrix
U ≡ A(3) :
(8) (−3) (−5)
U = E32 E31 E21 A.
Hence,
−1 −1 −1
(−5) (−3) (8)
A = E21 E31 E32 U = LU,
Elements of Numerical Linear Algebra 67
−1 −1 −1
(−5) (−3) (8)
where L = E21 E31 E32 . Next we show that L is a lower
−1
(m ) (−m )
triangular matrix. Note that Ekl kl = Ekl kl and
⎡ ⎤
1 0 0
= ⎣ −m21 0 ⎦.
(−m21 ) (−m31 ) (−m32 )
E21 E31 E32 1
−m31 −m32 1
Hence,
⎡ ⎤
−1 −1 −1 1 0 0
=⎣ 5 0 ⎦.
(−5) (−3) (8) (5) (3) (−8)
L= E21 E31 E32 = E21 E31 E32 1
3 −8 1
(1)
and we first exchange the first two rows
of M . The permutation correspond-
1 2 3
ing to this row exchange is p1 = . For each permutation p we
2 1 3
can define the corresponding permutation matrix P = [pij ]n×n such that
1, if p(i) = j,
pij =
0, otherwise.
which is exactly M (1) after exchange of its first two rows. Next, we eliminate
the below-diagonal elements in the first column:
⎡ ⎤
5 11 −21 −22
P1 M (1) = ⎣ 0 −1/5 2/5 ⎦ = M (2) .
(−3/5) (−1/5)
E31 E21 1/5
0 −43/5 78/5 121/5
we have
P A = LU ⇐⇒ A = P T LU.
Consider a system Ax = b and suppose that a triangular factorization
A = LU of A is known. Then
Ax = b ⇐⇒ LU x = b ⇐⇒ Ly = b, where U x = y.
Ax = b ⇐⇒ (P A)x = P b ⇐⇒ LU x = b ,
Then the absolute error after k iterations of the scheme expressed in terms of
the norm · V satisfies the following inequality:
Since
x(k−1) − x∗ V ≤ (In − CA)M · (x(k−2) − x∗ )V ,
we have
x(k) − x∗ V ≤ (In − CA)2M · (x(k−2) − x∗ )V .
Continuing likewise and noting that the error bound is multiplied by the factor
of In − CAM each time, we obtain the following upper bound on the error:
Therefore, if In −CAM < 1, then x(k) −x∗ V → 0, k → ∞, and the method
converges. A matrix C such that In − CAM < 1 for some matrix norm is
called an approximate inverse of A.
Example 3.9 If we choose C = A−1 , then for any initial x(0) we have:
Recall that when In − D−1 AM < 1 for some matrix norm, the method is
guaranteed to converge. We have
⎡ ⎤
0 a12
a11 ··· a1n
a11
⎢ a21
0 ··· a2n ⎥
⎢ a22 a22 ⎥
In − D−1 A = ⎢ .. .. .. .. ⎥.
⎣ . . . . ⎦
an1
ann
an2
ann ··· 0
n
|aii | > |aij |, i = 1, 2, . . . , n.
j=1
j=i
n
|ajj | > |aij |, j = 1, 2, . . . , n.
i=1
i=j
n
|aij |
In − D−1 A∞ = max < 1,
1≤i≤n
j=1
|aii |
j=i
n
|aij |
In − D−1 A1 = max < 1,
1≤i≤n
i=1
|aii |
i=j
The true solution is x∗ = [1, 1]T . We apply the Jacobi method three times with
x(0) = [0, 0]T to find an approximate solution of this system. We have:
1
−1 2 0
D = .
0 15
Hence, using the Jacobi iteration (3.4) we obtain:
(1) 1/2 0 3 3/2
x = = ;
0 1/5 8 8/5
3/2 1/2 0 3 23/5 7/10
(2)
x = + − = ;
8/5 0 1/5 8 25/2 7/10
7/10 1/2 0 9/10 23/20
x(3) = + = .
7/10 0 1/5 12/5 59/50
Notice how the error decreases:
x(1) − x∗ ∞ = 0.60;
∗
x (2)
− x ∞ = 0.30;
∗
x (3)
− x ∞ = 0.18.
In general,
(k+1) (k)
(k+1) − j<i aij xj − j>i aij xj + bi
xi = , i = 1, 2, . . . , n. (3.5)
aii
(k+1) (k+1) (k+1) (k+1)
Hence, computing xi requires the values of x1 , x2 , . . . , xi−1 .
For k = 0 we have:
(1) (1)
2x1 = 3 ⇒ x1 = 1.5,
(1) (1)
5x2 = −9/2 + 8 ⇒ x2 = 0.7.
For k = 1 we obtain:
(2) (2)
2x1 = −7/10 + 3 ⇒ x1 = 23/20 = 1.15,
(2) (2)
5x2 = −69/20 + 8 ⇒ x2 = 91/100 = 0.91.
Finally, for k = 2:
(3) (3)
2x1 = −91/100 + 3 ⇒ x1 = 209/200 = 1.045,
(3) (3)
5x2 = −627/200 + 8 ⇒ x2 = 973/1000 = 0.973.
Recall that the true solution of the considered system is x∗ = [1, 1]T , therefore
the errors for each step are
x(1) − x∗ ∞ = 0.500;
x(2) − x∗ ∞ = 0.150;
∗
x (3)
− x ∞ = 0.045.
We can observe that for this system, the Gauss-Seidel method converges faster
than the Jacobi method.
74 Numerical Methods and Optimization: An Introduction
In the open model there is also the open sector demand for di ≥ 0 units of
product i, whereas in the closed model the open sector is ignored (d = 0).
Denote by xi the output of the ith product needed to meet the total demand.
Then the output of xj units of product j will require the input of aij xj units
of product i. Since the volume of production of the ith product should be
equal to the total demand for the product i, we have:
and, taking into account that aij > 0 for i, j = 1, 2, . . . , n, we conclude that
In − A is strictly diagonally dominant by columns. Hence, for any initial guess
x(0) , the Jacobi method applied to (3.7) will converge to the unique solution
Elements of Numerical Linear Algebra 75
n
(k)
di + aij xj
j=1
(k+1) j=i
xi = for i = 1, 2, . . . , n,
(1 − aii )
The following theorem yields a method for finding a least squares solution of
an overdetermined system of linear equations.
AT Ax = AT b,
Proof. We need to show that b − Ax∗ 2 ≤ b − Ax2 for any x ∈ IRn . For
an arbitrary x ∈ IRn , we have:
b − Ax22 = (b − Ax∗ ) + (Ax∗ − Ax)22
= b − Ax∗ 22 + 2(x∗ − x)T (AT b − AT Ax∗ ) + A(x∗ − x)2
=0 ≥0
≥ b − Ax∗ 22 ,
which proves that x∗ is a least squares solution of the system Ax = b.
Example 3.12 Find the least squares solution of the system
x1 + x2 = 1
x1 − x2 = 3
x1 + 2x2 = 2.
First, we show that the system has no exact solution. Solving for the first two
equations, we find that x1 = 2, x2 = −1. Putting these values in the third
equation we obtain 0 = 2, implying that the system has no solution.
To find the least squares solution, we solve the system AT Ax = AT b, where
⎡ ⎤ ⎡ ⎤
1 1 1
A = ⎣ 1 −1 ⎦ , b = ⎣ 3 ⎦ .
1 2 2
We have
3 2 x1 6
A Ax = A b ⇐⇒
T T
= .
2 6 x2 2
This system has a unique solution
∗
x1 16/7
= .
x∗2 −3/7
Such a line is called the linear regression line for the points [x1 , y1 ]T , . . . , [xn , yn ]T .
Clearly, this problem is equivalent to the problem of finding a least squares
solution of the following overdetermined linear system with n equations and
two unknowns (a and b):
ax1 + b = y1
···
axn + b = yn .
Elements of Numerical Linear Algebra 77
T T
The
solution
can be obtained by solving
the system A Az = A y, where
a x1 . . . x n
z= , y = [y1 , . . . , yn ]T , and AT = . We have:
b 1 ... 1
n n
2 n
xi a + xi b = x i yi
AT Az = AT y ⇐⇒ i=1 n
i=1 i=1
n
xi a + nb = yi .
i=1 i=1
Since |λi /λ1 | < 1, the direction of x(k) tends to that of v1 as k → ∞ (assuming
c1 = 0). Also, for
(x(k) )T Ax(k)
μ(k) = ,
(x(k) )T x(k)
we have μ(k) → λ1 , k → ∞ according to (3.10).
To ensure the convergence of x(k) to a nonzero vector of bounded length,
80 Numerical Methods and Optimization: An Introduction
x(k)
v (k) = , x(k+1) = Av (k) , k ≥ 0. (3.11)
x(k) 2
Also,
(v (k) )T Av (k)
μ(k) = = (v (k) )T x(k+1) . (3.12)
(v (k) )T v (k)
In summary, starting with an initial guess x(0) , we proceed by computing
{v (k) : k ≥ 1} and {μ(k) : k ≥ 1} using (3.11)–(3.12) to find approximations
of v1 and λ1 , respectively.
w = Aw, (3.14)
Note that A is a column-stochastic matrix (that is, all its elements are
nonnegative and each column sums up to 1), and as such is guaranteed to have
Elements of Numerical Linear Algebra 81
Exercises
3.1. Solve the following systems of linear algebraic equations using
82 Numerical Methods and Optimization: An Introduction
(i) x1 + x2 + 2x3 = 1
2x1 + x2 − 3x3 = 0
−3x1 − x2 + x3 = 1
1 1
(ii) x1 + 2 x2 + 3 x3 = 1
1 1 1
2 x1 + 3 x2 + 4 x3 = 0
1 1 1
3 x1 + 4 x2 + 5 x3 = 0
3.4. How many multiplication and division operations are required to solve
a linear system using
3.5. Let
3 2 1
A= , b= .
1 2 0
3.6. For the systems in Exercise 3.2, use x(0) = [−1, 1, 2]T as the initial guess
and do the following:
3.7. Let ⎡ ⎤ ⎡ ⎤
3 −1 1 −1
A=⎣ 0 2 1 ⎦; b = ⎣ 0 ⎦.
−1 1 4 1
3.8. Given
84 Numerical Methods and Optimization: An Introduction
(i)
⎡ ⎤ ⎡ ⎤ ⎡ ⎤
−3 1 1 1 1
A=⎣ 1 2 0 ⎦, b = ⎣ −1 ⎦ , and x(0) = ⎣ 1 ⎦;
1 −1 3 0 1
(ii)
⎡ ⎤ ⎡ ⎤ ⎡ ⎤
2 0 1 −1 1
A = ⎣ −1 3 1 ⎦, b = ⎣ 0 ⎦, and x(0) = ⎣ 2 ⎦;
0 1 −2 1 −1
(iii)
⎡ ⎤ ⎡ ⎤ ⎡ ⎤
3 1 1 −1 1
A = ⎣ −1 2 0 ⎦, b = ⎣ 0 ⎦, and x(0) = ⎣ 2 ⎦;
2 −1 −4 2 3
(iv)
⎡ ⎤ ⎡ ⎤ ⎡ ⎤
4 3 −2 1 1
A = ⎣ −2 5 0 ⎦, b = ⎣ 2 ⎦, and x(0) = ⎣ 0 ⎦;
1 −1 −4 0 −1
(v)
⎡ ⎤ ⎤⎡ ⎤⎡
5 2 −1 0 4 0
⎢ 1 7 2 −3 ⎥ ⎢ 0 ⎥ ⎢ 0 ⎥
A=⎢
⎣ 0
⎥, b=⎢ ⎥
⎣ −5 ⎦ , and x(0) =⎢ ⎥
⎣ 0 ⎦;
3 −6 1 ⎦
−2 4 −2 9 5 0
Use x(0) as an initial guess. What can you say about the convergence of
the Jacobi and Gauss-Seidel methods in each case?
Example 4.1 John saves money by making regular monthly deposits in the
amount p to his account. Assume that the annual interest rate is r. Then the
total amount, A, that John will have after n payments is
r r 2 r n−1
A=p+p 1+ +p 1+ + ... + p 1 + . (4.2)
12 12 12
$ %
r i−1
In this expression, the term p 1 + 12 is the contribution of the (n − i)-
th deposit toward the total sum, that is, the contribution of the last, month
n,$ payment
% is p, the contribution of the payment made the month before is
r
p 1 + 12 (the deposit plus the interest for one month), etc.; and the contri-
$ %
r n−1
bution of the first payment is p 1 + 12 (the deposit plus the interest for
n − 1 months). The right-hand side of Equation (4.2) is the sum of n terms
of a geometric series, hence
n r i−1 r n
(1 + 12 ) −1
A= p 1+ =p ,
i=1
12 (1 + 12 ) − 1
r
87
88 Numerical Methods and Optimization: An Introduction
upon retirement is A. Then in order to find an interest rate that would be high
enough to achieve his target, John needs to solve the following equation with
respect to r:
p r n
F (r) = 1+ − 1 − A = 0. (4.4)
r/12 12
There are only a few types of equations that can be solved by simple
analytical methods. These include linear and quadratic equations
ax + b = 0,
ax2 + bx + c = 0.
In general, the problem of finding a solution of a nonlinear equation is not
easy. For example, for a polynomial of degree n
p(x) = an xn + an−1 xn−1 + an−2 xn−2 + . . . + a1 x + a0 ,
where n > 4 there are no general formulas to solve the equation p(x) = 0.
Moreover, in 1823 a Norwegian mathematician Niels Henrik Abel (1802–1829)
had shown that no such formulas can be developed for general polynomials of
degree higher than four.
When direct solution methods are not available, numerical (iterative) tech-
niques are used, which start with an initial solution estimate x0 and proceed
by recursively computing improved estimates x1 , x2 , . . . , xn until a certain
stopping criterion is satisfied.
Numerical methods typically give only an approximation to the exact so-
lution. However, this approximation can be of a very good (predefined) accu-
racy, depending on the amount of computational effort one is willing to invest.
One of the advantages of numerical methods is their simplicity: they can be
concisely expressed in algorithmic form and can be easily implemented on a
computer. The main drawback is that in some cases numerical methods fail.
We will illustrate this point when discussing specific methods.
such that (4.6) is equivalent to (4.5) at the interval (a, b), i.e., such that
x∗ ∈ (a, b) solves (4.5) if and only if x∗ solves (4.6).
Example 4.2 Put f (x) = x − α(x)F (x), where α(x) = 0 if x ∈ (a, b). Then,
obviously, f (x) = x ⇔ α(x)F (x) = 0 ⇔ F (x) = 0.
To find a root x∗ ∈ (a, b) of Equation (4.6), we take some starting point
x0 ∈ (a, b) and sequentially calculate x1 , x2 , . . . using the formula
xk+1 = f (xk ), k = 0, 1, . . . . (4.7)
In the above, we assume that f (xk ) ∈ (a, b) for all k, so xk is always in the
domain of F .
Definition 4.3 The iteration xk+1 = f (xk ) is called a fixed point iter-
ation.
Example 4.3 For f (x) = exp(−x) and x0 = −1, four fixed point iterations
produce the following points:
x1 = f (x0 ) ≈ 2.718282,
x2 = f (x1 ) ≈ 0.065988,
x3 = f (x2 ) ≈ 0.936142,
x4 = f (x3 ) ≈ 0.392138.
90 Numerical Methods and Optimization: An Introduction
y y=x
f (x0 )
f (x2 )
f (x3 )
0 f (x1 )
x0 x2 x4 x∗ x3 x1 x
FIGURE 4.1: Four fixed point iterations applied to f (x) = exp (−x) starting
with x0 = −1.
The iterations are illustrated in Figure 4.1. Observe that applying the fixed
point iteration recursively will produce a sequence converging to the fixed point
x∗ ≈ 0.567143.
The following example shows that a repeated application of the fixed point
iteration may not produce a convergent sequence.
x1 = f (x0 ) = 1/4,
x2 = f (x1 ) = 4 = x0 ,
hence, if we continue, we will cycle between the same two points, x0 and x1 .
See Figure 4.2 for an illustration.
f (x1 )
f (x0 )
0
x1 x∗ x0 x
FIGURE 4.2: Fixed point iterations applied to f (x) = 1/x starting with
x0 = 4 lead to a cycle x0 , x1 , x0 , x1 , . . ., where x1 = 1/4.
Proof. Let x∗ ∈ (a, b) be an arbitrary fixed point of f , and let xk ∈ (a, b).
According to the mean value theorem, there exists ck between xk and x∗ in
(a, b) such that f (xk ) − f (x∗ ) = f (ck )(xk − x∗ ), therefore
Hence,
Example 4.5 Assume that John from Example 4.1 can make the monthly
payment of $300, and we want to find an interest rate r which would yield
$1,000,000 in 30 years. We will use the annuity-due equation given in (4.4):
p r n
1+ − 1 − A = 0. (4.9)
r/12 12
Rearrange the annuity-due equation in the following way:
r n Ar
1+ −1− = 0, (4.10)
12 12p
so,
1/n
Ar
r = 12 +1 − 12.
12p
92 Numerical Methods and Optimization: An Introduction
TABLE 4.1: Fixed point iterations for finding the interest rate with two
different choices for r0 .
Iteration Approximate
number, k interest rate, rk
0 r0 = 0.1 r0 = 0.2
1 0.112511 0.135264
2 0.116347 0.122372
3 0.117442 0.119091
4 0.117747 0.118203
5 0.117832 0.117958
6 0.117856 0.117891
7 0.117862 0.117872
8 0.117864 0.117867
9 0.117865 0.117865
10 0.117865 0.117865
f (a2 )
f (a1 )
f (a0 )
b3
f (a3 ) b2 b1
a c3 c1 c0 b0
a0 c 2 x∗ b
a1 a3 f (b )
2
a2
f (b3 )
f (b1 )
f (b0 )
1
|x∗ − cn | ≤ (bn − an ).
2
94 Numerical Methods and Optimization: An Introduction
Also,
1 1 1
bn − a n = (bn−1 − an−1 ) = 2 (bn−2 − an−2 ) = . . . = n (b0 − a0 ).
2 2 2
Hence,
1
|x∗ − cn | ≤ (b0 − a0 ), (4.11)
2n+1
and the bisection method converges. Moreover, (4.11) can be used to determine
the number of iterations required to achieve a given precision by solving the
inequality
1
n+1
(b0 − a0 ) < ,
2
which is equivalent to
$ %
b0 − a 0 ln b0 −a 0
5 ln(10)
n> − 1 ≈ 15.6,
ln 2
and the number of iterations guaranteeing the precision is 16.
A pseudo-code for the bisection method is presented in Algorithm 4.1.
We stop if f (ck−1 ) = 0 at some iteration (line 6 of the algorithm), meaning
that the algorithm found the exact root of f , or when the search interval is
small enough to guarantee that |cn − x∗ | < (line 14). We could also add
the requirement that |f (x̄)| < δ to the stopping criterion to make sure that
not only our approximate solution is near the real root, but also that the
corresponding function value is very close to 0.
therefore we can say that there exists at least one root within [0, 1]. In fact, we
can show that this interval contains exactly one root of f . Indeed, suppose that
there are at least two roots x̂, x∗ ∈ [0, 1], such that f (x̂) = f (x∗ ) = 0. Then by
the mean value theorem there exists γ between x̂ and x∗ such that f (γ) = 0.
But f (x) = 3x2 +1 ≥ 1 for all x in [0, 1], leading to a contradiction. Therefore,
the assumption that f has more than one root in [0, 1] is not correct.
Using Algorithm 4.1 we obtain:
1. if f (a)f (b) > 0, then there is an even number of roots of f in [a, b];
2. if f (a)f (b) < 0, then there is an odd number of roots of f in [a, b].
and since f (a0 )f (c0 ) < 0 and f (b0 )f (c0 ) < 0, both [−2, 0] and [0, 2] contain
at least one root of f . Hence, we can apply the bisection method for each of
these intervals to find the corresponding roots. For [a1 , b1 ] = [0, 2] we have
c1 = (0 + 2)/2 = 1, f (c1 ) = 0,
and we found another root x∗ = −1. Since f (x) = 6x5 + 16x3 + 2x, we have
f (x) < 0 for all x < 0 and f (x) > 0 for all x > 0, implying that the function
is decreasing on (−∞, 0) and increasing on (0, +∞). Hence, f can have at
most one negative and one positive root, and it has no real roots other than
x∗ = −1 and x̂ = 1.
f (b) − f (a)
y − f (b) = (x − b),
b−a
so for y = 0,
f (b) − f (a) f (b) f (b)
=− = ,
b−a x−b b−x
implying
b−a af (b) − bf (a)
x = b − f (b) = .
f (b) − f (a) f (b) − f (a)
Thus, we have the following expression for ck :
ak f (bk ) − bk f (ak )
ck = .
f (bk ) − f (ak )
f (a2 )
f (a1 )
f (a0 )
b2 b1
a c1 c0 b0
a0 x∗ b
a1 f (b2 )
a2
f (b1 )
f (b0 )
search interval converges to the root x∗ , whereas the other endpoint of the
search interval always remains the same. For example, if we apply the regula-
falsi method to f (x) = 2x3 − 4x2 + 3x on [−1, 1], we observe that the left
endpoint is always −1. At the same time, the right endpoint approaches 0,
which is the root (Exercise 4.4). Thus, the length of the interval is always at
least 1 in this case.
98 Numerical Methods and Optimization: An Introduction
f (a2 )
f (a1 )
f (a0 ) f (a3 )
b3
1
f (a 2 ) b2 b1
2 c1 c0 b0
a0 c2
a1 a3
a2
f (b2 ) f (b1 )
f (b3 )
f (b0 )
This simple modification guarantees that the width of the bracket tends to
zero. Moreover, the modified regula-falsi method often converges faster than
the original regula-falsi method. A pseudo-code for the modified regula-falsi
method is given in Algorithm 4.3.
Example 4.8 Let f (x) = x3 + x − 1. We use the modified regula-falsi method
to compute an approximate root of f on [0, 1].
We have a0 = 0, b0 = 1, f (a0 ) = −1, f (b0 ) = 1, and f (a0 )f (b0 ) < 0. We
compute
a0 f (b0 ) − b0 f (a0 ) 1
c0 = = = 0.5, f (c0 ) = −0.375.
f (b0 ) − f (a0 ) 2
Solving Equations 99
f (x0 )
f (x1 )
f (x2 )
x∗ x2 x1 x0
about xk :
f (x) ≈ f (xk ) + f (xk )(x − xk ).
Instead of solving f (x) = 0, we solve the linear equation
f (xk )
xk+1 = xk − .
f (xk )
f (xk−1 )
xk = xk−1 − , k ≥ 1. (4.13)
f (xk−1 )
Figure 4.6 illustrates the steps of Newton’s method geometrically. For the
function f in this illustration, the method quickly converges to the root x∗ of
Solving Equations 101
f (x0 )
f (x1 )
f (x2 ) f (x3 )
x∗ x0 x1 x2 x3
f (x0 )
x1 x∗
x0
f (x1 )
f . However, as can be seen from examples in Figures 4.7 and 4.8, sometimes
Newton’s method fails to converge to a root.
A pseudo-code of Newton’s method is presented in Algorithm 4.4. Besides
terminating when we reach a point xk with |f (xk )| < or when the step
size becomes very small (|xk − xk−1 | < δ), we included additional stopping
criteria, such as allowing no more than N iterations and stopping whenever
we encounter a point xk with f (xk ) = 0. This makes sure that the algorithm
always terminates, however, as illustrated in Figures 4.7 and 4.8, it may still
produce an erroneous output. On the other hand, if the method does converge
to a root, it typically has a very good speed of convergence.
Denote by
r n Ar
f (r) = p 1+ −1 − ,
12 12
then
pn r n−1 A
f (r) = 1+ − ,
12 12 12
and an iteration of Newton’s method is
$$ %n %
12p 1 + rk−1 − 1 − Ark−1
rk = rk−1 − $
12
%n−1 , k ≥ 1. (4.15)
pn 1 + rk−1
12 −A
Like in Example 4.5, assume that the monthly payment is $300, and we want
to find an interest rate r which would yield $1,000,000 in 30 years. We have
p = 300, A = 1, 000, 000, and n = 12 · 30 = 360. We also need to define
the starting point r0 . Table 4.2 contains the results of applying 7 iterations of
Newton’s method with two different initial guesses: r0 = 0.1 and r0 = 0.2. In
both cases the method converges to the same solution r ≈ 0.117865, or 11.79%.
Example 4.10 We can use Newton’s method for the equation
f (x) = x2 − α = 0 (4.16)
√
to approximate the square root x = α of a positive number α. Newton’s step
for the above equation is given by
f (xk−1 )
xk = xk−1 −
f (xk−1 )
x2 − α
= xk−1 − k−1
2xk−1
2xk−1 − x2k−1 + α
2
=
2xk−1
1 α
= xk−1 + .
2 xk−1
Solving Equations 103
TABLE 4.2: Newton’s iterations for finding the interest rate with two dif-
ferent choices of r0 .
Iteration Approximate
number, k interest rate, rk
0 r0 = 0.1 r0 = 0.2
1 0.128616 0.170376
2 0.119798 0.145308
3 0.117938 0.127727
4 0.117865 0.119516
5 0.117865 0.117919
6 0.117865 0.117865
7 0.117865 0.117865
√
For example, to find 7, we use f (x) = x2 − 7 = 0 and the iteration
1 7
xk = xk−1 + .
2 xk−1
xpk−1 − α
xk = xk−1 −
pxp−1
k−1
1 α
= (p − 1)xk−1 + , k ≥ 1.
p xp−1
k−1
f (xk )
xk+1 = xk − ,
f (xk )
104 Numerical Methods and Optimization: An Introduction
f (x)
φ(x) = x − .
f (x)
therefore
f (ξk )f (ξk )
xk+1 − x∗ = (xk − x∗ ). (4.17)
(f (ξk ))2
for some νk lying between ξk and x∗ . Recall that ξk is located between xk and
x∗ , thus
|ξk − x∗ | ≤ |xk − x∗ |
|f (ξk )f (νk )|
|xk+1 − x∗ | ≤ |xk − x∗ |2 . (4.20)
(f (ξk ))2
|f (ξ)f (ν)|
≤C
(f (ξ))2
|xk+1 − x∗ | ≤ C|xk − x∗ |2 .
f (x0 )
f (x1 )
f (x2 )
f (x3 )
x∗ x3 x2 x1 x0
xk − xk−1
xk+1 = xk − f (xk ) , k ≥ 1. (4.21)
f (xk ) − f (xk−1 )
To find a root (x∗ , y ∗ ) ∈ (a, b) × (c, d), we take some [x0 , y0 ]T ∈ (a, b) × (c, d)
and then recursively calculate (xk+1 , yk+1 ) by the formula
xk+1 = f1 (xk , yk )
(4.23)
yk+1 = f2 (xk , yk )
for k ≥ 0. In the above, we assume that [f1 (xk , yk ), f2 (xk , yk )]T ∈ (a, b)×(c, d)
for all [xk , yk ]T , so the next vector [xk+1 , yk+1 ]T in the sequence is in the
domain of fi (x, y), i = 1, 2.
∗ ∗ T
Similar to the
one-dimensional case, we call
∗[x , y ] a fixed point of a
f1 (x, y) x
function f (x, y) = if f (x∗ , y ∗ ) = , that is, f1 (x∗ , y ∗ ) = x∗
f2 (x, y) y∗
and f2 (x∗ , y ∗ ) = y ∗ . Obviously, if [x∗ , y ∗ ]T is a fixed point of f (x, y) then
it is a root of the system (4.22). The iteration (4.23) is called a fixed point
iteration.
Assume that we are given [xk , yk ]T ∈ IR2 . Similar to the one-dimensional case,
we use the Taylor’s approximation of F (x, y) about [xk , yk ]T ,
( ∂F1 (xk ,yk ) ∂F1 (xk ,yk ) )
F1 (x, y) F1 (xk , yk ) x − xk
≈ + ∂F2 (x ∂x ∂y
,
F2 (x, y) F2 (xk , yk ) k ,yk ) ∂F2 (xk ,yk ) y − yk
∂x ∂y
with respect to x and y, and denoting the solution by [xk+1 , yk+1 ]T , we obtain
( ∂F1 (xk ,yk ) ∂F1 (xk ,yk ) )−1
xk+1 xk F1 (xk , yk )
= − ∂F2 (xk ,yk ) ∂F2 (xk ,yk )
∂x ∂y
.
yk+1 yk F2 (xk , yk )
∂x ∂y
108 Numerical Methods and Optimization: An Introduction
(x − 1)2 + (y − 1)2 − 1 = 0
x+y−2 = 0.
We obtain
x1 F1 (0, 2)
0 1/4
= − JF−1 (0, 2)
= ;
y1 F2 (0, 2)
2 7/4
x2 1/4 F1 (1/4, 7/4) 7/24 0.2917
= −JF−1 (1/4, 7/4) = ≈ .
y2 7/4 F2 (1/4, 7/4) 41/24 1.7083
Note that geometrically the first equation is described by a circle, and the
second equation is given by a line (see Figure 4.12). The roots are at points
√
√
1 − 1/√2 0.2929 1 + 1/√2 1.7071
x̂ = ≈ and x̃ = ≈ ,
1 + 1/ 2 1.7071 1 − 1/ 2 0.2929
which are located at the intersections of the line and the circle. The steps
of Newton’s method in this example correspond to movement from the point
[0, 2]T along the line given by the second equation toward the root x̂.
Exercises
4.1. Let f (x) = 5 − x6 .
Solving Equations 109
y
[x0 , y0 ]T [x1 , y1 ]T
2
x̂
x̃
1 x
(a) Prove that f has a unique root x∗ in the interval [1, 2].
(b) Apply the bisection method twice.
(c) How many iterations of the bisection method are required to guar-
antee an approximation of the root within 10−10 ? (Note: In 1225
Leonardo of Pisa computed the root x∗ ≈ 1.368808107. This was a
remarkable result for his time.)
4.4. Plot f (x) = 2x3 − 4x2 + 3x and illustrate three steps of the regula-falsi
method applied to f on the interval [−1, 1] graphically. What do you
observe?
(c) Use Newton’s method twice using your answer in (b) as the starting
point.
√
4.12. Approximate 3 2 as follows.
(a) Use the bisection method twice for f (x) = x3 − 2 in the interval
[1, 2].
(b) Use Newton’s method twice starting with the point obtained using
bisection in (a).
√
4.13. Find an approximation of 3 9 by finding the root of the function f (x) =
x3 − 9 using two steps of the modified regula-falsi method. Choose an
appropriate initial interval with integer endpoints.
4.14. Use three iterations of Newton’s method with the initial guess x0 = 2
to approximate
√
(a) 3;
√
(b) 5;
(c) 32/5 .
(x − 1)2 + (y − 1)2 − 1 = 0
x+y−1 = 0.
(a) Draw the sets of points on the plane that satisfy each equation,
and indicate the solutions of the system.
(b) Solve this system exactly.
(c) Apply Newton’s method twice with [x0 , y0 ]T = [1/2, 1/2]T . Illus-
trate the corresponding steps geometrically.
112 Numerical Methods and Optimization: An Introduction
x2 + y 2 − 9 = 0
x+y−1 = 0.
Apply Newton’s method twice with starting point [1, 0]T . Show the exact
solutions and the steps of Newton’s method graphically.
4.20. Use Newton’s method twice with initial guess [x0 , y0 ]T = [1/2, 0]T to
solve the nonlinear system
x2 − x − y = 0
x+y−2 = 0.
x4 + y 4 − 3 = 0
x − 3xy + 1
3 2
= 0.
Apply Newton’s method twice with the starting point [1, 1]T .
Chapter 5
Polynomial Interpolation
x0 x1 ··· xn
y0 y1 ··· yn
Given such a table, our goal is to approximate f (x) with a function, say
a polynomial p(x), such that p(xi ) = f (xi ), i = 0, 1, . . . , n. Then for any
x ∈ [a, b] we can approximate the value f (x) with p(x): f (x) ≈ p(x). If
x0 < x < xn , the approximation p(x) is called an interpolated value, otherwise
it is an extrapolated value.
113
114 Numerical Methods and Optimization: An Introduction
y
1
− π2 π
2
0 x
Example 5.2 Figure 5.1 shows two approximations to f (x) = cos(x) over
2
[−π/2, π/2]: the Taylor polynomial p(x) = 1 − x2 of degree 2 (computed as in
Example 5.1), and the quadratic polynomial q(x) = 1 − π42 x2 passing through
points given by the table
−π/2 0 π/2
0 1 0
Note that |f (x) − p(x)| increases significantly when x moves away from the
origin. At the same time, the polynomial q(x) passing through the three equidis-
tant points in [−π/2, π/2] provides a better approximation of f (x).
p(x) = a0 + a1 x + a2 x2 + · · · + an xn .
p(x) = a0 + a1 (x − c1 ) + a2 (x − c1 )(x − c2 ) + · · · + an (x − c1 ) · · · (x − cn )
n
k
= a0 + ak (x − ci ).
k=1 i=1
Example 5.3 Find p(5) for p(x) = 1 + 2(x − 1) + 3(x − 1)(x − 2) + 4(x −
1)(x − 2)(x − 3) + 5(x − 1)(x − 2)(x − 3)(x − 4).
116 Numerical Methods and Optimization: An Introduction
We have a0 = 1, a1 = 2, a2 = 3, a3 = 4, a4 = 5; c1 = 1, c2 = 2, c3 = 3, c4 =
4, and x = 5. Applying Algorithm 5.1 we obtain:
i = 4 : a4 = 5
i = 3 : a3 = 4 + (5 − 4)5 = 9
i = 2 : a2 = 3 + (5 − 3)9 = 21
i = 1 : a1 = 2 + (5 − 2)21 = 65
i = 0 : a0 = 1 + (5 − 1)65 = 261.
n n
(x − xi )
p(x) = y0 l0 (x) + y1 l1 (x) + · · · + yn ln (x) = yj . (5.1)
j=0 i=0
(x j − xi )
i=j
Polynomial Interpolation 117
Now, assume that there are two polynomials of degree ≤ n, p(x) and q(x),
such that p(xi ) = q(xi ) = yi , i = 0, . . . , n. Then r(x) = p(x) − q(x) is a
polynomial of degree ≤ n, which has n + 1 distinct roots x0 , x1 , . . . , xn . We
obtain a contradiction with the fundamental theorem of algebra. Thus, we
proved the following theorem.
n n
(x − xi )
p(x) = y0 l0 (x) + y1 l1 (x) + · · · + yn ln (x) = yj .
j=0 i=0
(x j − xi )
i=j
Example 5.4 Use the Lagrange method to find the second-degree polynomial
p(x) interpolating the data
x −1 0 1
.
y 3 5 2
We have:
(x − 0)(x − 1) x(x − 1)
l0 (x) = = ,
(−1 − 0)(−1 − 1) 2
(x + 1)(x − 1)
l1 (x) = = 1 − x2 ,
(0 + 1)(0 − 1)
(x + 1)(x − 0) x(x + 1)
l2 (x) = = .
(1 + 1)(1 − 0) 2
2
x(x − 1) x(x + 1)
p(x) = yj lj (x) = 3· + 5 · (1 − x2 ) + 2 ·
j=0
2 2
5 1
= − x2 − x + 5.
2 2
118 Numerical Methods and Optimization: An Introduction
a0 + a1 x0 + a2 x20 + · · · + an xn0 = y0
a0 + a1 x1 + a2 x21 + · · · + an xn1 = y1
..
.
a0 + a1 xn + a2 x2n + · · · + an xnn = yn .
x −1 0 1
y 3 5 2
n
j−1
n
pn+1 (x) = aj (x − xi ) + an+1 (x − xi ) = q(x) + r(x),
j=0 i=0 i=0
q(x) r(x)
where
n
j−1
q(x) = aj (x − xi ) = a0 + a1 (x − x0 ) + . . . + an (x − x0 ) · . . . · (x − xn−1 )
j=0 i=0
and
n
r(x) = an+1 (x − xi ) = an+1 (x − x0 ) · . . . · (x − xn ).
i=0
We can show that q(x) = pk (x). Indeed, by definition of pn (x) and pn+1 (x),
n
pn+1 (x) = pn (x) + an+1 (x − xi ).
i=0
In view of the fact that pn+1 (xn+1 ) = yn+1 , this implies that
n
yn+1 = pn+1 (xn+1 ) = pn (xn+1 ) + an+1 (xn+1 − xi ) ⇒
i=0
y − pn (xn+1 )
an+1 = *n+1
n .
i=0 (xn+1 − xi )
Example 5.6 Assume that a new data point (x3 , y3 ) = (2, 4) is added to the
data in Example 5.4:
x −1 0 1 2
y 3 5 2 4
120 Numerical Methods and Optimization: An Introduction
From Example 5.4 we know that the quadratic interpolating polynomial for the
first three data points is given by p2 (x) = − 52 x2 − 12 x + 5. We use Newton’s
method to find the 3rd degree interpolating polynomial for the given data. We
have:
p3 (x) = p2 (x) + a3 (x + 1)(x)(x − 1), p2 (2) = −6, and p3 (2) = 4.
4+6
Hence, a3 = 3·2·1 = 53 , and
5 1 5 5 5 13
p3 (x) = − x2 − x + 5 + (x + 1)(x)(x − 1) = x3 − x2 − x + 5.
2 2 3 3 2 6
Theorem 5.2 Let f (x) ∈ C (n+1) ([x0 , xn ]). Then there exists ξ ∈
[x0 , xn ] such that for all x ∈ [x0 , xn ], the error
f (n+1) (ξ)
n
en (x) = f (x) − pn (x) = (x − xi ). (5.2)
(n + 1)! i=0
Note that ξ depends on x and its value is not available explicitly. However,
even if f (n+1) (ξ) is not known, it may be possible to obtain an upper bound
cn such that
|f (n+1) (x)| ≤ cn ∀x ∈ [x0 , xn ].
Then
cn n
|en (x)| ≤ |x − xi | ∀x ∈ [x0 , xn ]. (5.3)
(n + 1)! i=0
π3
|e2 (x)| ≤ ≈ 0.2422365.
128
√
The actual error of interpolation is e2 (π/4) = 1/ 2 − 3/4 ≈ −0.0428932.
Note that the upper bound on the error in (5.3) depends on the choice of
the interpolation nodes x1 , . . . , xn−1 . Our next goal is to try to select these
nodes in such a way that the largest possible value of the upper bound in (5.3)
is as small as possible.
Without loss of generality, we can assume that [x0 , xn ] = [−1, 1]. Indeed,
consider an arbitrary interval [x0 , xn ] within the domain of f (x). Denoting by
x(xn − x0 ) + x0 + xn
F (x) = f ,
2
we transform the function f (x) defined over [x0 , xn ] into the function F (x)
with the domain [−1, 1].
Denote by
n
Rn+1 (x) = (x − xk ) = (x − x0 )(x − x1 ) · . . . · (x − xn ).
k=0
T0 (x) = 1, T1 (x) = x,
and for n ≥ 2, Tn (x) can be found recursively from the following relation:
Proof. We have
is a polynomial of degree that is equal to the degree of 2xTn (x), which is n+1.
Therefore, by induction the statement is correct for any integer n ≥ 0.
Table 5.1 shows the first six Chebyshev polynomials.
T0 (x) = 1
T1 (x) = x
T2 (x) = 2x2 − 1
T3 (x) = 4x3 − 3x
T4 (x) = 8x4 − 8x2 + 1
T5 (x) = 16x5 − 20x3 + 5x
x
-1 0 1
1
FIGURE 5.2: Polynomial approximations to y = f (x) = 1+10x 2 over [−1, 1]
(shown with a solid line) based on 11 equally spaced nodes (dotted) and based
on 11 Chebyshev nodes (dashed).
4. Tn (x) is an even function for n = 2k, and an odd function for n = 2k +1,
that is,
Theorem 5.4 implies that among all choices of nodes xk ∈ [−1, 1], k =
0, 1, . . . , n, the maximum deviation of Rn+1 (x) from zero, max {|Rn+1 (x)|},
−1≤x≤1
is minimized if xk , k = 0, 1, . . . , n are chosen as the roots of Tn+1 (x), given
by (5.7).
1
Example 5.8 Figure 5.2 shows interpolating polynomials for f (x) = 1+10x 2
over [−1, 1] based on two distinct sets of nodes. One is based on 11 equally
spaced nodes, whereas the other one is based on the same number of Chebyshev
nodes. As can be seen from the figure, the polynomial based on Chebyshev nodes
provides a much better overall approximation of f (x) over [−1, 1].
Exercises
5.1. Use Algorithm 5.1 to evaluate p(3), where
5.2. Consider the following polynomial given in the shifted power form:
p(x) = 1 + (x − 5555.5)2 . The power form representation of p(x) is
p(x) = 30863581.25 − 11.111x + x2 . For each of the two representations,
evaluate p(5555) using 6-digit floating-point arithmetic.
5.3. Find the quadratic polynomial p2 (x) that interpolates the data
(i) x 1 2 4 (ii) x −1 2 5
y −1 −1 2 y 1 0 −2
(iii) x −2 0 2 (iv) x 0 3 5
y 9 7 9 y −1 8 −4
5.4. Add the data point (x3 , y3 ) = (6, 1) to each table in Exercise 5.3.
5.6. Find the cubic interpolating polynomial p3 (x) for f (x) = cos x using
x0 = 0.3, x1 = 0.4, x2 = 0.5, and x3 = 0.6. For x = 0.44,
(a) compute e3 (x) = f (x) − p3 (x);
(b) estimate the error e3 (x) using the bound in Equation (5.3) at
page 120.
5.7. Find the quartic interpolating polynomial p4 (x) for f (x) = e3x using
x0 = −1, x1 = −0.5, x2 = 0, x3 = 0.5, and x4 = 1. For x = 0.8,
(a) compute e4 (x) = f (x) − p4 (x);
(b) estimate the error e4 (x) using the bound in Equation (5.3) at
page 120.
This page intentionally left blank
Chapter 6
Numerical Integration
In this chapter we will deal with the problem of integration of a function over
an interval,
+ b
f (x)dx,
a
+
2.02 +
2.02
1 −(x − 2)2
P (1.985 ≤ ξ ≤ 2.02) = p(x)dx = √ exp dx,
0.01 2π 2 · 0.012
1.985 1.985
which is equal to the area enclosed between the x-axis and the plot of p(x),
where x ∈ [1.985, 2.02], as shown in Figure 6.1. This integral cannot be com-
puted analytically, and numerical methods are required to approximate its
value.
n
pn (x) = a0 l0 (x) + a1 l1 (x) + · · · + an ln (x) = ai li (x),
i=0
127
128 Numerical Methods and Optimization: An Introduction
← p(x)
,
2.02
P (1.985 ≤ ξ ≤ 2.02) = p(x)dx
1.985
1.985 2 2.02 x
where
n
(x − xi )
lk (x) = , k = 0, 1, . . . , n.
i=0
(x k − xi )
i=k
Consider the interpolating polynomial of f (x) in the form (6.1). Since the
operation of integration is linear, we have
+ b + b n
n + b
pn (x)dx = f (xi )li (x) dx = f (xi ) li (x)dx, (6.2)
a a i=0 i=0 a
,b
where l (x)dx
a i
does not depend on f for i = 0, . . . , n. Thus, for a function
,b
f : [a, b] → IR the integral a f (x)dx is approximated by
n
Qn (f ) = Ai f (xi ), (6.3)
i=0
,b
where Ai = a li (x)dx. Qn (f ) is called the quadrature formula or numerical
integration formula.
Taking n = 1 and n = 2 in (6.2) we obtain the trapezoidal and Simpson’s
rules, respectively, which are discussed next.
x)
p 1(
f (x) →
f (a)
a b x
Trapezoidal Rule:
+ b
b−a
f (x)dx ≈ (f (a) + f (b)). (6.4)
a 2
Note that (6.4) is just the area of the trapezoid defined by the points
(a, 0), (a, f (a)), (b, f (b)), and (b, 0), as shown in Figure 6.2.
Example
,1 6.2 Using the trapezoidal rule to approximate the integral
2
0
exp(x ), we obtain:
+ 1
1 1
exp(x2 )dx ≈ (exp(0) + exp(1)) = (1 + e) ≈ 1.85914.
0 2 2
sin x
For f (x) = x and [a, b] = [1, 5] the trapezoidal rule gives
+
5
sin x 5−1 sin 1 sin 5 sin 5
dx ≈ + = 2 sin 1 + ≈ 1.29937.
1 x 2 1 5 5
Numerical Integration 131
y
f (b)
p2 (x) →
f ( a+b
2 )
f (x) →
f (a)
a a+b b x
2
Simpson’s Rule:
+
b
b−a a+b
f (x)dx ≈ f (a) + 4f + f (b) . (6.6)
a 6 2
Example 6.3 For the same integrals as in Example 6.2, Simpson’s rule gives
+ 1
1
exp(x2 )dx ≈ (exp(0) + 4 exp(1/4) + exp(1)) ≈ 1.47573,
0 6
+
5
sin x 5−1 sin 3 sin 5
dx ≈ sin 1 + 4 + ≈ 0.55856.
1 x 6 3 5
Clearly m ≥ n when n + 1 points are used, since in this case pn (x) = f (x)
for any polynomial f (x) of degree at most n. For example, for the trapezoidal
rule we have + b
f (x) = 1 : 1dx = (b − a) = Q1 (f );
a
+ b
b2 − a 2 b−a
f (x) = x : xdx = = (b + a) = Q1 (f ).
a 2 2
To find the precision of a quadrature, we use it to compute the integrals
,b k
a
x dx for k ≥ n+1 until we encounter k for which the error of approximation
is nonzero. Using the trapezoidal rule for f (x) = x2 , we obtain:
+ b
b3 − a 3
x2 dx = ,
a 3
Numerical Integration 133
b−a 2 1
(a + b2 ) = (b3 + a2 b − ab2 − a3 ),
Q1 (f ) =
2 2
and the error of approximation is
+ b
1 3 1 1
x2 dx − Q1 (f ) = (b − a3 ) − (b3 + a2 b − ab2 − a3 ) = − (b − a)3 ,
a 3 2 6
,b
thus a f (x)dx = Q1 (f ) for f (x) = x2 whenever a = b. Hence the trapezoidal
rule has the precision 1.
Since n = 2 for Simpson’s rule, it is precise for all polynomials of degree
up to 2. For f (x) = x3 we have
+ b
b4 − a 4
x3 dx = ,
a 4
b−a$ 3 % b4 − a 4
Q2 (f ) = a + 4((a + b)/2)3 + b3 = ,
6 4
and Simpson’s rule is exact. For f (x) = x4 , we can use [a, b] = [0, 1] to show
that Simpson’s rule does not give the exact answer. Indeed,
+ 1
1 5 1
x4 dx = = = (0 + 4(1/2)4 + 1) = Q2 (f ).
0 5 24 6
f (ξ)
e1 (x) = f (x) − p1 (x) = (x − a)(x − b).
2
Therefore, the error of approximation of the trapezoidal rule is
+ +
b
f (ξ) b
f (ξ)(b − a)3
eT = e1 (x)dx = (x − a)(x − b)dx = − .
a 2 a 12
For Simpson’s rule, it can be shown that there exists ξ ∈ [a, b] such that its
error of approximation is
5
f (4) (ξ) b−a
eS = − .
90 2
134 Numerical Methods and Optimization: An Introduction
In summary, we have
f (ξ)
eT = − (b − a)3 for some ξ ∈ [a, b] (6.7)
12
for the trapezoidal rule, and
5
f (4) (ξ) b−a
eS = − for some ξ ∈ [a, b] (6.8)
90 2
we can apply the rules to the integrals defined on the N smaller intervals.
b−a
h= , xi = a + ih, i = 0, . . . , N
N
(see Figure 6.4). Therefore,
for some ξi ∈ [xi , xi+1 ]. Hence, we obtain the following formulas for the com-
posite trapezoidal rule:
+ b
f (x)dx ≈ TN (f ),
a
Numerical Integration 135
y
f (x4 )
f (x3 )
f (x2 )
f (x1 )
f (x0 )
a = x0 x1 x2 x3 x4 = b x
where
N −1
N −1
h h
TN (f ) = (f (xi ) + f (xi+1 )) = h f (xi ) + (f (x0 ) + f (xN )) ,
i=0
2 i=1
2
b−a
h= , xi = a + ih, i = 0, . . . , N,
N
with the error
N −1
f (ξi )h3
T =−
eN for some ξi ∈ [xi , xi+1 ], i = 0, . . . , N − 1.
i=0
12
where
N −1
h xi + xi+1
SN (f ) = f (xi ) + 4f + f (xi+1 ) ,
i=0
6 2
b−a
h= , xi = a + ih, i = 0, . . . , N,
N
with the error
N −1 5
f (4) (ξi ) h
eN
S =− for some ξi ∈ [xi , xi+1 ], i = 0, . . . , N − 1.
i=0
90 2
Note that the precision (as described in Definition 6.1) of the composite
rules does not change with increasing N , i.e., the precision of the composite
trapezoidal rule is 1, and the precision of the composite Simpson’s rule is 3.
However, since h = b−aN , we have
lim eN N
T = lim eS = 0,
N →∞ N →∞
and + b
lim TN (f ) = lim SN (f ) = f (x)dx.
N →∞ N →∞ a
using the composite trapezoidal rule and the composite Simpson’s rule with
N = 3.
Applying the composite trapezoidal rule, we obtain
+ 4 3 +
i+1
1 1
dx = dx
1 x i=1 i x
3
1 1 1
≈ +
i=1
2 i i+1
1 1 1 1 1 1
= 1+ + + + +
2 2 2 3 3 4
1 1 1 1 35
= + + 1+ = ≈ 1.3863.
2 3 2 4 24
,4 1
Note, that the exact value of the integral is 1 x
dx = ln 4, therefore the
absolute error is 1.3863 − ln 4 ≈ 0.0720.
Numerical Integration 137
Exercises
,1
6.1. Estimate the integral x5 cos xdx using
−1
(a) Compute the integral by the trapezoidal rule and the composite
trapezoidal rule with N = 2 and N = 4, respectively. Compute the
absolute error of approximation.
(b) Compute the integral by Simpson’s rule and the composite Simp-
son’s rule with N = 2 and N = 4, respectively. Compute the abso-
lute error of approximation.
(c) Summarize the results you obtained in (a) and (b) in a table. Which
method is more accurate?
,
2001
1
6.5. Consider the integral x+11 dx. Use the composite trapezoidal rule to
1
2000
1
estimate n+11 .
n=1
N
6.6. Find N such that 1
n ≈ 2015 using the composite trapezoidal rule.
n=1
This page intentionally left blank
Chapter 7
Numerical Solution of Differential
Equations
141
142 Numerical Methods and Optimization: An Introduction
y0 (t) = y(t0 );
,t (7.8)
yk+1 (t) = y(t0 ) + f (u, yk (u))du, k ≥ 0.
t0
+t +t
y1 (t) = y(0) + 3u y(0) du = −1 +
2 2
3u2 du = t3 − 1;
0 0
+t +t
1 9
y2 (t) = −1 + 3u y1 (u) du = −1 +
2 2
3u2 (u3 − 1)2 du = t − t6 + t3 − 1.
3
0 0
Example 7.5 We solve the following IVP using the Taylor series and
Pickard’s method:
y = y, y(0) = 1.
t2 t3 tk
y(t) = 1 + t + + + ··· + + · · · = exp(t).
2! 3! k!
y0 (t) = 1;
,t
y1 (t) = 1 + 0 y0 (u)du = 1 + t;
,t ,t 2
y2 (t) = 1 + 0 y1 (u)du = 1 + 0 (1 + u)du = 1 + t + t2 ;
,t ,t 2
t2 t3
y3 (t) = 1 + 0 y2 (u)du = 1 + 0 1 + u + u2 du = 1 + t + 2 + 3! ;
..
.
,t ,t u2 u3 uk−1
yk (t) = 1+ 0
yk−1 (u)du = 1 + 0
1+u+ 2! + 3! + ··· + (k−1)! du
2 3
uk−1 k
= 1+u+ u
2! + u
3! + ··· + (k−1)! + u
k! .
As one can see, in this example Pickard’s method also generates the Taylor
series for y(t) = exp(t), which is the exact solution of the given IVP.
Numerical Solution of Differential Equations 145
y (ct )(t − t0 )2
y(t) = y(t0 ) + y (t0 )(t − t0 ) + (7.10)
2
for some ct ∈ [t0 , t], where t ∈ [t0 , b]. Note that y (t0 ) can be replaced by
f (t0 , y(t0 )). Then for t = t1 , where t1 = t0 + h, h > 0, we have
y (ct1 )h2
y(t1 ) = y(t0 ) + hf (t0 , y(t0 )) + . (7.11)
2
If h is chosen small enough, then the term involving h2 is close to 0 and thus
can be neglected, yielding the following formula:
In the last equation we obtained the formula of a single step of the so-called
Euler’s method.
Figure 7.1 illustrates Euler’s method geometrically: starting from the point
(t0 , y0 ), we obtain an approximation y1 to the solution y(t) in point t1 by
moving along the tangent line to y(t) at t0 until we reach the point (t1 , y1 ).
Suppose that, given the IVP (7.9), we want to find a numerical solution
over interval [a, b], where a ≡ t0 , using Euler’s method. First we divide [a, b]
into n equal subintervals, each of length h = b−an , thus obtaining a set of n + 1
mesh points tk = a + kh, k = 0, 1, . . . , n. The value h is called the step size.
Using Euler’s method we find an approximate solution in the mesh points by
following the scheme described in Algorithm 7.1.
Algorithm 7.1 Euler’s method for solving the IVP y = f (t, y) with y(a) = y0
on the interval [a, b].
1: Input: function f , interval [a, b], y0 = y(a), and the number of steps n
2: Output: (tk , yk ) such that yk ≈ y(tk ), k = 1, . . . , n
3: h = b−a
n , t0 = a
4: for k = 1, . . . , n do
5: tk = tk−1 + h
6: yk = yk−1 + hf (tk−1 , yk−1 )
7: end for
8: return (tk , yk ), k = 1, . . . , n
146 Numerical Methods and Optimization: An Introduction
y
y1
y = y(t)
y(t1 )
y0
t
t0 t1
Example 7.6 Suppose that we have a 30-year 10% coupon bond with yield to
maturity λ0 = 10% and price P0 = 100. We are interested to know the price of
this bond when its yield changes to λ1 = 11%. We can use the price sensitivity
formula mentioned in Example 7.1:
dP
= −P DM , with P (λ0 ) = P0 .
dλ
Let us use Euler’s method to solve the above equation. We have
f (t, y) = t + y,
ti = 0.05 · i, i = 0, 1, 2, . . . .
Numerical Solution of Differential Equations 147
ek = yk − y(tk ) (7.13)
Assume that the value yk of the approximate solution at point tk has been
found, and we want to find a proper value yk+1 of the numerical solution at
the next point tk+1 = tk + h. Then Euler’s method can be generalized in the
following way:
yk+1 = yk + hG(tk , yk , h), (7.16)
148 Numerical Methods and Optimization: An Introduction
y
y3 ⎫
⎬
final global error e3
y2 ⎭ ⎫
y(t3 ) ⎬
global error e2
ŷ2 ⎭
} local error 2
y(t2 ) ⎫ y = y(t)
y1 ⎬
local/global
⎭ error e1 = 1
y(t1 )
y0
t
t0 t1 t2 t3
G(tk , yk , h) = p1 f1 + p2 f2 + . . . + pl fl . (7.17)
In this expression, l is some positive integer called the order of the method,
pi , i = 1, . . . , l are constants, and fi , i = 1, . . . , l are given by
f1 = f (tk , yk ),
f2 = f (tk + α1 h, yk + α1 hf1 ),
f3 = f (tk + α2 h, yk + α2 hf2 ), (7.18)
..
.
fl = f (tk + αl−1 h, yk + αl−1 hfl−1 ).
where
f1 = f (tk , yk ),
(7.20)
f2 = f (tk + α1 h, yk + α1 hf1 ).
Let y(t) be the solution of Equation (7.15), then for the second-order derivative
of y(t) we obtain
d2 y d ∂f ∂f dy ∂f ∂f
= f (t, y(t)) = + = + f. (7.21)
dt2 dt ∂t ∂y dt ∂t ∂y
h2
y(tk + h) = y(tk ) + hy (tk ) + y (tk ) + O(h3 ),
2
and using the fact that y(x) is the solution of (7.15), we obtain:
y(tk + h) − y(tk ) h ∂f ∂f
= f+ + f + O(h2 ). (7.22)
h 2 ∂t ∂y t = tk
y = y(tk )
f2 = f (tk + α1 h, yk + α1 hf1 )
0 1 (7.23)
= f + α1 h ∂f
∂t + α 1 h ∂f
∂y f t = tk + O(h2 ),
y = y(tk )
p1 + p2 = 1,
and
1
p2 α 1 = .
2
1 −1
Therefore, for a fixed α1 , substituting p2 = 2α1 1 and p1 = 2α2α 1
in (7.19) we
obtain a general scheme for the second-order RK methods:
2α1 − 1 1
yk+1 = yk + h f1 + f2 , (7.25)
2α1 2α1
150 Numerical Methods and Optimization: An Introduction
where
f1 = f (tk , yk ),
(7.26)
f2 = f (tk + α1 h, yk + α1 hf1 ).
In general, there are infinitely many values for α1 to choose from, each
yielding a different second-order RK method (although all of them give exactly
the same result if the solution to the IVP is a polynomial of degree ≤ 2). We
mention three of the most popular versions:
• Heun Method with a Single Corrector: α1 = 1;
• The Improved Polygon Method: α1 = 12 ;
• Ralston’s Method: α1 = 34 .
A general scheme of the second-order Runge-Kutta method is summarized in
Algorithm 7.2.
Example 7.8 Consider the logistic model (also called the Verhulst-Pearl
model) for population dynamics. According to this model, the population P (t)
of a certain species as a function of time t satisfies the following equation:
dP P
= cP 1 − ,
dt M
where c is a growth rate coefficient, M is a limiting size for the population,
and both c and M are constants.
Assuming that P (0) = P0 is given, the exact solution to this equation is
M P0
P (t) = .
P0 + (M − P0 ) exp (−ct)
Putting c = 0.1, M = 500, and P (0) = 300, we obtain the following IVP:
dP P
= 0.1P 1 − , P (0) = 300.
dt 500
Numerical Solution of Differential Equations 151
Next we approximate P (1) using one step of the Heun method, the improved
polygon method, and Ralston’s method, and $ compare% absolute errors for each
method. We have h = 1, f (t, P ) = 0.1P 1 − 500 P
, t0 = 0, P0 = 300, and the
exp (−0.1t) , so P (1) ≈ 311.8713948706.
150000
exact solution P (t) = 300+200
Using the Heun method, we obtain
$ %
f1 = f (t0 , P0 ) = 30 1 − 300 500 = 12,
f2 = f (t0 + h, $ P0 + hf1 )% = f (1, 312) = 11.7312,
P1 = P0 + h 12 f1 + 12 f2 = 300 + 0.5(12 + 11.7312) = 311.8656,
f1 = f (t0 , P0 ) = 12,
f2 = f (t0 + 0.5h, P0 + 0.5hf1 ) = f (0.5, 306) = 11.8728,
P1 = P0 + hf2 = 300 + 11.8728 = 311.8728,
f1 = f (t0 , P0 ) = 12,
f2 = f (t0 + 0.75h,
$ P0 +%0.75hf1 ) = f (0.75, 309) = 11.8038,
P1 = P0 + h 13 f1 + 23 f2 = 300 + 4 + 7.8692 = 311.8692,
1. x (t) = 1
10 exp(t) − 10
1
t exp(t) = 3x(t) − y(t) for all t;
y (t) = 3
10 exp(t) − 5 t exp(t) = 4x(t) − y(t).
1
1 1
2. x(0) = 5 = 0.2; y(0) = 2 = 0.5.
Algorithm 7.4 Euler’s method for the system (7.27) on the interval [a, b].
1: Input: f1 , f2 , [a, b], x0 = x(a), y0 = y(a), n
2: Output: (tk , xk , yk ) such that xk ≈ x(tk ), yk ≈ y(tk ), k = 1, . . . , n
3: h = b−a
n , t0 = a
4: for k = 1, . . . , n do
5: tk = tk−1 + h
6: xk = xk−1 + hf1 (tk−1 , xk−1 , yk−1 )
7: yk = yk−1 + hf2 (tk−1 , xk−1 , yk−1 )
8: end for
9: return (tk , xk , yk ), k = 1, . . . , n
Algorithm 7.5 Runge-Kutta method for the system (7.27) on [a, b].
1: Input: f1 , f2 , [a, b], x0 = x(a), y0 = y(a), n
2: Output: (tk , xk , yk ) such that xk ≈ x(tk ), yk ≈ y(tk ), k = 1, . . . , n
3: h = b−a
n , t0 = a
4: for k = 1, . . . , n do
5: tk = tk−1 + h
6: f11 = f1 (tk−1 , xk−1 , yk−1 )
7: f21 = f2 (tk−1 , xk−1 , yk−1 )
8: f12 = f1 (tk−1 + 0.5h, xk−1 + 0.5hf11 , yk−1 + 0.5hf21 )
9: f22 = f2 (tk−1 + 0.5h, xk−1 + 0.5hf11 , yk−1 + 0.5hf21 )
10: f13 = f1 (tk−1 + 0.5h, xk−1 + 0.5hf12 , yk−1 + 0.5hf22 )
11: f23 = f2 (tk−1 + 0.5h, xk−1 + 0.5hf12 , yk−1 + 0.5hf22 )
12: f14 = f1 (tk−1 + h, xk−1 + hf13 , yk−1 + hf23 )
13: f24 = f2 (tk−1 + h, xk−1 + hf13 , yk−1 + hf23 )
14: xk = xk−1 + h(f11 + 2f12 + 2f13 + f14 )/6
15: yk = yk−1 + h(f21 + 2f22 + 2f23 + f24 )/6
16: end for
17: return (tk , xk , yk ), k = 1, . . . , n
Thus, there will be approximately 741 rabbits and 889 foxes after 1 year.
Table 7.1 shows the result of application of 8 steps of the Runge-Kutta
method to the considered problem.
y = f (t, y, y ), (7.30)
y = z
(7.31)
z = f (t, y, z).
After that, the techniques for systems, such as those discussed in Sec-
tion 7.5, can be applied.
y = (1 − y 2 )y − y
y(0) = 0.2
y (0) = 0.2.
156 Numerical Methods and Optimization: An Introduction
y = z y(0) = 0.2
z = (1 − y 2 )z − y z(0) = 0.2.
Exercises
7.1. Consider the IVP y = −xy, y(1) = 2.
$ %
(a) Verify that y(x) = 2 exp 12 (1 − x2 ) is the solution.
(b) Apply Picard’s method three times.
y − 0.1(1 − y 2 )y + y = 0
y(0) = 0
y (0) = 1.
y = x2 y + y 2 y ,
Introduction to
Optimization
159
This page intentionally left blank
Chapter 8
Basic Concepts
161
162 Numerical Methods and Optimization: An Introduction
d Volume:
πd2 h
4
h
Surface area:
πd2
2 + πdh
• the height of the can must be at least 50% greater than its diameter,
• the can’s height cannot be more than twice its diameter, and
• the volume of the can must be at least 330 ml.
The goal is to design a can that would require the minimum possible amount
of aluminum.
We start formulating an optimization model by introducing the decision
variables, which are the parameters whose values need to be determined in
order to solve the problem. Clearly, in this example the decision variables are
given by the parameters that define a can’s design:
h = the can’s height, in cm
d = the can’s diameter, in cm.
Next we need to state our objective function, i.e., the quantity that we need
to optimize, in mathematical terms, as a function of the decision variables. It
is reasonable to assume that the aluminum sheets used have a fixed thickness.
Then the amount of aluminum used is determined by the surface area of the
cylinder can, which consists of two disks of diameter d (top and bottom) and
a rectangular side of height h and width given by the circumference of the
circle of diameter d, which is πd. Hence, the total surface area is given by:
πd2 πd2
f (h, d) = 2 + πdh = + πdh. (8.1)
4 2
The function f (h, d) is the objective function that we want to minimize.
Finally, we need to specify the constraints, i.e., the conditions that the
design parameters are required to satisfy. The first requirement states that
the height of the can must be at least 50% greater than its diameter, which
can be expressed as
According to the second requirement, the can’s height cannot be more than
twice its diameter, i.e.,
h ≤ 2d ⇔ −2d + h ≤ 0. (8.3)
The third requirement is that the volume of the can must be at least 330 ml:
πd2 h
≥ 330. (8.4)
4
(note that 1 ml = 1 cm3 ).
It is also important to note that the can’s height and diameter must always
be nonnegative, i.e., h, d ≥ 0, however, it is easy to see that this is guaranteed
by the constraints (8.2) and (8.3): if we add these constraints together, we
obtain d ≥ 0, and from (8.2) we have h ≥ 1.5d ≥ 0. Thus, nonnegativity
constraints are redundant and do not need to be included in the model.
In summary, we have the following optimization problem:
πd2
minimize 2 + πdh
subject to 1.5d − h ≤ 0
(8.5)
−2d + h ≤ 0
πd2 h
4 ≥ 330.
Example 8.2 In computational physics, one is interested in locating a set of
(i) (i) (i)
n points {p(i) = [x1 , x2 , x3 ]T : i = 1, . . . , n} on a unit sphere in IR3 with
the goal of minimizing the Lennard-Jones potential
1 2
− 6 ,
d12
ij dij
1≤i≤j≤n
where dij = p(i) − p(j) is the Euclidean distance between pi and pj , i.e.,
(i) (j) (i) (j) (i) (j)
dij = (x1 − x1 )2 + (x2 − x2 )2 + (x3 − x3 )2 .
In this case, we have 3n decision variables describing the coordinates of n
points in IR3 , and putting the sphere’s center in the origin of the coordinate
system in IR3 , the only constraints are
p(i) = 1, i = 1, . . . , n.
Thus, the problem can be formulated as follows:
$ (i) %
minimize p − p(j) −12 − 2p(i) − p(j) −6
1≤i≤j≤n
p(i) ∈ IR3 , i = 1, . . . , n.
(i) (i) (i)
Here p(i) = [x1 , x2 , x3 ]T for i = 1, . . . , n.
164 Numerical Methods and Optimization: An Introduction
are index sets for the equality and inequality constraints, respectively. Note
that the description above covers a wide variety of possible scenarios. For
example, in some problems the decision variables are required to be binary:
xj ∈ {0, 1}. We can easily represent this constraint in the equivalent form
xj (1 − xj ) = 0.
Also, if we are given an inequality constraint in the form g1 (x) ≥ g2 (x), we
can convert it into an equivalent inequality in the form g3 (x) ≤ 0 by letting
g3 (x) = g2 (x) − g1 (x). Obviously,
g1 (x) ≥ g2 (x) ⇔ g2 (x) − g1 (x) ≤ 0.
If the feasible region X is described by a set of equality and inequality con-
straints,
X = {x ∈ IRn : hi (x) = 0, gj (x) ≤ 0, i ∈ E, j ∈ I},
then, obviously, a point x̄ is feasible if and only if it satisfies each of the
equality and inequality constraints defining the feasible region X. For a feasible
x̄ ∈ X, and an inequality constraint gj (x) ≤ 0, we may have a strict inequality,
gj (x̄) < 0 or an equality gj (x̄) = 0 satisfied.
Basic Concepts 165
x2
x̄
X x̃
1
x1
x̂
Example 8.3 Consider the feasible set X defined by two inequality con-
straints,
X = {x ∈ IR2 : x21 + x22 ≤ 1, (x1 − 1)2 + x22 ≤ 1}.
Geometrically, this set is given by the points in the intersection of two disks
corresponding to the constraints, as illustrated in Figure 8.2. In this figure,
none of the constraints is active at x̂; only the first constraint is active at x̃,
and both constraints are active at x̄.
y h
d
x x
ε ε
X
y
d
h
FIGURE 8.3: Examples of interior points (x and x ), boundary points (y
and y ), feasible directions (d and d ), and infeasible directions (h and h ).
minimize f (x)
(8.7)
subject to x ∈ X,
0
f (x) = 1/x f (x) = exp(x) x
f (x) = ln(x)
0 x 0 x
A global minimizer does not always exist, even if the function is bounded
from below. Consider, for example, the function f (x) = exp(x), x ∈ IR. It is
bounded from below, f (x) ≥ 0 ∀x ∈ IR, however, there does not exist a point
x ∈ IR such that exp(x) = 0. Since lim exp(x) = 0, c = 0 is the greatest
x→−∞
lower bound for f (x) = exp(x), which is referred to as infimum of f .
f (x)
x1 x2 x3 x4 x5 x
FIGURE 8.5: A function with two strict local minimizers (x1 and x2 ), one
strict global minimizer (x2 ), and infinitely many local minimizers that are not
strict (all points in the interval [x3 , x5 ]).
Theorem 8.1 (Weierstrass) The problems min f (x) and max f (x),
x∈X x∈X
where X ⊂ IRn is a compact set and f : X → IR is a continuous function,
have global optimal solutions.
In other words, a continuous function attains its minimum and maximum over
a compact set.
Another case where a global minimum is guaranteed to exist is given by
continuous coercive functions.
Basic Concepts 169
0 x
⇓ ⇓ ⇓
x2 x2 x2
1 1 1
x1 x1 x1
-1 1 -1 1 -1 1
-1 -1 -1
FIGURE 8.7: The level set, lower level set, and upper level set of f (x) =
x21 + x22 at the level c = 1.
the level c; and the set {x ∈ IRn : f (x) ≥ c} is called the upper level set
of f at the level c.
Example 8.4 For f (x) = x21 + x22 , the level set, lower level set, and upper
level set at the level c = 1 are given by {x ∈ IR2 : x21 + x22 = 1}, {x ∈ IR2 :
x21 +x22 ≤ 1}, and {x ∈ IR2 : x21 +x22 ≥ 1}, respectively. Geometrically, the level
set is the unit radius circle centered at the origin, the lower level set consists
of the circle and its interior, and the upper level set consists of the circle and
its exterior. See Figure 8.7 for an illustration.
dg(t̄)
= 0. (8.10)
dt
On the other hand, using the chain rule,
dg(t̄) df (x(t̄))
= = ∇f (x(t̄))T x (t̄). (8.11)
dt dt
Basic Concepts 171
y y = f (x1 , x2 )
y=c
x2
x̄ x (t̄)
x = x(t)
x1 ∇f (x̄)
So, if we denote by x̄ = x(t̄), then from the last two equations we obtain
Geometrically, this means that vectors ∇f (x̄) and x (t̄) are orthogonal. Note
that x (t̄) represents the tangent line to x(t) at x̄. Thus, we have the following
property. Let f (x) be a continuously differentiable function, and let x(t) be a
continuously differentiable curve passing through x̄ in the level set of f (x) at
the level c = f (x̄), where x(t̄) = x̄, x (t̄) = 0. Then the gradient of f at x̄ is
orthogonal to the tangent line of x(t) at x̄. This is illustrated in Figure 8.8.
√ √ T
√ √ T 8.5 For f (x) = x1 + x2 and x̃ = [1/ 2, 1/ 2] , ∇f (x̃) =
2 2
Example
[ 2, 2] . The gradient ∇f (x̃) is illustrated in Figure 8.9, which also shows
the level set of f at the level f (x̃) = 1. Clearly, the gradient is orthogonal to
the level set.
Example 8.6 Let f (x) = −x21 −4x22 . Then ∇f (x) = [−2x1 , −8x2 ]T . Consider
two different points,
√
x̃ = [2, 0]T and x̄ = [ 3, 1/2]T .
172 Numerical Methods and Optimization: An Introduction
x2
√
√1 + 2 ∇f (x̃)
2
1
x̃
√1
2
x1
√
-1 √1 1 √1 + 2
2 2
-1
√ √
FIGURE 8.9: Gradient ∇f (x̃) of f (x) = x21 + x22 at x̃ = [1/ 2, 1/ 2]T .
Then
√
∇f (x̃) = [−4, 0]T and ∇f (x̄) = [−2 3, −4]T .
and
∇f (x̃)T x (t̃) = ∇f (x̄)T x (t̄) = 0.
Basic Concepts 173
x x̂
X1 x̃ X2 x̄
x̄
X4
X3
x̃ x̌
For example, geometrically, the convex combination of two points is the line
segment between these two points, and the convex combination of three non-
colinear points is a triangle.
In other words, X is convex if all points located on the line segment connecting
x and y are in X. See Figure 8.10 for examples.
X = {x ∈ IRn : A1 x = b1 , A2 x ≤ b2 },
174 Numerical Methods and Optimization: An Introduction
For example, the quadrangle X2 in Figure 8.10 is a polyhedral set that can
be described by four linear inequalities, each defining a side of the quadrangle.
Example 8.8 For the convex set X1 in Figure 8.10, any point x that lies
on the curve between x̄ and x̃, inclusive, is an extreme point, thus X1 has
infinitely many extreme points. The other convex set in this figure, X2 , has
only 4 extreme points, x̃, x̂, x̄, and x̌.
f (y)
αf (x) + (1 − α)f (y)
f (x)
f (αx + (1 − α)y)
x αx + (1 − α)y y
f (αx + (1 − α)y) < αf (x) + (1 − α)f (y) ∀x, y ∈ X, y = x, α ∈ (0, 1), (8.14)
(0, +∞) such that x = y and any α ∈ (0, 1), the following inequality holds:
1 α 1−α
< + ∀α ∈ (0, 1), x, y ∈ (0, +∞), x = y. (8.15)
αx + (1 − α)y x y
Theorem 8.4 Any local minimizer of a convex problem is its global min-
imizer.
Thus, f (x∗ +α(x̂−x∗ )) < f (x∗ ) for any α ∈ (0, 1), which contradicts the local
optimality of x∗ , since any ε-ball centered at x∗ contains a point x∗ +α(x̂−x∗ )
for some α ∈ (0, 1). Therefore, x̂ ∈ X with f (x̂) < f (x∗ ) cannot exist, and
f (x∗ ) ≤ f (x) for any x ∈ X, meaning that x∗ is a global minimizer of the
considered problem.
Proof. We first show that if f is convex, then (8.16) holds. Consider arbitrary
x, y ∈ X and the direction d = y − x. The directional derivative of f at x in
the direction d is
f (x + α(y − x)) − f (x)
∇f (x)T (y − x) = lim
α→0+ α
f (αy + (1 − α)x) − f (x)
= lim
α→0+ α
αf (y) + (1 − α)f (x) − f (x)
≤ lim
α→0+ α
= f (y) − f (x).
To obtain the inequality above, we used the definition of convexity for f . Thus,
we have proved that if f is convex then (8.16) holds.
To prove the other direction, we assume that (8.16) holds. We need to
show that this yields the convexity of f on X. For an arbitrary α ∈ (0, 1) we
178 Numerical Methods and Optimization: An Introduction
f (y)
f (x) + ∇f (x)T (y − x)
f (x)
f (x)
x y
Multiplying (8.17) by α and (8.18) by (1 − α), and adding the resulting in-
equalities, we obtain
So, f (αx + (1 − α)y) ≤ αf (x) + (1 − α)f (y), and f (x) is convex on X by the
definition of a convex function.
where λmin is the smallest eigenvalue of ∇2 f ((1 − α)x + αy). From (8.22)
and (8.23) we obtain
1
f (y) − f (x) − ∇f (x)T (y − x) ≥ λmin y − x2 ≥ 0.
2
Since x, y ∈ X were chosen arbitrarily, this inequality holds for any x, y ∈ X.
Thus, by the first-order characterization of a convex function, f is convex on
X.
Exercises
8.1. Consider the problem minn f (x), where f : IRn → IR is an arbitrary
x∈IR
continuous function. Prove or disprove each of the following independent
statements concerning this problem.
(a) If the considered problem has a local minimizer that is not strict,
then it has infinitely many local minimizers.
(b) If x∗ is a strict local minimizer and a global minimizer for the
considered problem, then x∗ is a strict global minimizer for the
same problem.
(c) If x∗ is a strict global minimizer of f , then x∗ is a strict local
minimizer of f.
(d) If there exists a constant C such that f (x) ≥ C for all x ∈ IRn ,
then f has at least one local minimizer.
(e) If f is convex, it cannot have local minimizers x̄ and x̂ such that
f (x̂) < f (x̄).
(f) If f has a unique global minimizer and no other local minimizers,
then f is convex.
(g) If f is strictly convex, then any local minimizer is its strict global
minimizer.
respect to each variable (that is, fixing the values of n−1 variables turns
f (x) into a linear function of a single variable), then the considered
problem is equivalent to the problem min n f (x) of minimizing f (x)
x∈[0,1]
over the n-dimensional unit hypercube [0, 1]n .
8.3. In graph theory, a simple, undirected graph is a pair G = (V, E), where
Basic Concepts 181
where e = [1, . . . , 1]T ∈ IRn , and AG = [aij ]n×n with aij = 1 if {i, j} ∈ E
and aij = 0 otherwise. Hint: observe that the objective function of the
above problem is linear with respect to each variable.
x2 −x+2
(a) f (x) = x2 +2x+2 , X = IR;
(b) f (x) = (x1 + 2x2 − 4x3 + 1)2 + (2x1 − x2 + 1)4 + (x1 − 3x2 + 2)6 ,
X = IR3 .
2 2 2
8.5. Does the function f (x) = ex1 +x2 +x3 −x31 −x42 −x63 have a global minimizer
in IR3 ? Why?
8.6. Find all local and global minimizers, if any, for the following problems
graphically.
(a) minimize 2x − x2
subject to 0 ≤ x ≤ 3.
(b) minimize −(x21 + x22 )
subject to x1 ≤ 1.
(c) minimize x1 − (x2 − 2)3 + 1
subject to x1 ≥ 1.
(d) minimize x21 + x22
subject to x21 + 9x22 = 9.
(e) minimize x21 + x22
subject to x21 − x2 ≤ 4
x2 − x1 ≤ 2.
(f) minimize x2 − x1
subject to x21 − x32 = 0.
8.7. Let f : IRn → IR be an arbitrary convex function. Show that for any
constant c the set X = {x ∈ IRn : f (x) ≤ c} is convex.
is also convex.
8.9. Let c ∈ IRn \ {0} and b ∈ IR. Show that the hyperplane
H = {x ∈ IRn : cT x = b}
H+ = {x ∈ IRn : cT x ≥ b},
H− = {x ∈ IRn : cT x ≤ b}.
are convex sets.
8.10. (Jensen’s inequality) Let f : X → IR, where X ⊆ IRn is a convex set.
Prove that f is a convex function if and only if for any x(1) , . . . , x(k) ∈ X
and coefficients α1 , . . . , αk such that
k
αi = 1, αi ≥ 0, i = 1, . . . , m, (8.24)
i=1
(b) If we denote by
3 4
k
k
Δ = Conv{x (1)
,...,x (k)
}= x= αi x (i)
: αi = 1, αi ≥ 0 ,
i=1 i=1
then
max f (x) = max f (x(i) ).
x∈Δ 1≤i≤k
Basic Concepts 183
(a) Sketch epi(f ) for f (x) = x2 , X = IR and for f (x) = x21 + x22 ,
X = IR2 .
(b) Show that f is a convex function if and only if epi(f ) is a convex
set.
8.15. Let f : IRm → IR be a convex function. For an m × n matrix A and a
vector b ∈ IRm , show that g : IRn → IR defined by g(x) = f (Ax + b) is
a convex function.
8.16. Let x = [xj ]nj=1 . Consider the problem
0
m *
n (r)
minimize α0j (xr )σ0j
j=1 r=1
mi *n (r)
subject to αij (xr )σij ≤ 1, i = 1, . . . , m
j=1 r=1
xj > 0, j = 1, . . . , n,
Algorithm 9.1 A naive algorithm for computing the nth power of an integer.
1: Input: a, n
2: Output: an
3: answer = 1
4: for i = 1, . . . , n do
5: answer=answer×a
6: end for
7: return answer
185
186 Numerical Methods and Optimization: An Introduction
Example 9.3 Assume that the input of a problem is given by a single in-
teger. The number of symbols required to represent an integer n in a base-β
arithmetic system is "logβ n#, where β ≥ 2. Hence, the size of the problem is
Θ(log n).
where P is the product of all nonzero entries of A. Since the number of bits
allocated to numbers of the same type in modern computers can be treated as
Complexity Issues 187
Obviously, the size of the problem input depends on the data structures
used to represent the problem input.
Alternatively, the same graph can be represented by its adjacency lists, where
for each vertex v ∈ V we record the set of vertices adjacent to it. In adjacency
lists, there are 2|E| elements, each requiring O(log |V |) bits. Hence, the total
space required is O(|E| log |V |) and O(|E|) space is a reasonable approximation
of the size of a graph.
The next two examples analyze the running time of two classical algorithms
for the sorting problem, which, given n integers asks to sort them in a non-
decreasing order. In other words, given an input list of numbers a1 , a2 , . . . , an ,
we need to output these numbers in a sorted list as1 , as2 , . . . , asn , where as1 ≤
as2 ≤ . . . ≤ asn and {s1 , s2 , . . . , sn } = {1, 2, . . . , n}.
1. Pick an element, called a pivot, from the list. We can pick, e.g., the first
element in the list as the pivot.
188 Numerical Methods and Optimization: An Introduction
2. Reorder the list so that all elements which are less than the pivot come
before the pivot and all elements greater than the pivot come after it
(equal values can go either way). Note that after this partitioning, the
pivot assumes its final position in the sorted list.
3. Recursively sort the sub-list of lesser elements and the sub-list of greater
elements.
n(n − 1)
T (n) = (n − 1) + (n − 2) + (n − 3) + . . . + 1 = = Θ(n2 ).
2
Thus, Quicksort is an Ω(n2 ) algorithm.
Note that the merge operation involves n − 1 comparisons. Let T (n) denote
the run time of Mergesort applied to a list of n numbers. Then
T (n) ≤ 2T (n/2) + n − 1
≤ 2(2T (n/4) + n/2 − 1) + n − 1
= 4T (n/4) + (n − 2) + (n − 1)
···
k−1
≤ 2k T (n/2k ) + (n − 2i )
i=0
= 2k T (n/2k ) + kn − (2k − 1)
T (1) = 0
Note that qi and qj are compared if and only if none of the numbers
qi+1 , . . . , qj−1 appear before both qi and qj in the list a1 , . . . , an . The prob-
ability of this happening is
2
pij = .
j−i+1
Hence,
n
n
n
n
2
A(n) = pij = j−i+1
i=1 j=i+1 i=1 j=i+1
n
2 2 2 2
= 2 + 3 + 4 + . . . + n−i+1
i=1
n $ %
1 1 1 1
< 2 2 + 3 + 4 + ... + n
i=1
n
i ≤ 2n ln n = O(n log n).
1
= 2n
i=2
190 Numerical Methods and Optimization: An Introduction
Algorithm 9.2 A Las Vegas algorithm for finding the repeated element.
1: Input: a1 , a2 , . . . , an , where n/2 of the values are identical
2: Output: the repeated element
3: stop = 0
4: while stop=1 do
5: randomly pick two elements ai and aj
6: if (i = j) and (ai = aj ) then
7: stop = 1
8: return ai
9: end if
10: end while
ensure the correct answer with high probability. The probability of success in
a single try is
n2
n n
2(2 − 1) − n
1 1 1
Ps = = 4 2
= − > if n > 4.
n2 n2 4 2n 8
Hence, the probability of failure in a single try is
Pf = 1 − Ps < 7/8,
Alan M. Turing has shown that there cannot exist an algorithm that would
always solve the halting problem. The mathematical formalism he introduced in
1930s to describe a computer implementation of algorithms is called a Turing
machine and is a foundational concept in computational complexity theory.
Example 9.13 Consider a lottery, where some black box contains a set W of
n/2 distinct winning numbers randomly chosen from the set N = {1, 2, . . . , n}
of n integers. The problem is to guess all the elements of W by picking n/2
numbers from N . As soon as the pick is made, we can easily verify whether the
set of numbers picked coincides with W . Winning such a lottery (i.e., guessing
all the winning numbers correctly) is not easy, but not impossible.
9.4.1 Class N P
We will focus on decision problems that we can potentially solve by pro-
viding an efficiently verifiable certificate proving that the answer is “yes” (as-
suming that we are dealing with a yes instance of the problem). Such a class
of problems is defined next.
9.4.2 P vs. N P
Note that any problem from P is also in N P (i.e., P ⊆ N P), so there are
easy problems in N P. So, our original question (9.1) of distinguishing between
“easy” and “hard” problems now becomes:
NP P
Π1 ∝ Π2 and Π2 ∝ Π3 ⇒ Π1 ∝ Π3 . (9.4)
Indeed, let A1 and A2 be the two polynomial time algorithms used to reduce
Π1 to Π2 , and let A1 and A2 be the two polynomial time algorithms used to
reduce Π2 to Π3 . To reduce Π1 to Π3 , we first convert the instance π1 of Π1
into an instance π2 of Π2 using A1 , and then convert π2 into an instance π3
of Π3 using A1 . Then we solve Π3 and transform the answer into the answer
to Π2 using A2 , which we then convert into the answer to Π1 using A2 .
1. Π ∈ N P, and
1. Π ∈ N P, and
196 Numerical Methods and Optimization: An Introduction
6
m
F = Ci ,
i=1
where x1 , . . . , xk−3 are new variables. The new clauses are satisfiable if
and only if Ci is.
Example 9.16 Next, we will show that the recognition version of the max-
imum clique problem, clique, described in Example 9.14, is N P-complete.
Recall that clique is defined as follows. Given a simple undirected graph
G = (V, E) and an integer k, does there exist a clique of size ≥ k in G?
• Two vertices (Ci , ij ) and (Cp , pq ) are connected by an edge if and
only if
i = p and ij = ¯pq .
Then F is satisfiable if and only if G has a clique of size m.
Note that many optimization problems of interest, such as the optimization
version of the maximum clique problem (see Example 9.14), are unlikely to
belong to class N P. Hence, we cannot claim that the optimization version of
the maximum clique problem is N P-complete, despite the fact that it is at
least as hard as clique (see Exercise 9.9). If we drop the first requirement
(Π ∈ N P), we obtain the class of problems called N P-hard.
Proof: We will use a polynomial time reduction from 3-SAT to problem (9.5).
Let
6
m
F = Ci ,
i=1
where Ci = i1 ∨ i2 ∨ i3 and each literal ij , i = 1, . . . , m, j = 1, 2, 3 is either
some variable xk or its negation x̄k , k = 1, . . . , n, be an arbitrary instance of
the 3-SAT problem. For each such F , we construct an instance of a quadratic
optimization problem with the real vector of variables x = [x0 , x1 , . . . , xn ]T as
follows. For each clause Ci = i1 ∨ i2 ∨ i3 , we construct one linear inequality
constraint. The left-hand side of this inequality is given by the sum of four
terms, one of which is x0 , and the remaining three depend on the three literals
of Ci . Namely, if ij = xk for some k, then we add xk to the inequality, and
if ij = x̄k , we add (1 − xk ) to the inequality. The sum of these four terms is
set ≥ 32 to obtain the inequality corresponding to Ci . If we denote by
the set of indices of variables whose negations are literals in Ci , then we have
the following correspondence:
Clause Ci in F ←→ a linear term
ij = xk k ∈ Ii xk
ij = xk k ∈ I¯i 1 − xk
and the linear inequality representing Ci is given by
3
x0 + xk + (1 − xk ) ≥ .
¯
2
k∈Ii k∈Ii
AF x ≥ 3
2 +c
x0 − xi ≥ − 12 , i = 1, . . . , n ≡ AF x ≥ b F . (9.6)
x0 + xi ≥ 1
2, i = 1, . . . , n
We will use the following indefinite quadratic functions in the proof. Let
n
f1 (x) = (x0 + xi − 1/2)(x0 − xi + 1/2)
i=1
and
n
1
n
f2 (x) = (x0 + xi − 1/2)(x0 − xi + 1/2) − (xi − 1/2)2 .
i=1
2n i=1
n
Note that f1 (x) = nx20 − (xi −1/2)2 , i.e., it is a separable indefinite quadratic
i=1
function with one convex term nx20 and n concave terms −(xi − 1/2)2 , i =
1, . . . , n. In addition,
f2 (x) = f1 (x) + q(x),
where
1
n
q(x) = − (xi − 1/2)2 .
2n i=1
Also, we will use a vector x̂ in the proof, which is defined as follows for an
arbitrary x0 and Boolean x1 , . . . , xn satisfying F :
1/2 − x0 if xi = 0
x̂i = i = 1, . . . , n. (9.7)
1/2 + x0 if xi = 1,
minimize f2 (x)
subject to AF x ≥ bF (9.8)
x ≥ 0.
then having one k ∈ {1, 2, 3} such that yk > 1/2 is sufficient for x
in (9.10) to satisfy Ci . Next, we show that such k always exists if y
satisfies (9.9). We use contradiction.
Assume, by contradiction, that yk ≤ 1/2, k = 1, 2, 3 for the clause Ci
above. Then the inequality corresponding to Ci in AF y ≤ bF can be
written as
3
y0 + y1 + y2 + y3 ≥ .
2
For example, for the clause x̄1 ∨ x2 ∨ x3 we have
3
y0 + y1 + y2 + y3 = y0 + (1 − y1 ) + y2 + y3 ≥ .
2
For this inequality to hold, we must have yk ≥ 21 − y30 for at least one
k ∈ {1, 2, 3}. Without loss of generality, consider the case k = 1 (other
cases are established analogously). By our assumption, y1 ≤ 1/2, so
1 y0 1 y0 1
− ≤ y1 ≤ ⇒ − ≤ (1 − y1 ) − ≤ 0.
2 3 2 3 2
Hence,
y02
(y1 − 1/2)2 ≤ . (9.11)
9
202 Numerical Methods and Optimization: An Introduction
Also, since y is feasible for (9.8), it must satisfy the constraints in (9.6),
so
1 1 1
y 0 − y i ≥ − , y0 + y i ≥ ⇒ −y0 ≤ yi − ≤ y0 , i = 1, . . . , n,
2 2 2
and thus
y02 − (yi − 1/2)2 ≥ 0, i = 1, . . . , n. (9.12)
Therefore, using (9.12) and then (9.11), we obtain:
n
f1 (y) = (y0 + yi − 1/2)(y0 − yi + 1/2)
i=1
n $ %
= y02 − (yi − 1/2)2
i=1
≥ y02 − (y1 − 1/2)2
≥ 8 2
9 y0 .
1
n
1
q(y) = − (yi − 1/2)2 ≥ − y02 .
2n i=1 2
Hence
8 2 1 2 7 2
f2 (y) = f1 (y) + q(y) ≥ y − y = y ≥ 0,
9 0 2 0 18 0
a contradiction with (9.9).
(b) We associate the following indefinite quadratic problem with the given
instance F of 3-SAT:
minimize f1 (x)
subject to AF x ≥ bF (9.13)
x ≥ 0.
Suppose now that x∗ = [0, 1/2, . . . , 1/2]T is not a strict local minimum,
that is, there exists y = x∗ such that f1 (y) = f (x∗ ) = 0; therefore, yi ∈
{1/2 − y0 , 1/2 + y0 } , i = 1, . . . , n. Then the variables xi , i = 1, . . . , n
defined by
0 if yi = 1/2 − y0
xi (y) =
1 if yi = 1/2 + y0
satisfy F.
(c) Finally, to prove (c), note that if we fix x0 = 1/2 in the above indefinite
quadratic problem, then the objective function f (x) is concave with x∗
as the global minimum.
where
Bn = [0, 1]n = {x ∈ IRn : 0 ≤ xi ≤ 1, i = 1, . . . , n}
and f is Lipschitz continuous on Bn with respect to the infinity norm:
Theorem 9.5 Let < L/2. Then for any zero-order method for solving
problem (9.14) with an accuracy better$8than
9%n there exists an instance of
L
this problem that will require at least 2 objective function evalua-
tions.
8L9
Proof: Let p = 2 ; then p ≥ 1. Assume that there is a zero-order method
M that needs N < pn function evaluations to solve any instance of our prob-
lem (9.14) approximately. We will use the so-called resisting strategy to con-
struct a function f such that f (x) = 0 at any test point x used by the method
M, so that the method can only find x̃ ∈ Bn with f (x̃) = 0. Note that split-
ting [0, 1] into p equal segments with the mesh points { pi , i = 0, . . . , p} for
each coordinate axis defines a uniform grid partitioning of Bn into pn equal
hypercubes with the side 1/p. Since the method M uses N < pn function eval-
uations, at least one of these hypercubes does not contain any of the points
used by the method in its interior. Let x̂ be the center of such a hypercube.
We consider the function
It is easy to check (Exercise 9.12) that f¯(x) is Lipschitz continuous with the
constant L in the infinity norm, its global optimal value is −, and it differs
from zero only inside the box B = {x : x − x̂∞ ≤ /L}, which, since
2p ≤ L/, is a part of B ≡ {x : x − x̂∞ ≤ 2p 1
}. Thus, f¯(x) = 0 at all
test points of the method M. We conclude that the accuracy of the result of
our method cannot be better than if the number of the objective function
evaluations is less than pn .
of pn constructed points, the uniform grid algorithm simply picks one, x̄, that
minimizes f (x) over Xp . Let x∗ and f ∗ = f (x∗ ) be a global optimum and the
optimal value of problem (9.14), respectively. Then, x∗ must belong to one of
the hypercubes Bi1 i2 ...in . Let x̃ be the center of that hypercube. Then
L
f (x̄) − f ∗ ≤ f (x̃) − f ∗ ≤ Lx̃ − x∗ ∞ ≤ .
2p
Thus, if our goal is to find x̄ ∈ Bn : f (x̄) − f ∗ ≤ , then we need to choose p
such that ; <
L L
≤ ⇔ p≥ .
2p 2
The resulting uniform grid method is summarized in Algorithm 9.3.
This is a zero-order method, since it uses only the function value informa-
tion. As we have shown, the uniform grid algorithm outputs an -approximate
solution by performing a total of " 2
L
# function evaluations.
Let the desired accuracy be given, and let L/2 > > be such that
Complexity Issues 207
5
p
9
x(1, 5) x(2, 5) x(3, 5) x(4, 5) x(5, 5)
2p
4
p
7
x(1, 4) x(2, 4) x(3, 4) x(4, 4) x(5, 4)
2p
3
p
5
x(1, 3) x(2, 3) x(3, 3) x(4, 3) x(5, 3)
2p
2
p
3
x(1, 2) x(2, 2) x(3, 2) x(4, 2) x(5, 2)
2p
1
p
1
x(1, 1) x(2, 1) x(3, 1) x(4, 1) x(5, 1)
2p
0 1 1 3 2 5 3 7 4 9 5
2p p 2p p 2p p 2p p 2p p
1: p= " 2
L
#
1 −1 2i2 −1
2: x(i1 , i2 , . . . , in ) = [ 2i2p , 2p , . . . , 2in2p−1 ]T ∀ik ∈ {1, . . . , p}, k = 1, . . . , n
3: x̄ = arg min f (x), where
x∈Xp
1 −1
Xp = {x(i1 , . . . , in ) = [ 2i2p , . . . , 2in2p−1 ]T , ik ∈ {1, . . . , p}, k = 1, . . . , n}
4: return x̄
8 9
8L9
L
≥ 2
2 − 1 (note that such can always be selected). Recall from
Theorem 9.5 that achieving $8 accuracy
9%n < 9 using
$8 %n a zero-order method will
require at least L(n) = L
2 ≥ L
2 − 1 objective function eval-
uations. $&
Using '%nthe uniform
$8 L 9 grid
%n method, we guarantee accuracy using
U (n) = L
2 ≤ 2 + 1 objective function evaluations. If we select
208 Numerical Methods and Optimization: An Introduction
≤ L/(2n + 2), then the ratio of the upper and lower complexity bounds is
$8 L 9 %n n n
U (n) 2 + 1 2 2
≤ $8 L 9 %n = 1 + 8 L 9 ≤ 1+ → exp(2), n → ∞.
L(n) 2 − 1 2 − 1
n
This implies that the uniform grid method is an optimal zero-order method
for the considered problem.
Exercises
9.1. Given positive integer numbers a and n, develop an algorithm that com-
putes an in O(log n) time.
9.2. Prove or disprove:
n
(a) i5 = Θ(n6 ).
i=0
(b) n2.001 = Θ(n2 ).
(c) n5 + 1012 n4 log n = Θ(n5 ).
(d) n3n + 2n = O(n3 2n ).
f1 (n) g1 (n)
(e) If f1 (n) = O(g1 (n)) and f2 (n) = O(g2 (n)) then f2 (n) =O g2 (n) .
9.3. Consider an infinite array in which the first n cells contain integers in
sorted order, and the rest of the cells are filled with ∞. Propose an
algorithm that takes an integer k as input and finds the position of k
in the array or reports that k is not in the array in Θ(log n) time. Note
that the value of n is not given.
9.4. The following master theorem is used to solve recurrence relations. Let
a ≥ 1 and b > 1 be constants. Let f (n) be a function and let T (n) be
defined on the nonnegative integers by the recurrence of the form
where we interpret n/b to mean either n/b or "n/b#. Then T (n) can
be bounded asymptotically as follows.
$ %
1. If f (n) = O nlogb a− for some > 0, then T (n) = Θ(nlogb a );
$ %
2. If f (n) = Θ nlogb a , then T (n) = Θ(nlogb a log n);
$ %
3. If f (n) = Ω nlogb a+ for some > 0, and if af (n/b) ≤ cf (n)
for some constant c < 1 and all sufficiently large n, then T (n) =
Θ(f (n)).
Complexity Issues 209
9.12. Show that f¯(x) = min{0, Lx − x̂∞ − } in the proof of Theorem 9.5
is Lipschitz continuous with the constant L in the infinity norm, its
global optimal value is −, and it differs from zero only inside the box
B = {x : x − x̂∞ ≤ /L}.
Chapter 10
Introduction to Linear Programming
211
212 Numerical Methods and Optimization: An Introduction
Formulate an LP that would allow Yiming to design the least expensive diet
that satisfies the above requirements.
Yiming has to decide how much of each of the food types should be included
in his diet. Therefore, it is natural to define a decision variable for the amount
of each food type consumed daily:
His objective is to minimize the cost, which can be easily written as a linear
function of decision variables as follows:
calcium:
270x1 + 20x2 + 25x3 + 23x4 + 35x5 ≥ 800;
vitamin C:
x1 + 106x3 ≥ 75;
and calories:
Project
1 2 3 4 5 6
Investment ($) 10,000 25,000 35,000 45,000 50,000 60,000
Payout ($) 12,000 30,000 41,000 55,000 65,000 77,000
Partial investment (i.e., financing only a fraction of the project instead of the
whole project) is allowed for each project, with the payout proportional to the
investment amount. For example, if Jeff decides to invest $5,000 in project 2,
the corresponding payout will be $30,000×($5,000/$25,000)=$6,000. Jeff has
$100,000 available for investment. Formulate an LP to maximize the end-of-
year payout resulting from the investment.
Let
xi = fraction of project i financed, i = 1, . . . , 6.
Then we have the following LP formulation:
In addition, it is required that at least half of the day-shift nurses have week-
ends (Saturday and Sunday) off. Formulate this problem as an LP.
Note that a nurse’s schedule can be defined by the first day of the three-day
working cycle. Thus, we can define the decision variables as follows:
z = x 1 + x2 + x3 + x4 + x5 + x6 + x7 .
To ensure the required number of nurses for Monday, the total number of
nurses that have Monday on their working schedule should be at least 16:
x1 + x6 + x7 ≥ 16.
The demand constraints for the remaining 6 days of the week are formulated
in the same fashion:
x1 + x2 + x7 ≥ 12 (Tuesday)
x1 + x2 + x3 ≥ 18 (Wednesday)
x2 + x3 + x4 ≥ 13 (Thursday)
x3 + x4 + x5 ≥ 15 (Friday)
x4 + x5 + x6 ≥9 (Saturday)
x5 + x6 + x7 ≥7 (Sunday).
Note that only the first three schedules do not involve working on week-
ends. Therefore, the requirement that at least half of the nurses have weekends
off can be expressed as
x1 + x2 + x3 1
≥ .
x1 + x2 + x3 + x4 + x5 + x6 + x7 2
x1 + x2 + x3 − x4 − x5 − x6 − x7 ≥ 0.
Introduction to Linear Programming 217
minimize x1 + x2 + x3 + x4 + x5 + x6 + x7
subject to x1 + x6 + x7 ≥ 16
x1 + x2 + x7 ≥ 12
x1 + x2 + x3 ≥ 18
x2 + x3 + x4 ≥ 13
x3 + x4 + x5 ≥ 15
x4 + x5 + x6 ≥ 9
x5 + x6 + x7 ≥ 7
x1 + x2 + x3 − x4 − x5 − x6 − x7 ≥ 0
x 1 , x2 , x3 , x4 , x5 , x6 , x7 ≥ 0.
This problem has multiple optimal solutions with z ∗ = 31. One of them is
given by
The same shades can be obtained by mixing secondary colors (orange, green,
and purple), each of which is based on mixing two out of three primary col-
ors in equal proportions (red/yellow for orange, yellow/blue for green, and
red/blue for purple). Joe currently has 20 gallons each of red, yellow, and blue
paint, and 10 gallons each of orange, green, and purple paint. If needed, he
can purchase any of the primary color paints for $20 per gallon, however he
would like to save by utilizing the existing paint supplies as much as possible.
Formulate an LP helping Joe to minimize his costs.
We will use index i ∈ {1, . . . , 6} for red, yellow, blue, orange, green, and
purple colors, respectively, and index j ∈ {1, 2} for brown and gray colors,
respectively. Then our decision variables can be defined as
Next we specify the constraints. The total amount of brown and gray paint
made must be at least 50 gallons each:
The amount of each paint used for mixing must not exceed its availability:
x11 + x12 ≤ 20 + x1
x21 + x22 ≤ 20 + x2
x31 + x32 ≤ 20 + x3
x41 + x42 ≤ 10
x51 + x52 ≤ 10
x61 + x62 ≤ 10.
To express the constraints ensuring that the mixing yields the right shade of
brown, note that only three out of six colors used for mixing contain red, and
the total amount of red paint (including that coming from orange and purple
paints) used in the brown mix is
Hence, a constraint for the proportion of red color in the brown mix can be
written as follows:
x11 + 0.5x41 + 0.5x61
= 0.4.
x11 + x21 + x31 + x41 + x51 + x61
This equation can be easily expressed as a linear equality constraint:
Similarly, the proportion of yellow and blue colors in the brown mix is given
by:
x21 + 0.5x41 + 0.5x51
= 0.3
x11 + x21 + x31 + x41 + x51 + x61
and
x31 + 0.5x51 + 0.5x61
= 0.3,
x11 + x21 + x31 + x41 + x51 + x61
which can be equivalently written as
and
−0.3x11 − 0.3x21 + 0.7x31 − 0.3x41 + 0.2x51 + 0.2x61 = 0,
Finally, note that the fact that 20(x1 + x2 + x3 ) is minimized will force each
of the variables x1 , x2 , and x3 to be 0 unless additional red, yellow, or blue
paint is required. The resulting formulation is given by
All variables must be nonnegative. The objective is to minimize the total cost
of transportation:
m n
z= cij xij .
i=1 j=1
We need to make sure that the number of units shipped out of Wi does not
exceed si :
n
xij ≤ si , i = 1, . . . , m.
j=1
m
xij ≥ dj , j = 1, . . . , n.
i=1
We will use index i for the ith resource, i = 1, . . . , m; and index j for the
th
j product, j = 1, . . . , n. We define the decision variables as
c 1 x1 + . . . + c n xn .
The resource constraints, which make sure that the corporation does not ex-
ceed the availability of each resource, are given by
ai1 x1 + . . . + ain xn ≤ bi , i = 1, 2, . . . , m.
Introduction to Linear Programming 221
maximize c1 x1 + ... + c n xn
subject to a11 x1 + ... + a1n xn ≤ b1
.. .. .. ..
. . . .
am1 x1 + ... + amn xn ≤ bm
x1 , . . . , x n ≥ 0,
or, equivalently,
n
maximize c j xj
j=1
n
subject to aij xj ≤ bi , i = 1, 2, . . . , m
j=1
xj ≥ 0, j = 1, 2, . . . , n.
Denoting by
⎡ ⎤ ⎡ ⎤ ⎡ ⎤
a11 ··· a1n b1 c1
⎢ .. .. ⎥ , ⎢ ⎥ ⎢ ⎥
A=⎣ . ..
. . ⎦ b = ⎣ ... ⎦ , c = ⎣ ... ⎦ ,
am1 ··· amn bn cn
maximize cT x
subject to Ax ≤ b
x ≥ 0.
rather strong assumption, especially given that most of the real-life processes
we attempt to model are nonlinear in nature and are typically influenced by
some uncertainties. On the other hand, any mathematical model is only an
approximation of reality, and in many situations a linear approximation is
sufficiently reasonable to serve the purpose. Recall that a linear function f (x)
in IRn is given by
f (x) = c1 x1 + . . . + cn xn ,
where c1 , . . . , cn are constant real coefficients. This implies the properties of
additivity,
f (x + y) = f (x) + f (y) for any x, y ∈ IRn ,
and proportionality,
First, consider the line representing the points where the solid color fabric
constraint is satisfied with equality, x1 + x2 = 450. This line passes through
Introduction to Linear Programming 223
x2 x2
(a) solid fabric constraint (b) printed fabric constraint
450
(x1 + x2 ≤ 450) (x2 ≤ 300)
300
450
x1 x1
x2
(c) budget constraint (d) demand constraint (x1 ≤ 350)
x2
(4x1 + 5x2 ≤ 2, 000)
400
500 350
x1 x1
(e) nonnegativity constraints (f) the feasible region
x2 x2
x1 x1
FIGURE 10.1: Drawing the feasible region in the Heavenly Pouch, Inc.
example.
224 Numerical Methods and Optimization: An Introduction
x2
450
budget constraint
'
points (0,450) and (450,0) and splits the plane into two halves, where only
the points in the lower half-plane satisfy the solid color fabric constraint (Fig-
ure 10.1(a)). Similarly, we can plot the half-planes representing the sets of
points satisfying the printed fabric constraint, the budget constraint, and the
demand constraint, respectively (see Figure 10.1). Intersection of all these
half-planes with the nonnegative quadrant of the plane will give us the fea-
sible region of the problem (Figure 10.1(f)), which represents the set of all
points that satisfy all the constraints. Figure 10.2 shows the feasible region of
the Heavenly Pouch LP, with lines corresponding to each constraint marked
accordingly.
To solve the LP graphically, we will use level sets of the objective function,
which in case of a maximization LP are sometimes referred to as iso-profit
lines. Given a target objective function value (profit) z̄, the iso-profit line is
the set of points on the plane where z = z̄, i.e., it is just the level set of
the objective function z at the level z̄. The iso-profit lines corresponding to
different profit values z̄ may or may not overlap with the feasible region. We
typically start by plotting the iso-profit line for a reasonably low value of z̄ to
Introduction to Linear Programming 225
x2
450
z = 6, 000
'
120 budget constraint
'
z = 3, 000
'
ensure that it contains feasible points and hence can be conveniently shown
on the same plot as the feasible region. For the Heavenly Pouch LP, it appears
reasonable to first plot the iso-profit line for z = 15x1 + 25x2 = 3, 000, which
passes through the points (200, 0) and (0, 120) (see Figure 10.3). We see that
this profit level is feasible, so we can try a higher value, say z = 6, 000. We
see from the illustration that as we increased the target profit value, the new
iso-profit line is parallel to the previous one (since the slope remained the
same), and can be thought of as the result of movement of the previous iso-
profit line up or to the right. If we keep increasing the target value of z, the
corresponding iso-profit line will keep moving toward the upper right corner
of the figure. It is clear that if we select the profit value that is too optimistic
(say z = 10, 000), the iso-profit line will have no common points with the
feasible region.
However, we do not need to keep guessing which values of z would work.
Instead, we observe that the optimal solution in our example corresponds to
the last point that the iso-profit line will have in common with the feasible
region as we move the line toward the upper right corner. From the figure,
226 Numerical Methods and Optimization: An Introduction
Example 10.8 Consider again the Heavenly Pouch example discussed in Sec-
tion 10.1 and just solved graphically. Suppose that the price of a non-reversible
carrier is raised by $5, so the new objective function is z = 20x1 + 25x2 . Solve
the resulting modified Heavenly Pouch LP graphically.
In this case, the iso-profit line has the same slope as the line defining
the budget constraint, so the two lines are parallel (see Figure 10.4). Thus,
all points on the thick line segment between points x∗ = [125, 300]T and
x = [250, 200]T in the figure are optimal. The optimal objective function value
is z ∗ = 10, 000. Thus, there are infinitely many solutions, all of which belong
to the convex combination of two extreme points (also known as vertices or
corners) of the feasible region. As we will see later, any LP that has an optimal
solution must have at least one corner optimum.
minimize x1 + x2
subject to 100x1 + 50x2 ≥ 500 (store visitors)
500x1 + 1, 000x2 ≥ 5, 000 (website visitors)
x 1 , x2 ≥ 0. (nonnegativity)
We start solving the problem graphically by plotting the lines describing the
constraints and drawing the feasible region (Figure 10.5). Then we plot two
level sets for the objective function, which in case of minimization problems
are called iso-cost lines, for z = 15 and z = 10. We observe that as the value
of z decreases, the iso-cost line moves down, toward the origin. If we keep
decreasing z, the iso-cost line will keep moving down, and at some point, will
contain no feasible points. It is clear from the figure that the last feasible point
the iso-cost line will pass through as we keep decreasing the value of z will be
the point of intersection of the lines defining the store visitors constraint and
228 Numerical Methods and Optimization: An Introduction
x2
10
z = 15
'
← store visitors
20/3 constraint z = 10
'
z ∗ = 20/3
'
10/3
website visitors
' constraint
0 10/3 5 20/3 10 x1
we find the optimal solution x∗1 = x∗2 = 10/3 ≈ 3.333, z ∗ = 20/3 ≈ 6.666.
Thus, the store should spend $6,666 on advertising and split this budget evenly
between the magazine and online advertising to reach its goals.
Note that even though the LP we just solved has an unbounded feasible
region, it still has an optimal solution. However, if the objective function was
improving along one of the directions in which the feasible region is unbounded
(called direction of unboundedness), an optimal solution would not exist.
Example 10.10 Consider a problem that has the same objective function and
feasible region as the LP in the previous example, but change the objective to
Introduction to Linear Programming 229
maximization:
maximize x1 + x2
subject to 100x1 + 50x2 ≥ 500
500x1 + 1, 000x2 ≥ 5, 000
x 1 , x2 ≥ 0.
Clearly the objective function value tends to infinity if one of the variables is
increased toward infinity; thus this LP has no optimal solution.
Example 10.11 Assume that the retail store in Example 10.9 has an ad-
vertising budget limited to $5,000. This condition is reflected in the budget
constraint in the corresponding LP model:
minimize x1 + x2
subject to 100x1 + 50x2 ≥ 500 (store visitors)
500x1 + 1, 000x2 ≥ 5, 000 (website visitors)
x1 + x2 ≤ 5 (budget)
x 1 , x2 ≥ 0. (nonnegativity)
From the illustration in Figure 10.5 it is clear that the set of points such that
x1 + x2 ≤ 5 does not overlap with the set of points satisfying each of the
remaining constraints of the LP. Thus, no feasible point exists for this LP.
Indeed, we previously determined that an advertising campaign that will yield
the target results will cost at least $6,666.
For example, the Heavenly Pouch LP, as well as LPs in Examples 10.8 and 10.9
are optimal (which also implies that they are feasible LPs). In particular, the
LP in Example 10.9 is optimal despite its feasible region being unbounded. The
LP considered in Example 10.10 is unbounded, and the LP in Example 10.11
is infeasible.
Later (Theorem 11.5 at page 266) we will establish the following fact.
If an optimal LP has more than one optimal solution, then it is easy to show
that it has infinitely many optimal solutions. Indeed, consider a maximization
LP
max cT x,
x∈X
where X is a polyhedral set, and assume that the LP has two alternative
optimal solutions x∗ and x with the optimal objective value z ∗ = cT x∗ = cT x .
Then, for an arbitrary α ∈ (0, 1) consider a convex combination of x∗ and x ,
y = αx∗ + (1 − α)x ∈ X . We have
so, y is also an optimal solution of the LP. Thus, we established that the
following property holds.
Exercises
10.1. Romeo Winery produces two types of wines, Bordeaux and Romerlot,
by blending Merlot and Cabernet Sauvignon grapes. Making one bar-
rel of Bordeaux blend requires 250 pounds of Merlot and 250 pounds
of Cabernet Sauvignon, whereas making one barrel of Romerlot re-
quires 450 pounds of Merlot and 50 pounds of Cabernet Sauvignon. The
profit received from selling Bordeaux is $800 per barrel, and from selling
Introduction to Linear Programming 231
Romerlot, $600 per barrel. Romeo Winery has 9,000 pounds of Merlot
and 5,000 pounds of Cabernet Sauvignon available. Formulate an LP
model aiming to maximize the winery’s profit. Solve the LP graphically.
10.2. O&M Painters produce orange and maroon paints by mixing the so-
called primary red, yellow, and blue paint colors. The proportions of red,
yellow, and blue paints used to get the required shades are 50%, 40%,
and 10%, respectively for orange, and 60%, 10%, and 30%, respectively
for maroon. What is the maximum combined amount of orange and
maroon paints that O&M Painters can produce, given that they have
6 gallons of red paint, 4 gallons of yellow paint, and 1.8 gallons of blue
paint available for mixing? Formulate this problem as an LP and solve
it graphically.
10.3. The Concrete Guys make two types of concrete by mixing cement, sand,
and stone. The regular mix contains 30% of cement, 15% of sand, and
55% of stone (by weight), and sells for 5 cents/lb. The extra-strong mix
must contain at least 50% of cement, at least 5% of sand, and at least
20% of stone, and sells for 8 cents/lb. The Concrete Guys have 100,000 lb
of cement, 50,000 lb of sand, and 100,000 lb of stone in their warehouse.
Formulate an LP to determine the amount of each mix the Concrete
Guys should make in order to maximize their profit.
10.7. A company is looking to hire retail assistants for its new store. The
number of assistants required on different days of the week is as follows:
Monday – 4, Tuesday – 5, Wednesday – 5, Thursday – 6, Friday – 7,
Saturday – 8, and Sunday – 8. Each assistant is expected to work four
consecutive days and then have three days off. Formulate an LP aiming
to meet the requirements while minimizing the number of hires.
10.8. A financial company considers five different investment options for the
next two years, as described in the following table:
Here, year 0 represents the present time, year 1 represents one year from
now, and year 2 represents two years from now. For example, investment
1 requires an $11 million cash investment now and yields $2 million and
$12 million cash in one and two years from now, respectively; investment
2 requires two $8 million cash deposits (now and one year from now),
with a $20-million payday 2 years from now, etc. Any fraction of each
investment alternative can be purchased. For example, the company
could purchase 0.25 of investment 2, which would require two $2-million
cash investments (now and in one year), yielding $5 million in two years.
The company expects to have $20 million to invest now, plus $10 million
to invest at year 1 (in addition to the cash received from the original
investment). Formulate an LP to determine an investment strategy that
would maximize cash on hand after 2 years.
10.9. A farmer maintains a pasture for his 30 cows via watering and fertiliz-
ing. The grass grows uniformly and at a rate that is constant for the
given level of watering and fertilizing. Also, a cow grazing reduces the
Introduction to Linear Programming 233
amount of grass uniformly and at a constant rate. From the past expe-
rience, the farmer knows that under regular conditions (no watering or
fertilizing) the grass will run out in 20 days with 40 cows grazing, and
in 30 days with 30 cows using the pasture. Spending $1 per week on
watering increases the rate of grass growth by 1%, and spending $1 per
week on fertilizer increases the grass growth rate by 2%. For the fertil-
izer to be effective, the grass must be watered properly, meaning that for
each dollar spent on fertilizing, the farmer must spend at least 50 cents
on watering. Other than that, it can be assumed that the grass growth
rate increase due to watering is independent of that due to fertilizing.
Formulate an LP to minimize the cost of maintaining the pasture while
making sure that the grass never runs out. Solve the LP graphically.
10.10. Assume that in the diet problem (Section 10.2.1, p. 213) Yiming wants
calories from fat not to exceed 30% of the total calories he consumes.
Calories from fat for each considered food type are as follows: almond
butter – 480, brown rice – 15, salmon – 110, orange juice – 6, and
wheat bread – 8. Modify the corresponding LP formulation to include a
constraint limiting the fraction of fat calories.
In this chapter, we discuss one of the first and most popular methods for
solving LPs, the simplex method originally proposed by George Dantzig in
1940s for solving problems arising in military operations. In order to apply
this method, an LP is first converted to its standard form, as discussed in the
following section.
x1 + 2x2 + 3x3 + si = 4,
where
si = 4 − x1 − 2x2 − 3x3 ≥ 0.
Similarly, if the ith constraint is of “≥” type, we introduce a nonnegative
excess variable ej and subtract it from the left-hand side of the constraint to
obtain the corresponding equality constraint. For example, for
x1 + 2x2 + 3x3 ≥ 4,
we have
x1 + 2x2 + 3x3 − ei = 4,
where
ei = −4 + x1 + 2x2 + 3x3 ≥ 0.
235
236 Numerical Methods and Optimization: An Introduction
is given by
We require that all variables are nonnegative in the standard form repre-
sentation, however, in general, some of the LP variables may be unrestricted in
sign or free. We write xj ∈ IR to denote a free variable xj . If a free variable xj
is present in our LP, we can represent it as the difference of two nonnegative
variables as follows:
is given by
maximize cT x
subject to A x ≤ b
(11.1)
A x = b
x ≥ 0,
The Simplex Method for Linear Programming 237
maximize cT x
subject to Ax = b (11.2)
x ≥ 0,
where Im is the m × m identity matrix and O is the m × m zero matrix;
c is a (n + m )-vector of objective function coefficients (with cn+1 = . . . =
cn+m = 0); and b is an m-vector of right-hand sides.
The reason for this is that finding an initial feasible solution x(0) for an LP
in the form (11.3) is very easy: we can just use x(0) = 0, which obviously
satisfies all the constraints. This is important, since the simplex method needs
a starting feasible solution x(0) , which it will use to generate a finite sequence
of feasible points x(0) , x(1) , x(2) , . . . , x(N ) , such that each next point in the
sequence has an objective value at least as good as that of the previous point,
i.e., z(x(k+1) ) ≥ z(x(k) ), k = 0, . . . , N −1, and x∗ = x(N ) is an optimal solution
of the LP. If we do not require b ≥ 0 in the LP above, finding a starting point
x(0) is more challenging, and we will address this case after discussing how to
solve the LPs with b ≥ 0.
We will introduce the basic idea of the method using the Heavenly Pouch
LP formulated in Section 10.1 and solved graphically in Section 10.4. Consider
238 Numerical Methods and Optimization: An Introduction
We can write it in the equivalent dictionary format, where the slack variables
s1 , s2 , s3 , s4 are expressed through the remaining variables as follows:
z = 15x1 + 25x2
s1 = 450 − x1 − x2
s2 = 300 − x2 (11.5)
s3 = 2, 000 − 4x1 − 5x2
s4 = 350 − x1
In this representation, we will call the variables kept in the left-hand side
the basic variables, and the remaining variables nonbasic variables. Obviously,
the number of basic variables is the same as the number of constraints in
our LP, and the number of nonbasic variables equals the number of variables
in the original LP, before the slack variables were introduced. The sets of
basic and nonbasic variables will be updated step by step, using an operation
called pivot, as we proceed with the iterations of the simplex method. We will
denote the sets of all the basic and nonbasic variables at step k of the simplex
method by BVk and N Vk , respectively. We assume that the initial dictionary
corresponds to step k = 0. Thus, in our example
Note that to get a feasible solution to the considered LP, we can set all the
nonbasic variables to 0, and this will uniquely determine the corresponding
values of the basic variables and the objective function. We have:
We call this solution the basic solution corresponding to the basis BV0 . If
The Simplex Method for Linear Programming 239
all variables have nonnegative values in a basic solution, then the solution is
called a basic feasible solution (bfs) and the corresponding dictionary is called
feasible. Note that the basic solution with the basis BV0 in our example is, in
fact, a basic feasible solution.
Our LP can also be conveniently represented in the tableau format:
z x1 x2 s1 s2 s3 s4 rhs Basis
1 −15 −25 0 0 0 0 0 z
0 1 1 1 0 0 0 450 s1
(11.6)
0 0 1 0 1 0 0 300 s2
0 4 5 0 0 1 0 2, 000 s3
0 1 0 0 0 0 1 350 s4
Here rhs stands for right-hand side. The entries in the tableau are just the
coefficients of LP in the standard form (11.4), where the z-row is modified by
moving all variables to the left-hand side, so instead of z = 15x1 + 25x2 we
write
z − 15x1 − 25x2 = 0.
In this format, z is treated as a variable that is always basic. Since the dictio-
nary format is helpful for visual explanation of the ideas behind the method
and the tableau format is more handy for performing the computations, we
will use both representations as we describe the steps of the simplex method
below. In both dictionary and tableau formats, we number the rows starting
with 0, so the top row is referred to as row 0 or the z-row, and row i corre-
sponds to the ith constraint. The basic feasible solution at step 0 is given in
the following table.
Step 0 basic feasible solution
BV0 : s 1 , s2 , s3 , s 4
N V0 : x 1 , x2
bf s : x1 = x2 = 0
s1 = 450, s2 = 300, s3 = 2, 000, s4 = 350
z=0
We are ready to perform the first iteration of the simplex method.
11.2.1 Step 1
Let us analyze our problem written in the dictionary form as in (11.5)
above, taking into account that the current basic feasible solution has all the
nonbasic variables at 0, x1 = x2 = 0. We have:
z = 15x1 + 25x2
s1 = 450 − x1 − x2
s2 = 300 − x2
s3 = 2, 000 − 4x1 − 5x2
s4 = 350 − x1
240 Numerical Methods and Optimization: An Introduction
z = 15x1 + 25x2 ,
we pick variable x2 as the one whose value will be increased. We call this
variable the pivot variable and the corresponding column in the dictionary
is called the pivot column. We want to increase the value of x2 as much as
possible while keeping the other nonbasic variable equal to 0. The amount by
which we can increase x2 is restricted by the nonnegativity constraints for the
basic variables, which must be satisfied to ensure feasibility:
s1 = 450 − x2 ≥ 0
s2 = 300 − x2 ≥ 0
s3 = 2, 000 − 5x2 ≥ 0
s4 = 350 − 0x2 ≥ 0
x2 = 300 − s2 .
Then we substitute this expression for x2 in the remaining rows of the dictio-
nary:
To complete the same step using the tableau format, we consider the
tableau (11.6). We find the most negative coefficient in the z-row; it corre-
sponds to x2 , thus the corresponding column is the pivot column. We perform
the ratio test by dividing the entries in the rhs column by the correspond-
ing entries in the pivot column that are positive. The minimum such ratio,
300, corresponds to the second row, which is the pivot row. The coefficient on
the intersection of the pivot row and pivot column in the table is the pivot
element.
↓
z x1 x2 s1 s2 s3 s4 rhs Basis Ratio
1 −15 −25 0 0 0 0 0 z
0 1 1 1 0 0 0 450 s1 450
0 0 1 0 1 0 0 300 s2 300 ←
0 4 5 0 0 1 0 2, 000 s3 400
0 1 0 0 0 0 1 350 s4 −
To perform the pivot, we use elementary row operations involving the pivot
row with the goal of turning all pivot column entries in the non-pivot rows
into 0s and the pivot element into 1. In particular, we multiply the pivot row
by 25, −1, and −5, add the result to rows 0, 1, and 3, respectively, and update
the corresponding rows. Since the pivot element is already 1, the pivot row is
kept unchanged, but the corresponding basic variable is now x2 instead of s2 .
As a result, we obtain the following step 1 tableau:
z x1 x2 s1 s2 s3 s4 rhs Basis
1 −15 0 0 25 0 0 7, 500 z
0 1 0 1 −1 0 0 150 s1
(11.8)
0 0 1 0 1 0 0 300 x2
0 4 0 0 −5 1 0 500 s3
0 1 0 0 0 0 1 350 s4
Compare this tableau to the corresponding dictionary (11.7). Clearly, the dic-
tionary and the tableau describe the same system. The basic feasible solution
242 Numerical Methods and Optimization: An Introduction
We saw that, as a result of the pivot operation, one of the previously nonbasic
variables, x2 , has become basic, whereas s2 , which was basic, has become
nonbasic. We will call the variable that is entering the basis during the current
iteration the entering variable and the variable that is leaving the basis the
leaving variable.
11.2.2 Step 2
The next step is performed analogously to the first step. Again, we analyze
the current dictionary (11.7) and try to increase the objective function value
by updating the current basic feasible solution.
Notice that, as before, the basic feasible solution can be obtained by setting
all nonbasic variables equal to 0, so the same considerations as in step 1 apply
when we decide which nonbasic variable should be increased in value and
hence enter the basis. Since only one variable, x1 , has a positive coefficient in
the objective, it is the only entering variable candidate. Row 3 wins the ratio
test, so s3 is the leaving variable and we have
5 1
x1 = 125 + s2 − s3 ,
4 4
25 15
z = 7, 500 + 15x1 − 25s2 = 9, 375 − s2 − s3 ,
4 4
1 1
s1 = 150 − x1 + s2 = 25 − s2 + s3 ,
4 4
5 1
s4 = 350 − x1 = 225 − s2 + s3 .
4 4
The Simplex Method for Linear Programming 243
z = 9, 375 − 25
4 s2 − 15
4 s3
s1 = 25 − 1
4 s2 + 1
4 s3
x2 = 300 − s2 (11.9)
x1 = 125 + 5
4 s2 − 1
4 s3
s4 = 225 − 5
4 s2 + 1
4 s3
Next, we carry out the computations for step 2 in the tableau format. In the
step 1 tableau (11.8), we find the most negative coefficient in the z-row, which
leads to selecting x1 as the entering variable. Row 3 wins the ratio test, so s3
is the leaving variable.
↓
z x1 x2 s1 s2 s3 s4 rhs Basis Ratio
1 −15 0 0 25 0 0 7, 500 z
0 1 0 1 −1 0 0 150 s1 150
0 0 1 0 1 0 0 300 x2 −
0 4 0 0 −5 1 0 500 s3 125 ←
0 1 0 0 0 0 1 350 s4 350
We first divide row 3 by the pivot element value, which is 4, and then use it to
eliminate the remaining nonzero coefficients in the pivot column. We obtain
the following step 2 tableau:
z x1 x2 s1 s2 s3 s4 rhs Basis
1 0 0 0 25/4 15/4 0 9, 375 z
0 0 0 1 1/4 −1/4 0 25 s1
(11.10)
0 0 1 0 1 0 0 300 x2
0 1 0 0 −5/4 1/4 0 125 x1
0 0 0 0 5/4 −1/4 1 225 s4
s1 = 25 − 1
4 s2 + 1
4 s3
x2 = 300 − s2
x1 = 125 + 5
4 s2 − 1
4 s3
s4 = 225 − 5
4 s2 + 1
4 s3 .
The objective function is given by
25 15
z = 9, 375 − s2 − s3 ,
4 4
where both s2 and s3 are nonnegative. Since the coefficients for s2 and s3
are negative, it is clear that the highest possible value z ∗ of z is obtained
by putting s2 = s3 = 0. Thus, the current basic feasible solution is optimal.
When reporting the optimal solution, we can ignore the slack variables as they
were not a part of the original LP we were solving. Thus, the optimal solution
is given by
x∗1 = 125, x∗2 = 300, z ∗ = 9, 375.
Recognize that this is the same solution as the one we obtained graphically in
Section 10.4. Since a negative nonbasic variable coefficient in the dictionary
format is positive in the tableau format and vice versa, a tableau is deemed
optimal if all nonbasic variables have nonnegative coefficients in row 0.
the basic variable representing a row that wins the ratio test. However, if all
coefficients in the pivot column of the dictionary are positive, the ratio test
produces no result. For example, consider the following dictionary:
z = 90 − 25x1 + 4x2
s1 = 25 − 14x1 + x2
s2 = 30 − x1
s3 = 12 + 5x1 + 14x2
s4 = 22 − 4x1 + 7x2 .
z x1 x2 s1 s2 s3 s4 rhs Basis
1 25 −4 0 0 0 0 90 z
0 14 −1 1 0 0 0 25 s1
0 1 0 0 1 0 0 30 s2
0 −5 −14 0 0 1 0 12 s3
0 4 −7 0 0 0 1 22 s4
Thus, if we use the tableau format, we conclude that the problem is unbounded
if at some point we obtain a tableau that has a column such that none of its
entries are positive.
be the case, as illustrated by the next example. Consider the following LP:
We apply the simplex method to this problem. We will use the tableau format.
Let x5 and x6 be the slack variables for the first and second constraints,
respectively. We always select the nonbasic variable with the most negative
coefficient in row 0 as the entering variable. In case there are multiple ratio
test winners, we select the basic variable with the lowest index as the leaving
variable. The step 0 tableau is given by
z x1 x2 x3 x4 x5 x6 rhs Basis
1 −5 −4 20 2 0 0 0 z
(11.12)
0 1
4 − 18 12 10 1 0 0 x5
1 1 1 1
0 10 20 20 5 0 1 0 x6
Note that both basic variables are equal to 0 in the starting basic feasible
solution.
Definition 11.1 Basic solutions with one or more basic variables equal
to 0 are called degenerate.
We carry out the first step. The entering variable is x1 , since it is the variable
with the most negative coefficient in the z-row, and the leaving variable is
x5 , which is the basic variable in the row winning the ratio test. The step 1
tableau is given by:
z x1 x2 x3 x4 x5 x6 rhs Basis
1 0 − 13
2 260 202 20 0 0 z
0 1 − 12 48 40 4 0 0 x1 (11.13)
0 0 1
10 − 19
4 − 19
5 − 25 1 0 x6
The basic feasible solution is the same as at step 0, even though the basis has
changed.
z x1 x2 x3 x4 x5 x6 rhs Basis
1 0 0 − 195
4 −45 −6 65 0 z
97 (11.14)
0 1 0 4 21 2 5 0 x1
0 0 1 − 95
2 −38 −4 10 0 x2
step 3 tableau:
z x1 x2 x3 x4 x5 x6 rhs Basis
1 195
97 0 0 − 270
97 − 192
97
7280
97 0 z
(11.15)
0 190
97 1 0 304
97 − 97
8 1920
97 0 x2
4 84 8 20
0 97 0 1 97 97 97 0 x3
step 4 tableau:
z x1 x2 x3 x4 x5 x6 rhs Basis
1 15
4
135
152 0 0 − 39
19
1760
19 0 z
(11.16)
0 − 12 − 21
76 1 0 2
19 − 100
19 0 x3
0 5
8
97
304 0 1 − 38
1 120
19 0 x4
step 5 tableau:
z x1 x2 x3 x4 x5 x6 rhs Basis
1 −6 − 92 39
2 0 0 −10 0 z
1 1 1 (11.17)
0 2 4 4 1 0 5 0 x4
0 − 19
4 − 21
8
19
2 0 1 −50 0 x5
step 6 tableau:
z x1 x2 x3 x4 x5 x6 rhs Basis
1 −5 −4 20 2 0 0 0 z
(11.18)
0 1
4 − 18 12 10 1 0 0 x5
1 1 1 1
0 10 20 20 5 0 1 0 x6
248 Numerical Methods and Optimization: An Introduction
The last tableau is exactly the same as the step 0 tableau (11.12). Thus, if we
continue with the execution of the simplex method, we will keep repeating the
calculations performed in steps 1–6 and will never be able to leave the same
solution.
Several methods are available that guarantee that cycling is avoided. One
of them is Bland’s rule, which is discussed next. According to this rule, the
variables are ordered in a certain way, for example, in the increasing order of
their indices, i.e., x1 , x2 , . . . , xn+m . Then, whenever there are multiple candi-
dates for the entering or the leaving variable, the preference is given to the
variable that appears earlier in the ordering. All nonbasic variables with a
positive coefficient in the z-row of the dictionary (or a negative coefficient in
row 0 of the tableau) are candidates for the entering variable, and all the basic
variables representing the rows that win the ratio test are candidates for the
leaving variable.
Theorem 11.1 If Bland’s rule is used to select the entering and leaving
variables in the simplex method, then cycling never occurs.
z x1 x2 x3 x4 x5 x6 rhs Basis
1 −6 − 92 39
2 0 0 −10 0 z
1 1 1 (11.19)
0 2 4 4 1 0 5 0 x4
0 − 19
4 − 21
8
19
2 0 1 −50 0 x5
The candidates for entering the basis are x1 , x2 , and x6 , thus, according to
Bland’s rule, x1 is chosen as the entering variable.
z x1 x2 x3 x4 x5 x6 rhs Basis
1 0 − 32 45
2 12 0 50 0 z
1 1 (11.20)
0 1 2 2 2 0 10 0 x1
0 0 − 14 95
8
19
2 1 − 52 0 x5
The Simplex Method for Linear Programming 249
z x1 x2 x3 x4 x5 x6 rhs Basis
1 3 0 24 18 0 80 0 z
(11.21)
0 2 1 1 4 0 20 0 x2
1 97 21 5
0 2 0 8 2 1 2 0 x5
In fact, the solution has not changed compared to the basic feasible solution
we had at step 0, however, the last tableau proves its optimality.
n
maximize c j xj
j=1
n
(11.22)
subject to aij xj ≤ bi , i = 1, . . . , m
j=1
xj ≥ 0, j = 1, . . . , n,
We first show that any two dictionaries with the same basis must be identical.
Indeed, consider two dictionaries corresponding to the same basis. Let B be
the set of indices of the basic variables and let N be the set of indices of
nonbasic variables.
z = z̄ + c̄j xj z = z̃ + c̃j xj
j∈N j∈N
xi = b̄i − āij xj , i∈B xi = b̃i − ãij xj , i ∈ B.
j∈N j∈N
Any two dictionaries of the same LP with the same basis are identical.
The initial dictionary (11.23) is, essentially, a linear system that represents the
original LP written in the standard form. The only transformations we apply
to this linear system at each subsequent iteration of the simplex method are
the elementary row operations used to express the new set of basic variables
through the remaining variables. Since applying an elementary row operation
to a linear system results in an equivalent linear system, we have the following
property.
The ratio test we use to determine the leaving variable at each step is designed
to ensure that the constant term in the right-hand side of each equation is
nonnegative, so that setting all the nonbasic variables to 0 yields nonnegative
values for all the basic variables and thus the corresponding basic solution is
feasible. Thus, if we start with a feasible dictionary, feasibility is preserved
throughout execution of the simplex method.
The entering variable on each step of the simplex method is chosen so that
each next basic feasible solution obtained during the simplex method execu-
tion is at least as good as the previous solution. However, we saw that the
simplex method may go through some consecutive degenerate iterations with
no change in the objective function value, in which case cycling can occur.
It appears that this is the only case where the method may not terminate.
The LP is solved graphically in Figure 11.1. Also, solving this LP with the
simplex method produced the following basic feasible solutions:
D
z = 6, 000
'
120 K budget constraint
'
E
z = 3, 000
'
A F L M
0 200 350 400 450 500 x1
basic feasible solutions generated by the simplex method, which have all but
one basic variables in common, represent vertices of the polyhedron that are
connected by an edge of the feasible region.
In other words, if the LP has m constraints, then adjacent basic feasible so-
lutions have m − 1 variables in common. Using this terminology, at any given
step the simplex method moves from the current basic feasible solution to
an adjacent basic feasible solution. Next, we will show that any basic feasi-
ble solution represents an extreme point (vertex) of the feasible region, which
is exactly what we observed in our example. We consider the feasible region
X = {x : Ax = b, x ≥ 0} of an LP in the standard form.
The Simplex Method for Linear Programming 253
x̄ = αx̃ + (1 − α)x̂.
Returning to our example, observe that the feasible region in Figure 11.1
has 6 extreme points, A, B, C, D, E, and F . The correspondence between these
extreme points and basic feasible solutions of the LP is shown in Table 11.1.
Recall that any basic (not necessarily feasible) solution is obtained by set-
ting the nonbasic variables to 0. In our two-dimensional case, we have two
nonbasic variables. If one of the original variables is 0, then the correspond-
ing basic solution lies on the line defining the corresponding coordinate axis,
and if a slack variable is 0 then the constraint it represents is binding for
the corresponding basic solution. Thus, basic solutions correspond to pairs
of lines defining the feasible region (including the two coordinate axes). The
total number of basic solutions that we may potentially have in our example
254 Numerical Methods and Optimization: An Introduction
$ %
is 2+44 = 15, however, not every set of 4 variables may form a basis. For
example, the basis consisting of variables x1 , s1 , s3 , and s4 is not possible,
since this would imply that x2 = 0 and s2 = 300 − x2 = 0 at the same time,
which is impossible. Geometrically, this corresponds to parallel lines defining
a pair of constraints (in our case, the line for the printed fabric constraint,
x2 = 300, is parallel to the line x2 = 0), meaning that both constraints
cannot be binding at the same time. In our example, x1 and s4 cannot be
nonbasic simultaneously as well, since the demand constraint line is parallel
to the x2 -axis. Excluding these two cases, there are 15 − 2 = 13 potential
basic solutions. As we already discussed, six of them (A, B, C, D, E, F ) are
basic feasible solutions, and we can see that the remaining basic solutions,
which lie on pairwise intersections of lines defining the constraints (including
nonnegativity), are infeasible (points G, H, I, J, K, L, and M in Figure 11.1).
Establishing the correspondence between these points and basic solutions is
left as an exercise (Exercise 11.4 at page 278).
z = 15x1 + 25x2
s1 = 450 − x1 − x2
s2 = 300 − x2
(11.26)
s3 = 2, 000 − 4x1 − 5x2
s4 = 350 − x1
e5 = −100 + x1 + x2
x1 + x2 − e5 + a5 = 100.
With this modification, we can use a5 as the starting basic variable for this
256 Numerical Methods and Optimization: An Introduction
constraint, thus obtaining a basic feasible solution for the resulting LP. How-
ever, to get a feasible solution for the original problem (if there is one), we
need to make sure that in the end the artificial variable a5 = 0. The methods
we are about to discuss utilize alternative ways of driving the artificial vari-
ables out of the basis, thus ensuring that they all eventually vanish whenever
the LP is feasible. We first discuss the general setup for both methods and
then proceed to describe each of them in more detail.
Consider a general LP
n
maximize c j xj
j=1
n
subject to aij xj ≤ bi , i = 1, . . . , m
j=1 (P)
n
aij xj = bi , i = 1, . . . , m
j=1
xj ≥ 0, j = 1, . . . , n.
After introducing m slack variables xn+1 , . . . , xn+m and updating the prob-
lem coefficients accordingly, we can write this LP in the standard form as
follows:
n+m
maximize c j xj
j=1
n+m (PS)
subject to aij xj = bi , i = 1, . . . , m
j=1
xj ≥ 0, j = 1, . . . , n + m ,
I a = I − ∪ {m + 1, . . . , m}
the set of indices of all constraints, both inequality and equality, that require
an artificial variable to initialize the simplex method.
We will associate the following two problems, which share the same feasible
The Simplex Method for Linear Programming 257
n+m
maximize c j xj − M ai
j=1 i∈I a
n+m
subject to aij xj = bi , i ∈ {1, . . . , m } \ I a
j=1 (B)
n+m
aij xj + ai = bi , i ∈ Ia
j=1
x j , ai ≥ 0, j = 1, . . . , n + m , i ∈ I a ,
where M is some sufficiently large positive constant referred to as the “big
M .” Problem (A) is called the auxiliary problem and problem (B) is the big-
M problem associated with (P).
Example 11.3 Consider the following LP:
maximize x1 − 2x2 + 3x3
subject to −2x1 + 3x2 + 4x3 ≥ 12
3x1 + 2x2 + x3 ≥ 6 (11.27)
x1 + x2 + x3 ≤ 9
x 1 , x2 , x3 ≥ 0.
This LP in the standard form is given by:
maximize x1 − 2x2 + 3x3
subject to −2x1 + 3x2 + 4x3 − x4 = 12
3x1 + 2x2 + x3 − x5 = 6 (11.28)
x1 + x2 + x3 + x6 = 9
x 1 , x2 , x3 , x4 , x5 , x6 ≥ 0.
Clearly, the basic solution with the basis consisting of x4 , x5 , and x6 is infea-
sible since it has negative values for x4 and x5 (x4 = −12 and x5 = −6).
Hence, we introduce artificial variables for the first two constraints. Then the
corresponding auxiliary problem can be written as a maximization problem as
follows:
maximize − a1 − a2
subject to −2x1 + 3x2 + 4x3 − x4 + a1 = 12
3x1 + 2x2 + x3 − x5 + a2 = 6 (11.29)
x1 + x2 + x3 + x6 = 9
x 1 , x 2 , x 3 , x 4 , x 5 , x6 , a 1 , a 2 ≥ 0,
258 Numerical Methods and Optimization: An Introduction
Note that we can easily obtain a basic feasible solution for both (A) and (B)
by selecting the basis consisting of the slack variables xn+i , i ∈ {1, . . . , m }\I a
for rows where artificial variables were not needed, and the artificial variables
ai , i ∈ I a for the remaining rows. Also, the objective function of the auxil-
iary problem (A) is always nonnegative and thus any feasible solution of this
problem with ai = 0, i ∈ I a is optimal.
In addition, observe that if a feasible solution of (B) with ai > 0 for at least
one i ∈ I a exists, then the objective function value can be made arbitrarily
poor (i.e., very large, negative) by selecting a sufficiently large constant M > 0.
Theorem 11.4 The following properties hold for LP (P) and the asso-
ciated auxiliary problem (A) and big-M problem (B):
The last theorem provides foundations for the two-phase simplex and the
big-M methods discussed next.
• Phase I: Solve the auxiliary problem (A), and, as a result, either obtain
a feasible tableau for the original problem (P) (if the optimal objective
value is 0), or conclude that the problem is infeasible (if the optimal
objective value is positive).
• Phase II: If the problem was not judged infeasible in Phase I, solve the
original problem using the optimal tableau of the auxiliary problem (A)
to get the starting tableau for the original LP (P).
To get a feasible tableau for (P) from an optimal tableau for (A) in Phase
II, we need to get rid of the artificial variables. If all artificial variables are non-
basic in the optimal tableau for (A), we just drop the corresponding columns
and express the objective of (P) through nonbasic variables to obtain a feasi-
ble tableau for (P). If some of the auxiliary variables are basic in the obtained
optimal solution for (P), the solution must be degenerate since the basic artifi-
cial variables are equal to 0, and we attempt to drive them out of the basis by
performing additional degenerate pivots. This is always possible, unless there
is a basic artificial variable in the optimal tableau such that its corresponding
row does not have nonzero coefficients in columns other than artificial variable
columns, in which case we can just remove the corresponding row. This can
be the case only when the original LP in the standard form has linearly de-
pendent constraints, as will be illustrated in Example 11.6. We consider other
examples first.
Example 11.4 Use the two-phase simplex method to solve LP (11.27) from
Example 11.3:
maximize − a1 − a2
subject to −2x1 + 3x2 + 4x3 − e1 + a1 = 12
3x1 + 2x2 + x3 − e2 + a2 = 6
x1 + x2 + x3 + s3 = 9
x 1 , x2 , x3 , e 1 , e 2 , s 3 , a1 , a2 ≥ 0.
We solve the Phase I LP using the simplex method in the tableau format.
Expressing the objective through nonbasic variables,
z = −a1 − a2
= −(12 + 2x1 − 3x2 − 4x3 + e1 ) − (6 − 3x1 − 2x2 − x3 + e2 )
= −18 + x1 + 5x2 + 5x3 − e1 − e2 ,
z x1 x2 x3 e1 e2 s3 a1 a2 rhs Basis
1 −1 −5 −5 1 1 0 0 0 −18 z
0 −2 3 4 −1 0 0 1 0 12 a1
0 3 2 1 0 −1 0 0 1 6 a2
0 1 1 1 0 0 1 0 0 9 s3
Step 1 tableau:
z x1 x2 x3 e1 e2 s3 a1 a2 rhs Basis
1 13
2 0 − 52 1 − 32 0 0 5
2 −3 z
0 − 13
2 0 5
2 −1 3
2 0 1 − 32 3 a1
0 3
2 1 1
2 0 − 12 0 0 1
2 3 x2
0 − 12 0 1
2 0 1
2 1 0 − 12 6 s3
Step 2 tableau:
z x1 x2 x3 e1 e2 s3 a1 a2 rhs Basis
1 0 0 0 0 0 0 1 1 0 z
0 − 13
5 0 1 − 25 3
5 0 2
5 − 35 6
5 x3
0 14
5 1 0 1
5 − 45 0 − 15 4
5
12
5 x2
0 4
5 0 0 1
5
1
5 1 − 15 − 15 27
5 s3
This tableau is optimal. Since the optimal objective value is 0, the original
LP is feasible. To obtain a feasible tableau for the original LP, we drop the
The Simplex Method for Linear Programming 261
columns for a1 and a2 in the tableau above and replace the basic variables x2
and x3 in the objective function of the original LP,
z = x1 − 2x2 + 3x3 ,
with their expressions through the nonbasic variables from the optimal Phase
I tableau,
x2 = 12 5 − 5 x1 − 5 e1 + 5 e2 ;
14 1 4
x3 = 6
5 + 13
5 x1 + 25 e1 − 35 e2 .
We obtain
z = x1 − 2x2 + 3x3 = − 65 + 72
5 x1 + 85 e1 − 17
5 e2 .
z x1 x2 x3 e1 e2 s3 rhs Basis
1 − 72
5 0 0 − 85 17
5 0 − 65 z
0 −513
0 1 − 25 3
5 0 6
5 x3
0 14
5 1 0 1
5 − 45 0 12
5 x2
4 1 1 27
0 5 0 0 5 5 1 5 s3
z x1 x2 x3 e1 e2 s3 rhs Basis
1 0 36
7 0 − 47 − 57 0 78
7 z
0 0 13
14 1 − 14
3
− 17 0 24
7 x3
0 1 5
14 0 1
14 − 27 0 6
7 x1
0 0 − 27 0 1
7
3
7 1 33
7 s3
z x1 x2 x3 e1 e2 s3 rhs Basis
1 0 14
3 0 − 13 0 5
3 19 z
0 0 5
6 1 − 16 0 1
3 5 x3
1 1 2
0 1 6 0 6 0 3 4 x1
0 0 − 23 0 1
3 1 7
3 11 e2
262 Numerical Methods and Optimization: An Introduction
z x1 x2 x3 e1 e2 s3 rhs Basis
1 2 5 0 0 0 3 27 z
0 1 1 1 0 0 1 9 x3
0 6 1 0 1 0 4 24 e1
0 −2 −1 0 0 1 1 3 e2
maximize x1 + x2 + x3
subject to 2x1 + 2x2 + 3x3 = 6
x1 + 3x2 + 6x3 = 12.
We introduce artificial variables a1 and a2 and write down the phase I starting
tableau:
z x1 x2 x3 a1 a2 rhs Basis
1 −3 −5 −9 0 0 −18 z
0 2 2 3 1 0 6 a1
0 1 3 6 0 1 12 a2
After one pivot, we obtain an optimal tableau:
z x1 x2 x3 a1 a2 rhs Basis
1 3 1 0 3 0 0 z
2 2 1
0 3 3 1 3 0 2 x3
0 −3 −1 0 −2 1 0 a2
z x1 x2 x3 a1 a2 rhs Basis
1 0 0 0 1 1 0 z
0 − 43 0 1 −1 2
3 2 x3
0 3 1 0 2 −1 0 x2
The Simplex Method for Linear Programming 263
Removing the artificial variables and expressing the objective in terms of the
nonbasic variable x1 , we obtain the following phase II initial tableau:
z x1 x2 x3 rhs Basis
2
1 3 0 0 2 z
0 − 43 0 1 2 x3
0 3 1 0 0 x2
This tableau happens to be optimal, with the optimal solution given by
x∗1 = x∗2 = 0, x∗3 = 2, z ∗ = 2.
Example 11.6 Consider the following LP with linearly dependent con-
straints:
maximize x1 + x2 + 2x3
subject to x1 + 2x2 + 3x3 = 6
2x1 + 4x2 + 6x3 = 12.
Solve the problem using the two-phase simplex method.
We introduce artificial variables a1 and a2 and write down the phase I starting
tableau:
z x1 x2 x3 a1 a2 rhs Basis
1 −3 −6 −9 0 0 −18 z
0 1 2 3 1 0 6 a1
0 2 4 6 0 1 12 a2
After one pivot, we obtain an optimal phase I tableau:
z x1 x2 x3 a1 a2 rhs Basis
1 0 0 0 3 0 0 z
1 2 1
0 3 3 1 3 0 2 x3
0 0 0 0 −2 1 0 a2
Again, the corresponding basic optimal solution is degenerate, but this time
we cannot make both a1 and a2 nonbasic at the same time like we did in the
previous example. However, we can see that the second row does not involve
the original variables. Hence, if we remove this row along with the column for
a1 and express the objective function through the nonbasic variables,
2 4 1 1
z = x1 + x2 + 2x3 = x1 + x2 + 4 − x1 − x2 = 4 + x1 − x2 ,
3 3 3 3
we obtain a feasible tableau for the original problem:
z x1 x2 x3 rhs Basis
1 − 13 1
3 0 4 z
1 2
0 3 3 1 2 x3
264 Numerical Methods and Optimization: An Introduction
z x1 x2 x3 rhs Basis
1 0 1 1 6 z
0 1 2 3 6 x1
This tableau is optimal, with the corresponding basic optimal solution given
by
x∗1 = 6, x∗2 = x∗3 = 0, z ∗ = 6.
Example 11.7 Use the big-M method to solve LP (11.27) from Example 11.3:
z x1 x2 x3 e1 e2 s3 a1 a2 rhs Basis
1 −M − 1 −5M + 2 −5M − 3 M M 0 0 0 −18M z
0 −2 3 4 −1 0 0 1 0 12 a1
0 3 2 1 0 −1 0 0 1 6 a2
0 1 1 1 0 0 1 0 0 9 s3
Step 1 tableau:
z x1 x2 x3 e1 e2 s3 a1 a2 rhs Basis
1 − 7M2+5 − 5M4−17 0 − M4+3 M 0 5M +3
4 0 −3M + 9 z
0 − 12 3
4 1 − 14 0 0 1
4 0 3 x3
0 7
2
5
4 0 1
4 −1 0 − 14 1 3 a2
0 3
2
1
4 0 1
4 0 1 − 14 0 6 s3
Step 2 tableau:
z x1 x2 x3 e1 e2 s3 a1 a2 rhs Basis
1 0 36
7 0 − 47 − 57 0 7M +4
7
7M +5
7
78
7 z
0 0 13
14 1 − 14
3
− 17 0 3
14
1
7
24
7 x3
0 1 5
14 0 1
14 − 27 0 − 14
1 2
7
6
7 x1
0 0 − 27 0 1
7
3
7 1 − 17 − 37 33
7 s3
Step 3 tableau:
z x1 x2 x3 e1 e2 s3 a1 a2 rhs Basis
1 0 14
3 0 − 13 0 5
3
3M +1
3 M 19 z
0 0 5
6 1 − 16 0 1
3
1
6 0 5 x3
0 1 1
6 0 1
6 0 2
3 − 16 0 4 x1
0 0 − 23 0 1
3 1 7
3 − 13 −1 11 e2
Step 4 tableau:
z x1 x2 x3 e1 e2 s3 a1 a2 rhs Basis
1 2 5 0 0 0 3 M M 27 z
0 1 1 1 0 0 1 0 0 9 x3
0 6 1 0 1 0 4 −1 0 24 e1
0 −2 −1 0 0 1 1 0 −1 3 e2
266 Numerical Methods and Optimization: An Introduction
Proof. The proof follows from the analysis of the two-phase simplex method
above. If an LP has a feasible solution, then Phase I of the two-phase simplex
method will find a basic feasible solution. If the LP is optimal, then Phase II
of the two-phase simplex method will find a basic optimal solution. If the LP
has no optimal solution and was not proved infeasible at Phase I of the two-
phase simplex method, then we start Phase II. Phase II will always terminate
if, e.g., we use Bland’s rule to avoid cycling. If the LP is not optimal, Phase
II will prove that the problem is unbounded, since this is the only remaining
possibility.
in the form
n
maximize c j xj
j=1
n
(11.31)
subject to aij xj ≤ bi , i = 1, . . . , m
j=1
xj ≥ 0, j = 1, . . . , n.
Before solving the problem using the simplex method, we introduce the slack
variables xn+1 , xn+2 , . . . , xn+m and write this problem in the standard form,
maximize cT x
subject to Ax = b (11.32)
x ≥ 0.
Then matrix A has m rows and n + m columns, the last m of which form the
m × m identity matrix Im . Vector x has length n + m and vector b has length
m. Vector c has length n + m, with its last m components being zeros.
Next, we will apply the simplex method to this problem, however, this time
the computations will be done using a matrix representation of the data at
each step. The resulting method is referred to as the revised simplex method.
To facilitate the discussion, we will illustrate the underlying ideas using the
following LP:
and
Ax = BxB + N xN = b, (11.36)
respectively, where
xB = the vector of basic variables listed in the increasing order of their
indices;
xN = the vector of nonbasic variables listed in the increasing order of
their indices;
cB = the vector consisting of the components of c that correspond to
the basic variables, listed in the increasing order of their indices;
cTN = the vector consisting of the components of c that correspond to the
nonbasic variables, listed in the increasing order of their indices;
B = the matrix whose columns are the columns of A that correspond to
the basic variables, listed in the increasing order of their indices;
N = the matrix whose columns are the columns of A that correspond
to the nonbasic variables, listed in the increasing order of their
indices.
For example, for LP (11.33) at step 0 of the simplex method we have:
⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎡ ⎤
x4 0 1 0 0 4
xB = ⎣ x 5 ⎦ , c B = ⎣ 0 ⎦ , B = ⎣ 0 1 0 ⎦ , x̃B = ⎣ 6 ⎦ ,
x6 0 0 0 1 8
⎡ ⎤ ⎡ ⎤ ⎡ ⎤
x1 4 1 2 2
xN = ⎣ x2 ⎦ , cN = ⎣ 3 ⎦ , N = ⎣ 3 0 4 ⎦.
x3 5 2 1 4
Note that B is given by the 3 × 3 identity matrix and is clearly nonsingular.
Next we show that matrix B will remain nonsingular for any basis obtained
during the execution of the simplex method.
Note that the proof above is constructive and allows one to easily extract
B −1 from the simplex tableau, as illustrated in the following example.
z x1 x2 s1 s2 s3 s4 rhs Basis
1 −15 −25 0 0 0 0 0 z
0 1 1 1 0 0 0 450 s1
(11.37)
0 0 1 0 1 0 0 300 s2
0 4 5 0 0 1 0 2, 000 s3
0 1 0 0 0 0 1 350 s4
270 Numerical Methods and Optimization: An Introduction
After two steps of the simplex method we had the following tableau:
z x1 x2 s1 s2 s3 s4 rhs Basis
1 0 0 0 25/4 15/4 0 9, 375 z
0 0 0 1 1/4 −1/4 0 25 s1
(11.38)
0 0 1 0 1 0 0 300 x2
0 1 0 0 −5/4 1/4 0 125 x1
0 0 0 0 5/4 −1/4 1 225 s4
Rearranging the rows of this tableau so that the matrix comprised of the
columns corresponding to the basic variables x1 , x2 , s1 , and s4 is the 4 × 4
identity matrix, we obtain:
z x1 x2 s1 s2 s3 s4 rhs Basis
1 0 0 0 25/4 15/4 0 9, 375 z
0 1 0 0 −5/4 1/4 0 125 x1
(11.39)
0 0 1 0 1 0 0 300 x2
0 0 0 1 1/4 −1/4 0 25 s1
0 0 0 0 5/4 −1/4 1 225 s4
and its inverse can be read from the columns for s1 , s2 , s3 , and s4 in (11.39):
⎡ ⎤
0 −5/4 1/4 0
⎢ 0 1 0 0 ⎥
B −1 = ⎢⎣ 1 1/4 −1/4
⎥. (11.41)
0 ⎦
0 5/4 −1/4 1
This is easy to verify by checking that the product of the matrices in (11.40)
and (11.41) gives the 4 × 4 identity matrix.
xB = B −1 b − B −1 N xN .
Writing the tableau for the same basis, we obtain the revised tableau:
z xB xN rhs
1 0 −(cTN − cTB B −1 N ) cTB B −1 b (RT)
−1 −1
0 Im B N B b
Note that the formulas in (RD) and (RT) are valid for any LP in the stan-
dard form (11.32), as long as it has a basic solution, which ensures that B is
nonsingular for every basic solution.
We will use the matrix representation of the dictionary (RD) or of the
tableau (RT) to carry out the steps of the revised simplex method. Let us
consider the tableau form (RT) to motivate the method. With the “usual”
simplex method, at each step of the method we update the data in (RT) by
applying certain elementary row operations to the tableau computed at the
previous step. However, note that we do not need to know every single en-
try of the tableau in order to determine the entering and leaving variables,
which is the only information needed to update the basis. The main reason
for computing the whole tableau at each step was due to the fact that parts of
the tableau that may not be used at the current step may become necessary
at further steps. But, as we can see from (RT), the information required to
perform a pivot may be obtained using the input data given by A, b, and c
directly, rather than using the output from the previous step. We will demon-
strate how the corresponding computations can be carried out using the LP
given in (11.33), with c, A, and b as in (11.34):
⎡ ⎤ ⎡ ⎤
1 2 2 1 0 0 4
cT = [4, 3, 5, 0, 0, 0], A=⎣ 3 0 4 0 1 0 ⎦, b = ⎣ 6 ⎦ . (11.42)
2 1 4 0 0 1 8
Here x̃B is the vector storing the values of the basic variables in the current
basic feasible solution.
Step 1. Since the initial values of B and cB are given by the 3 × 3 identity
matrix and the 3-dimensional 0 vector, the formulas in (RT) simplify to the
following:
z xB xN rhs
1 0 −cTN 0 (RT-1)
0 Im N b
Choosing the entering variable. At the first step, selecting the entering
variable is easy; we just take a variable corresponding to the highest positive
coefficient in cN , which is x3 in our case.
Choosing the leaving variable. We select the leaving variable based on the
ratio test, which is performed by considering the components of the vector of
right-hand sides given by x̃B that correspond to positive entries of the column
of N representing the entering variable, x3 . Let us denote this column by Nx3 .
Then we have:
Updating the basic feasible solution. The information used for the ratio
test is also sufficient for determining the values of the new vector x̃B . For the
entering variable, x̃3 is given by the minimum ratio value, i.e., x̃3 = 3/2. As for
the remaining components of x̃B , for each basic variable xj they are computed
based on the following observation. To perform the pivot, we would apply the
elementary row operation which, in order to eliminate x3 from the xj -row,
multiplies the x5 -row (i.e., the row where x5 was basic) by the coefficient for
x3 in the xj -row divided by 4 and then subtracts the result from the xj -row.
When this elementary row operation is applied to the right-hand side column,
we obtain:
x̃3 = 3/2
x̃4 = 4 − 2(6/4) = 1
x̃6 = 8 − 4(6/4) = 2.
In summary, we have the following step 1 output:
⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎡ ⎤
x3 5 2 1 0 3/2
xB = ⎣ x4 ⎦ , cB = ⎣ 0 ⎦ , B = ⎣ 4 0 0 ⎦, x̃B = ⎣ 1 ⎦ ,
x6 0 4 0 1 2
The Simplex Method for Linear Programming 273
⎡ ⎤ ⎡ ⎤ ⎡ ⎤
x1 4 1 2 0
xN = ⎣ x2 ⎦ , cN = ⎣ 3 ⎦ , N = ⎣ 3 0 1 ⎦ .
x5 0 2 1 0
Step 2. In order to carry out the necessary computations, we will use the
formulas in (RT) written as follows:
z xB xN rhs
1 0 −c̃N = −(cTN − cTB B −1 N ) z̃ = cTB B −1 b (RT-2)
0 Im Ñ = B −1 N x̃B = B −1 b
B T u = cB .
We have
⎡ ⎤⎡ ⎤ ⎡ ⎤ ⎡ ⎤
2 4 4 u1 5 0
⎣ 1 0 0 ⎦ ⎣ u2 ⎦ = ⎣ 0 ⎦ ⇔ u = ⎣ 5/4 ⎦ ,
0 0 1 u3 0 0
so,
⎡ ⎤
1 2 0
c̃TN = cTN − uT N = [4, 3, 0] − [0, 5/4, 0] ⎣ 3 0 1 ⎦ = [1/4, 3, −5/4],
2 1 0
Ñx2 = B −1 × Nx2 .
z xB xN rhs
1 0 −c̃N = −(cTN − cTB B −1 N ) z̃ = cTB B −1 b (RT-3)
0 Im Ñ = B −1 N x̃B = B −1 b
and
⎡ ⎤
1 1 0
c̃TN = cTN − uT N = [4, 0, 0] − [3/2, 1/2, 0] ⎣ 3 0 1 ⎦ = [1, −3/2, −1/2]
2 0 0
The Simplex Method for Linear Programming 275
Ñx1 = B −1 × Nx1 .
Since none of the components of c̃TN is positive, this is a basic optimal solution.
We have ⎡ ⎤
2
x∗B = x̃B = ⎣ 1 ⎦ ,
3
so,
x∗ = [2, 1, 0, 0, 0, 3]T , z ∗ = cT x∗ = 11.
The final answer for the original variables is
After introducing the slack variables xn+1 , xn+2 , . . . , xn+m we write this prob-
lem in the standard form:
maximize cT x
subject to Ax = b (11.44)
x ≥ 0.
The matrix A has m rows and n + m columns, and we may potentially have
m+n (m + n)!
K= =
m m! n!
(n + 1)(n + 2) · . . . · 2n n + i
n
(2n)!
K= = = ≥ 2n .
(n!) 2 1 · 2 · ... · n i=1
i
Thus, the number of basic feasible solutions may be exponential with respect
to the problem input size. If there existed an LP with K basic feasible solu-
tions, and if the simplex method would have to visit each basic feasible solution
The Simplex Method for Linear Programming 277
before terminating, this would imply that the simplex method requires an ex-
ponential number of steps in the worst case. Unfortunately, such examples
have been constructed for various strategies for selecting leaving and enter-
ing variables in the simplex method. The first such example was constructed
by Klee and Minty in 1972, and is widely known as the Klee-Minty problem,
which can be formulated as follows:
m
10m−j xj
P
maximize
j=1
i−1
(11.45)
10i−j xj ≤ 100i−1 ,
P
subject to xi + 2 i = 1, . . . , m
j=1
xj ≥ 0, j = 1, . . . , m.
If the entering variable is always selected to be the nonbasic variable with the
highest coefficient in the objective (written in the dictionary format), then the
simplex method will visit each of the 2m basic feasible solutions of this LP.
It is still unknown whether a variation of the simplex method can be de-
veloped that would be guaranteed to terminate in a number of steps bounded
by a polynomial function of the problem’s input size. It should be noted that
all currently known polynomial time algorithms for linear optimization prob-
lems, such as the ellipsoid method and the interior point methods, are based
on the approaches that treat linear programs as continuous convex optimiza-
tion problems, whereas the simplex method exploits the discrete nature of an
LP’s extreme points along with the fact that any optimal LP has an optimal
solution at an extreme point.
Exercises
11.1. Write the following problems as LPs in the standard form:
(a) maximize 2x1 + 3x2 − 3x3
subject to x1 + x2 + x3 ≤ 7
x2 − x3 ≤ 5
−x1 + x2 + 4x3 ≥ 4
x1 ∈ IR, x2 , x3 ≥ 0
(b) minimize |x1 | + 2|x2 |
subject to 2x1 + 3x2 ≤ 4
5|x1 | − 6x2 ≤ 7
8x1 + 9x2 ≥ 10
x1 , x2 ∈ IR.
11.5. Use the simplex method to solve the Klee-Minty LP (11.45) at page 277
for m = 3. Always select the nonbasic variable with the highest co-
efficient in the objective as the entering variable. Illustrate your steps
geometrically.
The Simplex Method for Linear Programming 279
11.6. Explain how the simplex algorithm can be used for finding the second-
best basic feasible solution to an LP. Then find the second best bfs for
problems (a) and (b) in Exercise 11.3.
11.9. Use the revised simplex method to solve LPs (a) and (b) in Exercise 11.3.
This page intentionally left blank
Chapter 12
Duality and Sensitivity Analysis in
Linear Programming
In addition, the annual demand for Dynamo and Spartacus shoes is limited
to 1,000 pairs each. The LP that SuperCleats Inc. solves in order to decide
on the quantity of each shoe model to manufacture so that its overall profit
is maximized is given by
281
282 Numerical Methods and Optimization: An Introduction
that is,
15y1 + 35y2 + 5y3 + y4 ≥ 100
10y1 + 22y2 + 5y3 + y5 ≥ 80
8y1 + 18y2 + 4y3 ≥ 60
5y1 + 10y2 + 4y3 ≥ 50,
then we have
To get the lowest possible upper bound on z this way, we need to solve the
following LP:
maximize c 1 x1 + ... + c n xn
subject to a11 x1 + ... + a1n xn ≤ b1
.. .. .. ..
. . . .
am1 x1 + ... + amn xn ≤ bm
x1 , . . . , x n ≥ 0
or
n
maximize c j xj
j=1
n
subjectto aij xj ≤ bi , i = 1, . . . , m
j=1
x1 , . . . , xn ≥ 0,
then its dual LP is
minimize b1 y1 + ... + bm ym
subject to a11 y1 + ... + am1 ym ≥ c1
.. .. .. ..
. . . .
a1n y1 + ... + amn ym ≥ cn
y1 , . . . , y m ≥ 0
284 Numerical Methods and Optimization: An Introduction
or
m
minimize bi y i
i=1
m
subject to aij yi ≥ cj , j = 1, . . . , n
i=1
y1 , . . . , y m ≥ 0.
Primal LP Dual LP
maximize cT x minimize bT y
subject to Ax ≤ b subject to AT y ≥ c
x ≥ 0 y ≥ 0
In order to use the rules for forming the dual that we already know, we equiv-
alently represent this equality by two inequality constraints,
Let y and y be the dual variable for the first and the second constraints
Duality and Sensitivity Analysis in Linear Programming 285
or, equivalently,
minimize 10(y − y )
subject to 7(y − y ) ≥ −1
−8(y − y ) ≥ −2
9(y − y ) ≥ −3
y , y ≥ 0.
Since y and y always appear together, with the same absolute value but
opposite sign coefficients, we can make the following change of variables:
y = y − y .
minimize 10y
subject to 7y ≥ −1
−8y ≥ −2
9y ≥ −3
y ∈ IR.
m
maximize (−bi )yi
i=1
m
(12.5)
subject to (−aij )yi ≤ −cj , j = 1, . . . , n
i=1
y1 , . . . , y m ≥ 0
n
minimize (−cj )xj
j=1
n
(12.6)
subject to (−aij )xj ≥ −bi , i = 1, . . . , m
j=1
x1 , . . . , x n ≥ 0.
n
maximize c j xj
j=1
n
(12.7)
subject to aij xj ≤ bi , i = 1, . . . , m
j=1
x1 , . . . , x n ≥ 0,
Taking into account that the dual of the dual gives the primal LP, we
have the following summary of the correspondence between the constraints
and variables of the primal and dual LPs, which can be used as rules for
forming the dual for a given primal LP. We assume that the primal LP is a
maximization problem and the dual LP is a minimization problem.
Primal LP Dual LP
Equality constraint ↔ Free variable
Inequality constraint (≤) ↔ Nonnegative variable
Free variable ↔ Equality constraint
Nonnegative variable ↔ Inequality constraint (≥)
Duality and Sensitivity Analysis in Linear Programming 287
maximize 2x1 + x2
subject to x1 + x2 = 2
2x1 − x2 ≥ 3
x1 − x2 ≤ 1
x1 ≥ 0, x2 ∈ IR
is given by
m ⎛ ⎞
n
n
m n
m
c j xj ≤ aij yi xj = ⎝ aij xj ⎠ yi ≤ bi y i . (12.8)
j=1 j=1 i=1 i=1 j=1 i=1
Hence, for any feasible solution x to the primal LP and any feasible solution
y to the dual LP we have the property of weak duality:
n
m
z= cj xj ≤ bi yi = w.
j=1 i=1
n
m
cj x∗j = bi yi∗ ,
j=1 i=1
constraint is a “≤” constraint, and let ai be the artificial variable for the ith
constraint if the ith constraint is a “=” constraint used in the big-M method.
Then the following table represents the correspondence between the optimal
value yi∗ of the dual variable corresponding to the ith constraint and the co-
efficients of si or ai in row 0 of the optimal tableau.
ith yi ∗
constraint type (found in row 0 of the
in the primal LP optimal primal LP tableau)
≤ → coefficient of si
= → (coefficient of ai )−M
(Note that this correspondence is for the tableau format; sign changes would
have to be made in the dictionary format).
Dual LP
Optimal Infeasible Unbounded
Let x∗ and y ∗ be optimal solutions to the primal problem (P) and the dual
problem (D), respectively. Then the strong duality holds,
n
m
cj x∗j = bi yi∗ ,
j=1 i=1
Note that the equality in the inequality (a) above is possible if and only if for
m
every j = 1, . . . , n, either x∗j = 0 or cj = aij yi∗ . Similarly, the equality in
i=1
the inequality (b) above is possible if and only if for every i = 1, . . . , m, either
n
yi∗ = 0 or bi = aij x∗j . Thus we obtain the following result.
j=1
and
n
yi∗ = 0 or aij x∗j = bi for all i = 1, . . . , m. (12.14)
j=1
n
• if aij x∗j < bj then yi∗ = 0; i = 1, . . . , m,
j=1
m
• aij yi∗ ≥ cj , j = 1, . . . , n, and
i=1
• yi∗ ≥ 0, i = 1, . . . , m.
Duality and Sensitivity Analysis in Linear Programming 293
We see that the 3rd , 4th , 5th , and 8th constraints are not binding, thus, due to
the complementary slackness, if x̃ is optimal for the primal problem, we must
have
ỹ3 = ỹ4 = ỹ5 = ỹ8 = 0
in an optimal solution ỹ of the dual problem.
Also observe that x̃1 , x̃3 , x̃4 , x̃6 , x̃7 are all positive, thus the 1st , 3rd , 4th ,
6th , and 7th constraints of the dual LP must be binding at an optimal point
ỹ. However, this is impossible since taking ỹ3 = ỹ4 = ỹ5 = ỹ8 = 0 in the
294 Numerical Methods and Optimization: An Introduction
in an optimal solution y ∗ of the dual problem. As with x̃, since the same
components of x∗ are positive, we must have the 1st , 3rd , 4th , 6th , and 7th
constraints of the dual LP binding at an optimal point y ∗ . Taking into account
that y3∗ = y4∗ = y8∗ = 0, this gives the following system:
y1∗ +y2∗ = 1
y5∗ = 1
y5∗ +y6∗ = 1
y1∗ +y6∗ +y7∗ = 1
y1∗ +y2∗ +y7∗ = 1.
y ∗ = [1, 0, 0, 0, 1, 0, 0, 0]T .
It remains to check that y ∗ satisfies the 2nd and 5th constraints of the dual
problem, and that the dual objective function value at y ∗ is 31, which is the
same as the primal objective function value at x∗ . We conclude that x∗ is
optimal for the primal problem and y ∗ is optimal for the dual problem.
Finally, note that the problem we considered in this example is the schedul-
ing LP formulated in Section 10.2.3 (page 215).
The optimal solution of the primal LP (12.15) is x∗1 = 18, x∗2 = 10. The optimal
solution of the dual LP (12.16) is y1∗ = 1.1, y2∗ = 2.1. The optimal objective
value of both the primal and dual LP is 20,400.
We start the analysis of the economic meaning of the dual LP by deter-
mining the units of measure for the dual variables y1 and y2 . Consider the
first constraint of the dual LP:
The coefficient for both y1 and y2 is 250 pounds/barrel, and the right-hand
side is 800 dollars/barrel. Thus, for the constraint to make a physical sense,
the units for both dual variables must be dollars/pound, meaning that y1 and
y2 express the cost of grapes.
Note that multiplying the first and the second constraint of the primal
LP (12.15) by y1∗ = 1.1 and y2∗ = 2.1, respectively, and then summing up the
left-hand sides of the resulting inequalities gives the primal objective function:
on the objective, in which the optimal value of the first dual variable y1∗ = 1.1
is the coefficient for the variable representing the extra Merlot grapes. The
extra profit added to the currently optimal profit of $20,400 will never exceed
1.1p1 , thus $1.1/pound is the maximum extra amount the winery should be
willing to pay for additional Merlot grapes.
Similarly, if the winery looks to purchase p2 more pounds of Cabernet
Sauvignon grapes, we obtain the upper bound
i.e.,
z ≤ 20, 400 + 2.1p2 ,
implying that the company should not pay more than $2.1/pound in addition
to what they already pay for Cabernet Sauvignon grapes. This quantity is
sometimes referred to as the shadow price.
Definition 12.1 The shadow price for the ith resource constraint of an
LP is defined as the amount by which the optimal objective function value
is improved if the right-hand side of this constraint is increased by 1.
D
z = 6, 000
'
120 K budget constraint
'
E
z = 3, 000
'
A F L M
0 125 200 350 400 450 500 x1
(see also Sections 11.2 and 11.3). The Heavenly Pouch LP is given by:
and its graphical solution is shown in Figure 12.1. The optimal solution is
x∗ = [125, 300]T , z ∗ = 9, 375. What happens to this solution if some of the
coefficients of the LP change? What changes to the problem parameters are
allowed if we require that the currently optimal basis must still remain optimal
after the changes take effect? These are some of the questions addressed using
sensitivity analysis.
First, we consider a situation when there is a change in one of the objective
function coefficients, say c1 , which corresponds to changing the profit obtained
from each non-reversible carrier. Currently, c1 = 15, and we consider changing
298 Numerical Methods and Optimization: An Introduction
z = 6, 000
'
120
budget constraint
E '
(Δ = −100)
z = 3, 000
'
A F L M
0 200 350 400 450475 x1
into E (see Figure 12.2). At this point, C is still the optimal solution, with
x∗1 = 100, x∗2 = 300, z ∗ = 9, 000. When Δ = −500, both C and G converge
to B (see Figure 12.3), which becomes the optimal point with x∗1 = 0, x∗2 =
300, z ∗ = 7, 500. If Δ keeps increasing in the absolute value after that, the
optimum will relocate to point G, which is the point on the intersection of the
budget constraint line and x2 axis. Thus, Δ = −500 gives the highest decrease
in the budget constraint’s right-hand side that does not alter the optimality
of the basis.
In summary, based on the graphical sensitivity analysis we conclude that
−500 ≤ Δ ≤ 100 is the allowable range of change for the budget constraint’s
right-hand side.
Next, we will discuss how the sensitivity analysis can be performed in
algebraic form. Unlike the graphical approach, these techniques can be applied
to LPs with an arbitrary number of variables. Therefore, we consider a general
300 Numerical Methods and Optimization: An Introduction
x2
H
450
120
z = 3, 000
'
E
A F M L
0 200 350 375 450 500 x1
z xB xN rhs
1 0 −(cTN − cTB B −1 N ) cTB B −1 b (12.19)
−1 −1
0 Im B N B b
More specifically, we will use the formulas in (12.19) to answer the following
important questions:
(1) Will the current basis still remain feasible after a given change in the
problem input data?
(2) Will the current basis still remain optimal after a given change in the
problem input data?
(3) How can we find a new optimal solution if the feasibility or optimality
of the optimal basis for the original LP is altered by the change in the
input data?
The first question can be addressed by checking whether the vector of the
right-hand sides of the constraints given by B −1 b in (12.19) has only nonneg-
ative entries. To answer the second question, we need to verify the signs of the
entries of nonbasic variable coefficients in the objective given by cTN −cTB B −1 N .
To address the third question, note that the types of changes we analyze can
be grouped into two categories, the first one being the changes that impact
optimality (determined based on cTN − cTB B −1 N ) of the current solution but
do not impact its feasibility (i.e., the sign of B −1 b entries), and the second
one representing the changes that may alter feasibility, but do not impact the
vector of nonbasic variable coefficients in row 0 of the optimal tableau. The
first group includes changing a coefficient in the objective function, introduc-
ing a new variable, changing the column of a nonbasic variable, and the second
group includes changing the right-hand side and introducing a new constraint.
Based on this classification, we will have two different recipes for dealing with
the third question.
We will illustrate the underlying ideas using the following LP, which was
solved using the revised simplex method in Section 11.6:
the coefficient aij for variable xj in the constraint i standing for the amount
of resource i used in the production of 1 unit of product j, and the right-hand
side bi in the constraint i representing the amount of resource i available;
i, j = 1, 2, 3. As before, let x4 , x5 , and x6 be the slack variables for (12.20).
The optimal basis for this problem consists of variables x1 , x2 , and x6 , and
the corresponding basic optimal solution is given by
We will refer to this solution and the corresponding basis as current. The
corresponding tableau is given by
z xB xN rhs
1 0 −c̃N = −(cTN − cTB B −1 N ) cTB B −1 b (12.21)
0 Im B −1 N x̃B = B −1 b
Assume that (12.21) represents the optimal tableau for LP (12.20), with
xTB = [x1 , x2 , x6 ],
x̃TB = [2, 1, 3], (12.22)
c̃TN = [−4/3, −3/2, −5/6],
z xB xN rhs
1 0 −c̄N = −(cTN − c TB B −1 N ) c TB B −1 b (12.24)
−1 −1
0 Im B N B b
z xB xN rhs
1 0 −c̄N = −(ccTN − cTB B −1 N ) cTB B −1 b (12.26)
−1 −1
0 Im B N B b
Hence, the objective function coefficients for nonbasic variables in the tableau
of the modified problem with the same basis as current are given by
c̄TN = c TN − cTB B −1 N,
where
we have:
c̄TN = c TN − cTB B −1 N
= cTN + [Δ, 0, 0] − cTB B −1 N
= cTN − cTB B −1 N + [Δ, 0, 0]
= [−4/3, −3/2, −5/6] + [Δ, 0, 0]
= [−4/3 + Δ, −3/2, −5/6].
z xB xN rhs
1 0 −c̄N = −(ccTN − cTB B −1 N ) cTB B −1 b (12.27)
−1 N −1
0 Im B N B b
Recall that (12.21) represents the optimal tableau for the original LP (12.20).
Then the tableau with the same basis for problem (12.28) is given by:
z xB xN rhs
1 0 −(cTN − cTB B −1 N ) cTB B −1b (12.29)
−1 −1 b
0 Im x̄ = B N B b
The corresponding values for basic variables are given by x̄ = B −1b . Thus, the
basic solution corresponding to the tableau (12.29) will be feasible if and only
if B −1b ≥ 0. Note that if this is the case, then this tableau is optimal (since
the coefficients for nonbasic variables are all nonpositive due to the optimality
of tableau (12.21) for problem (12.20)).
306 Numerical Methods and Optimization: An Introduction
z x1 x2 x3 x4 x5 x6 rhs Basis
4 3 5
1 0 0 3 2 6 0 23 z
4 1
0 1 0 3 0 3 0 2 x1 (12.31)
0 0 1 1
3
1
2 − 16 0 5 x2
0 0 0 1 − 12 − 12 1 −1 x6
The corresponding dual tableau is
−w y1 y2 y3 y4 y5 y6 rhs Basis
1 0 0 −1 2 5 0 −23 −w
0 1 0 1
2 0 − 12 0 3
2 y1 (12.32)
0 0 1 1
2 − 31 1
6 0 5
6 y2
0 0 0 −1 − 43 − 13 1 4
3 y6
We will apply the simplex method to find the optimal dual tableau. The
entering variable is y3 , the leaving variable is y2 , and the tableau after the
pivot is given by
Duality and Sensitivity Analysis in Linear Programming 307
−w y1 y2 y3 y4 y5 y6 rhs Basis
1 0 2 0 4
3
16
3 0 − 64
3 −w
0 1 −1 0 1
3 − 23 0 2
3 y1 (12.33)
0 0 2 1 − 23 1
3 0 5
3 y3
0 0 2 0 −2 0 1 3 y6
This tableau is optimal with the solution y1∗ = 2/3; y2∗ = 0; y3∗ = 5/3. The
optimal solution for the primal problem (12.28) with Δ = 8 can be read from
row 0 of the optimal dual tableau:
z xB xN rhs
1 0 −(ccTN − cTB B −1N ) cTB B −1 b (12.35)
−1 N −1
0 Im B N B b
This means that the basis x1 , x2 , x7 remains optimal, and the optimal solution
is the same as for the original problem. Thus, x4 = 0, meaning that we should
not produce the new product.
In general, even if c̄4 was positive, the tableau with the same basis would
still be feasible, even though it would not be optimal anymore. We could apply
the simplex method starting with this feasible tableau to obtain a solution to
the modified problem.
1 2 0 1 6 0 4 0 0
z xB xN rhs
1 0 −(cTN − c TB B −1N ) c TB B −1b (12.37)
0 Im B −1N
B N B −1b
B b
From (12.37) it appears that introducing the new constraint causes changes to
both the vector of nonbasic variable coefficients and the vector of right-hand
sides. However, next we show that, in fact, cTN −ccTB B −1N = cTN − cTB B −1 N, so
only the feasibility can be impacted by adding a new constraint. To compute
c TB B −1N , we first compute uT = c TB B −1 by solving the system B T u = c B and
then computing uT N .
⎡ ⎤⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎡ ⎤
1 3 2 1 u1 4 u1 3/2
⎢ 2 0 1 2 ⎥ ⎢ u2 ⎥ ⎢ 3 ⎥ ⎢ u2 ⎥ ⎢ 5/6 ⎥
BT u = ⎢ ⎥⎢ ⎥ ⎢ ⎥ ⎢
⎣ 0 0 1 0 ⎦ ⎣ u3 ⎦ = ⎣ 0 ⎦ ⇔ ⎣ u3 ⎦ = ⎣ 0 ⎦ ,
⎥ ⎢ ⎥
0 0 0 1 u4 0 u4 0
and ⎡ ⎤
2 1 0
⎢ 4 0 1 ⎥
u N = [3/2, 5/6, 0, 0] ⎢
T
⎣ 4
⎥ = [19/3, 3/2, 5/6].
0 0 ⎦
4 0 0
Recall that cTN = [5, 0, 0], so,
cTN − c TB B −1 N = [5, 0, 0] − [19/3, 3/2, 5/6] = [−4/3, −3/2, −5/6],
which is the same as the vector of coefficients c̃N = cTN −cTB B −1 N for nonbasic
variables in the optimal tableau of the original problem. Note that this will
always be the case if we add a new constraint, i.e., the vector of the coefficients
for nonbasic variables in the optimal tableau of the original problem and the
vector of the coefficients for nonbasic variables in the corresponding tableau
of the modified problem will be the same:
cTN − c TB B −1N = cTN − cTB B −1 N.
Hence, (12.37) is equivalent to
z xB xN rhs
1 0 −(cTN − cTB B −1 N ) cTB B −1 b (12.38)
0 Im B −1N
B N x̄ = BB −1b b
and since row 0 is not affected by the change, the corresponding dual tableau
is feasible and we can use it to solve the dual of the modified problem to
optimality.
310 Numerical Methods and Optimization: An Introduction
12.7.7 Summary
While performing the sensitivity analysis above, we saw that with the
following modifications:
the optimal basis still remains feasible. Then, if the basis is not optimal, we
can apply the simplex method starting with this basis and find a new optimal
solution.
With the following modifications:
the dual optimal basis still remains feasible. Then, if the dual tableau is not
optimal, we can apply the simplex method starting with this basis to solve the
dual problem. We can then extract the optimal solution of the primal problem
from the optimal dual tableau.
Exercises
12.1. Write the dual for each of the following LPs:
(a) maximize x1 + 2x2 − 3x3
subject to 4x1 + 5x2 + x3 ≤ 6
7x1 + x2 ≤ 8
9x2 + x3 = 10
x1 ≥ 0, x2 , x3 ∈ IR
(b) minimize 8x1 + 4x2 − 2x3
subject to x1 + 3x2 ≤ 5
6x1 − 7x2 + 8x3 = 7
x1 ∈ IR, x2 , x3 ≥ 0
(c) maximize 9x1 − 7x2 + 5x3
subject to 3x1 + x2 − x3 ≤ 2
4x1 − 6x2 + 3x3 ≥ 8
x1 + 2x2 + x3 = 11
x1 ∈ IR, x2 , x3 ≥ 0.
Duality and Sensitivity Analysis in Linear Programming 311
12.2. Write down the dual of the LP formulated for the diet problem in Ex-
ample 10.2 (page 213). Provide an economic interpretation of the dual
LP.
12.3. Prove or disprove each of the following statements concerning a primal
LP,
maximize z = cT x subject to Ax ≤ b, x ≥ 0
and the corresponding dual LP,
minimize w = bT y subject to AT y ≥ c, y ≥ 0.
z x1 x2 x3 s1 s2 rhs
1 8/5 0 ? 7/5 3/5 ?
z x1 x2 x3 s1 s2 rhs
1 ? 1 0 2 ? 14
312 Numerical Methods and Optimization: An Introduction
where
maximize x1 + 2x2
subject to x1 + 5x2 ≤ 5
3x1 + 2x2 ≤ 6
5x1 + x2 ≤ 5
x 1 , x2 ≥ 0.
z x1 x2 x3 s1 s2 rhs
1 0 0 33/7 2/7 10/7 8
0 0 1 5/7 2/7 3/7 3
0 1 0 1/7 −1/7 2/7 1
(a) Write the dual to this LP and use the above tableau to find the
dual optimal solution.
(b) Find the range of values of the objective function coefficient of x2
for which the current basis remains optimal.
(c) Find the range of values of the objective function coefficients of x3
for which the current basis remains optimal.
(d) Find the range of values of the right-hand side of the first constraint
for which the current basis remains optimal.
(e) What will be the optimal solution to this LP if the right-hand side
of the first constraint is changed from 3 to 8?
12.10. Use the LP and its optimal tableau given in Exercise 12.9 to solve the
following LPs:
(a) maximize 2x1 + 2x2 − 2x3
subject to −3x1 + 2x2 + 2x3 ≤ 3
2x1 + x2 + 2x3 ≤ 5
x 1 , x2 , x3 ≥ 0
(b) maximize 5x1 + 2x2 − 3x3
subject to −3x1 + 2x2 + x3 ≤ 3
2x1 + x2 + x3 ≤ 5
x 1 , x2 , x3 ≥ 0
(c) maximize 2x1 + 2x2 − 3x3 + 3x4
subject to −3x1 + 2x2 + x3 + 3x4 ≤ 3
2x1 + x2 + x3 + 2x4 ≤ 5
x 1 , x2 , x3 , x4 ≥ 0.
12.11. Use the LP and its optimal tableau given in Exercise 12.9 to solve the
following LPs:
(a) maximize 2x1 + 2x2 − 3x3
subject to −3x1 + 2x2 + x3 ≤ 3
2x1 + x2 + x3 ≤ 1
x 1 , x2 , x3 ≥ 0,
(b) maximize 2x1 + 2x2 − 3x3
subject to −3x1 + 2x2 + x3 ≤ 3
2x1 + x2 + x3 ≤ 5
−x1 + 2x2 + x3 ≤ 4
x 1 , x2 , x3 ≥ 0.
314 Numerical Methods and Optimization: An Introduction
z x1 x2 x3 s1 s2 rhs
1 11 0 0 9/4 15/8 6
0 2 1 0 1/2 1/4 1
0 2 0 1 1/4 3/8 1
(a) Write the dual to this LP and use the above tableau to find the
dual optimal solution.
(b) Find the range of values of the objective function coefficient of x1
for which the current basis remains optimal.
(c) Find the range of values of the objective function coefficients of x2
for which the current basis remains optimal.
(d) Find the range of values of the right-hand side of the second con-
straint for which the current basis remains optimal.
(e) Extract B −1 from the optimal tableau.
Product
Resource 1 2 3
I (units) 3 2 4
II (units) 4 2 3
Price ($) 10 7 12
The optimal solution to this LP is x∗1 = 0, x∗2 = 20, x∗3 = 20, r∗ = 120
with the optimal objective function value z ∗ = 260. Sensitivity analysis
yielded results summarized in the tables below.
(a) Write down the dual of this LP. What is its optimal solution?
(b) What is the most the company should be willing to pay for an
additional unit of resource I?
(c) What is the most the company should be willing to pay for another
unit of resource II?
(d) What selling price of product 1 would make it reasonable for the
company to manufacture it?
(e) What would the company’s profit be if 110 units of resource I was
available?
(f) What would the company’s profit be if 130 units of resource II
could be purchased?
(g) Find the new optimal solution if product 3 sold for $13.
This page intentionally left blank
Chapter 13
Unconstrained Optimization
minimize f (x),
317
318 Numerical Methods and Optimization: An Introduction
minimize f (x)
(13.1)
subject to x ∈ X,
∇f (x∗ )T d ≥ 0.
Indeed, if we assume f (x∗ )T d < 0, then selecting such that f (x∗ ) ≤ f (x)
for any x ∈ B(x∗ , ) and the error term o(α) ∗ T
α in (13.3) is less than |f (x ) d|
∗
(such exists since x is a local minimizer and by definition of o(α)) would
result in f (x) − f (x∗ ) < 0. We obtain a contradiction with the assumption
that f (x∗ ) ≤ f (x) for any x ∈ B(x∗ , ).
As a corollary of Theorem 13.1, we get the following result.
The following example shows that the FONC is not sufficient for a local
minimizer.
f (x) = 3x2 = 0 ⇔ x = 0.
But, obviously, x = 0 is not a local minimizer of f (x). In fact, for any given
point x and any small > 0, there always exist x∗ , x∗ ∈ B(x∗ , ) such that
f (x∗ ) < f (x) < f (x∗ ), so f (x) does not have any local or global minimum or
maximum.
Next, we prove that a point satisfying the FONC is, in fact, a global
minimizer if a problem is convex. The proof is based on the first-order char-
acterization of a convex function. Consider a convex problem min f (x). For
x∈X
any x, y ∈ X, a differentiable convex function satisfies
f (y) ≥ f (x∗ )
Proof. We assume that x∗ satisfies the FONC and SONC. Then, for any
d ∈ IRn with d = 1 and any α > 0 we have
f (x∗ + αd) − f (x∗ ) 1 T 2 ∗ o(α2 )
= d ∇ f (x )d + .
α2 2 α2
322 Numerical Methods and Optimization: An Introduction
Example 13.3 Consider the function f (x) = x31 − x32 + 3x1 x2 . We apply the
optimality conditions above to find its local optima. FONC system for this
problem is given by
3x21 + 3x2 0
∇f (x) = = .
−3x22 + 3x1 0
From the second equation of this system we have x1 = x22 . Substituting for x1
in the first equation gives x42 + x2 = 0, which yields x2 = 0 or x2 = −1. The
corresponding stationary points are x̂ = [0, 0]T and x̃ = [1, −1]T , respectively.
The Hessian of f (x) is
6x1 3 0 3 6 3
∇2 f (x) = ⇒ ∇2 f (x̂) = ; ∇2 f (x̃) = .
3 −6x2 3 0 3 6
Since the determinant of ∇2 f (x̂) equals −9, the Hessian is indefinite at x̂,
and from the SONC, x̂ cannot be a local optimum. On the other hand, ∇2 f (x̃)
is positive definite, hence x̃ is a strict local minimum by the SOSC. Note that
if we fix x2 = 0, the function f is then given by x31 , which is unbounded from
below or above. Thus, f has no global minima and no local or global maxima.
Its only local minimum is x̃ = [1, −1]T .
a1 − a0 = b0 − b1 = ρ(b0 − a0 ),
where ρ < 1/2. If f (a1 ) < f (b1 ), then the minimizer is in the interval [a0 , b1 ].
Otherwise, if f (a1 ) > f (b1 ), then the minimizer is in [a1 , b0 ] (see Figure 13.1).
Thus, the range of uncertainty will be reduced by the factor of (1 − ρ), and
we can continue the search using the same method over a smaller interval.
In the golden section search method, we want to reduce the number of
function evaluations by using previously computed intermediate points. Con-
sider the example shown in Figure 13.1. In this example, f (a1 ) < f (b1 ), so
the range of uncertainty reduces to the interval [a0 , b1 ]. To continue the pro-
cess, we need to choose two points in [a0 , b1 ] and evaluate f in these points.
However, we know that a1 ∈ [a0 , b1 ]. So, a1 can be chosen as one of the two
324 Numerical Methods and Optimization: An Introduction
a0 a2 x∗ a1 b1 b0
b2
points: b2 = a1 , and it suffices to find only one new point a2 , which would be
as far from a0 , as b2 is from b1 . The advantage of such a choice of intermediate
points is that in the next iteration we would have to evaluate f only in one
new point, a2 . Now we need to compute the value of ρ which would result in
having a1 chosen as one of the intermediate points. Figure 13.2 illustrates this
situation: If we assume that the length of [a0 , b0 ] is l, and the length of [a0 , b1 ]
is d, then we have
d = (1 − ρ)l,
so
d
l= .
1−ρ
On the other hand, if we consider the interval [a0 , a1 ] = [a0 , b2 ], then its length
can be expressed in two different ways:
ρl = (1 − ρ)d.
ρ2 − 3ρ + 1 = 0.
Unconstrained Optimization 325
d = (1 − ρ)l -
a0 a2 a1 b1 b0
b2
l = b0 − a 0 -
Taking into account that we are looking for ρ < 1/2, we obtain the solution
√
3− 5
ρ= ≈ 0.382.
2
Note that the uncertainty interval is reduced by the factor of 1 − ρ ≈ 0.618 at
each step. So, in N steps the reduction factor would be
(1 − ρ)n ≈ 0.618N .
Proof. Note that using (13.10) we can recursively express all variables ρk , k =
1, . . . , N in the objective function of (13.9) through one of the variables, say
ρN . If we denote the resulting univariate function by fN (ρN ), then
1 − ρN
fN (ρN ) = , N ≥ 2. (13.12)
FN − FN −2 ρN
1 − ρK
=
2FK−1 − FK−3 − (FK−1 − FK−3 )ρK
1 − ρK
= ,
FK − FK−2 ρK
−FN + FN −2 −FN −1 1
fN (ρN ) = = < 0, ∀ρN ≤ .
(FN − FN −2 ρN )2 (FN − FN −2 ρN )2 2
Therefore,
1 − 1/2 1
min fN (ρN ) = fN (1/2) = = ,
ρN ∈[0,1/2] FN − FN −2 /2 FN +1
which means that the reduction factor after N steps of the Fibonacci search
is
1
.
FN +1
Unconstrained Optimization 327
The direction d(k) in a line search iteration is typically selected based on the
gradient ∇f (x(k) ), leading to gradient methods, such as the method of steepest
descent discussed in Section 13.4.
328 Numerical Methods and Optimization: An Introduction
Let d(k) be a solution of this problem. If the decrease in the value of f going
from x(k) to x(k+1) = x(k) + d(k) is not sufficient, we conclude that the ap-
proximation is not good enough, perhaps because the region T is too large.
Therefore, we shrink the trust region and resolve the problem. We stop if
we are not able to get a meaningful decrease in the objective after a certain
number of attempts.
In the reminder of this chapter we discuss line search methods for uncon-
strained optimization.
∇f (x(0) )T d.
where equality is possible if and only if d = −α∇f (x(0) ) with α ≥ 0. So, the
Unconstrained Optimization 329
Proof. Consider φk (α) = f (x(k) −α∇k ). Since in the steepest descent method
αk minimizes φk (α) for α > 0, by the FONC
φk (αk ) = 0.
On the other hand, using the chain rule:
df (x(k) − α∇k )
φk (αk ) = = ∇Tk+1 ∇k .
dα α=αk
330 Numerical Methods and Optimization: An Introduction
In the proof, we have shown that if we apply the method of steepest de-
scent, then
∇Tk ∇k+1 = 0, k ≥ 0.
Thus, the gradients of f in two consecutive points generated by the steepest
descent are orthogonal to each other. Since the negative of the gradient rep-
resents the direction we move along at each iteration of the steepest descent,
this means that the directions in the two consecutive steps are orthogonal as
well. Indeed,
∇k = ∇f (x(k) ) = Qx(k) + c,
x(k+1) = x(k) − αk ∇k ,
with
αk = arg min{φk (α)},
α≥0
Unconstrained Optimization 331
where
φk (α) = f (x(k) − α∇k ); ∇k = Qx(k) + c.
We have
1 (k)
φk (α) = (x − α∇k )T Q(x(k) − α∇k ) + cT (x(k) − α∇k )
2
1 T $ %
= α 2
∇ Q∇k − α ∇Tk ∇k + f (x(k) ).
2 k
∇Tk ∇k
αk = .
∇Tk Q∇k
Therefore, an iteration of the steepest descent method for the convex quadratic
function f (x) = 12 xT Qx + cT x is
∇Tk ∇k
x(k+1) = x(k) − ∇k , k ≥ 0.
∇Tk Q∇k
n
Example 13.4 For f (x) = x2i = xT x = x2 , we have Q = 2In , where
i=1
In is the n × n identity matrix, c = 0, and for any x(0) ∈ IRn ,
1
q(x) = (x − x∗ )T Q(x − x∗ ) (13.13)
2
332 Numerical Methods and Optimization: An Introduction
in our analysis. It is easy to check that q(x) = f (x) + 12 x∗ T Qx∗ , so the two
functions differ only by a constant. We denote by ∇k the gradient of q(x) at
point x(k) :
∇k = ∇q(x(k) ) = Q(x(k) − x∗ ). (13.14)
The steepest descent iteration for this function is
where
∇Tk ∇k
αk = . (13.16)
∇Tk Q∇k
Next, we prove that
λmin (Q)
q(x(k+1) ) ≤ q(x(k) ) 1 − ,
λmax (Q)
where λmin (Q) and λmax (Q) are the smallest and the largest eigenvalues of
Q, respectively. To show this, we first observe that
q(x(k+1) ) = 1
2 (x
(k)
− αk ∇k − x∗ )Q(x(k) − αk ∇k − x∗ )
= q(x(k) ) − αk ∇Tk Q(x(k) − x∗ ) + 12 αk2 ∇Tk Q∇k
∇T ∇ ∇ T ∇k
= q(x(k) ) 1 − ∇TkQ∇kk 1 (x(k) −x∗ )kT Q(x (k) −x∗ )
k 2
∇T ∇ 1
∇T Q∇
k
+ ( ∇TkQ∇kk )2 1 (x(k) −x
2 k
∗ )T Q(x(k) −x∗ )
4
k 2
k
∇k
4
= q(x(k) ) 1 − (∇T Q∇2
∇
)(∇ T Q−1 ∇ ) + (∇T Q∇ )(∇T Q−1 ∇ )
k k k k
k k k k
∇k
4
= q(x ) 1 − (∇T Q∇k )(∇T Q−1 ∇k ) .
(k)
k k
and
(∇Tk Q−1 ∇k ) ≤ λmax (Q−1 )∇k 2 = (λmin (Q))−1 ∇k 2 .
Therefore,
∇k 4 λmin (Q)
q(x(k+1) ) = q(x(k) ) 1 − ≤ q(x(k) ) 1 − .
(∇k Q∇k )(∇Tk Q−1 ∇k )
T λmax (Q)
Unconstrained Optimization 333
In summary, we have
k+1
λmin (Q)
q(x(k+1) ) ≤ q(x(0) ) 1 − , (13.17)
λmax (Q)
and since 0 < λmin (Q) ≤ λmax (Q),
q(x(k) ) → 0, k → ∞.
Note that q(x) = 0 ⇐⇒ x = x∗ , so x(k) → x∗ , k → ∞. Thus, the steepest
descent method is globally convergent for a convex quadratic function. Note
that the rate of convergence is linear.
From the above inequality (13.17), we also see that if λmin (Q) = λmax (Q),
then we will have convergence in one step (as for f (x) = x21 + x22 in Exam-
ple 13.4). On the other hand, if λmax (Q) is much larger than λmin (Q), then
min (Q)
1 − λλmax (Q) ≈ 1 and the convergence may be extremely slow in this case.
Recall that the ratio k(Q) = λλmax (Q)
min (Q)
= QQ−1 is called the condition
number of matrix Q. When a matrix is poorly conditioned (i.e., it has a large
condition number), we have “long, narrow” level sets, and the steepest descent
may move back and forth (“zigzag”) in search of the minimizer.
1 T
f (x) = x Qx + cT x
2
with positive definite Q, we obtain
Then,
So, if we start close enough from the stationary point x∗ , then Newton’s
method converges to x∗ with a quadratic rate of convergence under the as-
sumptions specified above.
Unconstrained Optimization 335
The inequality above holds since (∇2k )−1 is positive definite and ∇k = 0. Thus,
there exists ᾱ such that φk (α) < 0 for α ≤ ᾱ, i.e., φk (α) is decreasing on [0, ᾱ]
and for all α ∈ (0, ᾱ) : f (x(k) + αd(k) ) < f (x(k) ).
Therefore, we can modify Newton’s method to enforce the descent property
by introducing a step size as follows:
λi + μk , i = 1, . . . , n.
336 Numerical Methods and Optimization: An Introduction
Hence, if we choose μk > |λmin (∇2k )|, where λmin (∇2k ) is the minimum eigen-
value of ∇2k , then all eigenvalues of Mk are positive, so Mk is a positive definite
matrix.
To make sure that the descent property holds, we can use the direction
−Mk−1 ∇k instead of the direction −(∇2k )−1 ∇k used in Newton’s method. In-
cluding the step size, we obtain the following iteration:
c0 (d(i) )T Qd(0) +c1 (d(i) )T Qd(1) +. . .+ci (d(i) )T Qd(i) +. . .+ck (d(i) )T Qd(k) = 0.
But the directions d(0) , d(1) , . . . , d(k) are Q-conjugate, so (d(i) )T Qd(j) = 0 for
all j = i, and hence we have
ci (d(i) )T Qd(i) = 0.
This means that ci = 0, since Q is positive definite and d(i) = 0. Note that
the index i was chosen arbitrarily, hence ci = 0 for all i = 1, . . . , k.
The linear independence of the conjugate directions implies that one can
choose at most n Q-conjugate directions in IRn .
where
1 T
x Qx + cT x,
f (x) =
2
and Q is a positive definite matrix. Consider an iteration
where
αk = arg min f (x(k) + αd(k) ).
α∈IR
In the conjugate direction method the directions d(k) are chosen so that
∇Tk d(k)
αk = − ,
(d )T Qd(k)
(k)
∇Tk+1 d(i) = 0, i = 0, . . . , k.
Proof. We will use induction for the proof. We first show that for any k:
∇Tk+1 d(k) = 0. We know that αk satisfies the FONC for φk (α), hence
φk (αk ) = 0.
On the other hand, using the chain rule
φk (αk ) = ∇f (x(k) + αk d(k) )T d(k) = ∇Tk+1 d(k) ,
so ∇Tk+1 d(k) = 0.
Now, assume that the statement is correct for all k = 1, . . . , K for some
K, i.e.,
∇TK d(i) = 0, i = 0, . . . , K − 1.
We need to show that it is correct for k = K +1. For i = 0, . . . , K −1, consider
∇TK+1 d(i) = (Qx(K+1) + c)T d(i)
T
= Q(x(K) + αK d(K) ) + c d(i)
T
= Qx(K) + c + αK Qd(K) d(i)
T
= ∇K + αK Qd(K) d(i)
= ∇TK d(i) + αK (d(K) )T Qd(i)
= 0.
We have already shown that the statement is correct for i = K. Thus, by
induction, the statement is correct for any k and any i = 0, . . . , k.
Unconstrained Optimization 339
where
Then we have
α(k) = arg min Φ(a(k) ).
k+1
a(k) ∈IR
Proof. We have
Φk (a(k) ) = (x(0) + Dk a(k) )T Q(x(0) + Dk a(k) ) + cT (x(0) + Dk a(k) )
1 $ %
= (a(k) )T Dk T QDk a(k) + (x(0) )T QDk + cT Dk a(k) + f (x(0) ).
2
Since Q is a positive definite matrix and Dk is a matrix of full rank (due to
linear independence of Q-conjugate directions), Dk T QDk is positive definite,
so Φk (a(k) ) is a convex quadratic function. The gradient of Φk (a(k) ) is
∇Φk (a(k) )T = ∇f (x(0) + Dk a(k) )T Dk .
Then for a(k) = α(k) we have
∇Φk (α(k) )T = ∇f (x(0) + Dk α(k) )T Dk
= ∇Tk+1 Dk
= ∇Tk+1 [d(0) d(1) · · · d(k) ]
= [∇Tk+1 d(0) ∇Tk+1 d(1) · · · ∇Tk+1 d(k) ]
= 0T .
Since Φk (a(k) ) is a convex quadratic function, a(k) = α(k) is the global mini-
mizer of Φk (a(k) ).
The last property has an important implication concerning the convergence
of the method. We state it in the following theorem.
Thus,
f (x(n) ) = f (x(0) +Dn−1 α(n−1) ) = min f (x(0) +Dn−1 a(n−1) ) = minn f (x).
a(n−1) ∈IR x∈IR
n
Figure 13.4 illustrates how the steepest descent method, conjugate gradient
method, and Newton’s method compare for a convex quadratic function.
Unconstrained Optimization 341
x(1) x∗
x(0)
(c) Newton’s method
x∗
x(0)
1
f (x) ≈ f (x(k) ) + ∇f (x(k) )T (x − x(k) ) + (x − x(k) )T ∇2 f (x(k) )(x − x(k) ).
2
We could replace f (x) with this quadratic approximation and apply the conju-
gate gradient algorithm to find the minimizer of the quadratic function, which
we would use as x(k+1) . However, computing and evaluating the Hessian at
each iteration is a computationally expensive procedure that we would like to
avoid. In the conjugate gradient algorithm above, two operations involve the
matrix Q, which would correspond to the Hessian. These operations are com-
puting αk and βk . While αk could be approximated using line search, we need
to find a way to approximate βk . Next we discuss several formulas designed
for this purpose.
The Hestenes-Stiefel formula. We use the fact that for a quadratic func-
tion
∇k − ∇k−1 = Q(x(k) − x(k−1) ) = αk−1 Qd(k−1) ,
so
∇k − ∇k−1
Qd(k−1) = .
αk−1
342 Numerical Methods and Optimization: An Introduction
Therefore,
(d(k−1) )T ∇k = 0
and
(d(k−1) )T ∇k−1 = (−∇k−1 + βk−1 d(k−2) )T ∇k−1
= −∇Tk−1 ∇k−1 + βk−1 (d(k−2) )T ∇k−1
= −∇Tk−1 ∇k−1
In the above derivations, each formula was obtained from the previous one
using equalities that are exact for quadratic functions, but only approximate
in general. Therefore, in the process of simplifying the formula for βk , the
quality of approximation of the original problem gradually decreases.
x(k+1) = x(k) − αk Hk ∇k , k ≥ 0.
p(i) = Hk g (i) , i = 0, . . . , k − 1,
Hn g (i) = p(i) , i = 0, . . . , n − 1.
Hn = Pn G−1
n .
Q−1 Gn = Pn
and
Q−1 = Pn G−1
n .
So, for a quadratic function, Hn = Q−1 . This means that after n + 1 steps
of a quasi-Newton method we get the same answer as we get after one step
of Newton’s method, which is the global minimizer of the convex quadratic
function. Next, we show that the global minimizer of the convex quadratic
function is, in fact, obtained in no more than n steps of a quasi-Newton
344 Numerical Methods and Optimization: An Introduction
{d(k) = −Hk ∇k : k = 0, . . . , n − 1}
For i = k, we have
Hk+1 g (k) = p(k) ,
so,
(Hk + αk z (k) (z (k) )T )g (k) = p(k) , (13.25)
which is equivalent to
thus,
(p(k) − Hk g (k) ) (p(k) − Hk g (k) )T
αk z (k) (z (k) )T = αk
αk (z (k) )T g (k) αk (z (k) )T g (k)
(p(k) − Hk g (k) )(p(k) − Hk g (k) )T
= . (13.26)
αk ((z (k) )T g (k) )2
Note that Eq. (13.25) is equivalent to
αk z (k) (z (k) )T g (k) = p(k) − Hk g (k) .
Premultiplying both sides of this equation by (g (k) )T , we obtain
αk ((z (k) )T g (k) )2 = (g (k) )T (p(k) − Hk g (k) ).
Substituting this expression in the denominator of Eq. (13.26) we get
(p(k) − Hk g (k) )(p(k) − Hk g (k) )T
αk z (k) (z (k) )T = .
(g (k) )T (p(k) − Hk g (k) )
Thus, from (13.24), we obtain the following rank-one correction formula:
(p(k) − Hk g (k) )(p(k) − Hk g (k) )T
Hk+1 = Hk + . (13.27)
(g (k) )T (p(k) − Hk g (k) )
One of the drawbacks of this formula is that given a positive definite Hk ,
the resulting matrix Hk+1 is not guaranteed to be positive definite. Some
other quasi-Newton methods, such as those described next, do guarantee such
a property.
where
αk = arg min(f (x(k) + αd(k) )).
α≥0
The strong Wolfe conditions make sure that the derivative φk (α) is not “too
positive” by requiring α to satisfy the following inequalities:
Exercises
13.1. A company manufactures two similar products. The manufacturing cost
is $40 for a unit of product 1 and $42 for a unit of product 2. Assume
that the company can sell q1 = 150 − 2p1 + p2 units of product 1 and
q2 = 120 + p1 − 3p2 units of product 2, where p1 and p2 are prices
charged for product 1 and product 2, respectively. The company’s goal
is to maximize the total profit. What price should be charged for each
product? How many units of each product should be produced? What
is the optimal profit?
13.2. Solve the problem minn f (x) for the following functions:
x∈IR
1
(a) f (x) = −x2 +3x−7 , n = 1;
(b) f (x) = (x1 − x2 − 1)2 + (x1 − x2 + 1)4 , n = 2;
(c) f (x) = x41 + x42 − 4x1 x2 , n = 2;
(d) f (x) = 2x21 − x1 x2 + x22 − 7x2 , n = 2;
1
(e) f (x) = (x1 −x2 −2)2 +(x1 −x2 +1)4 , n = 2.
min f (x).
x∈X
min xT ∇f (x∗ ).
x∈X
13.6. Given the points [x1 , y1 ]T , . . . , [xn , yn ]T ∈ IR2 , use the optimality condi-
tions to prove that the solution of the problem
n
min 2 f (a, b) = (axi + b − yi )2
[a,b]T ∈IR i=1
ρn = 1/2,
one, which is the mid-point of the interval [an−1 , bn−1 ]. But we need
two evaluation points in order to determine the final interval of uncer-
tainty. To overcome this problem, we can add a new evaluation point
an = bn − (bn−1 − an−1 ), where is a small number. Show that with
this modification, the reduction factor in the uncertainty range for the
Fibonacci method is no worse than
1 + 2
Fn+1
(therefore this drawback of Fibonacci search is of no significant practical
consequence). Hint: Note that bn−1 − an−1 = Fn+1 2
(b0 − a0 ).
13.11. For the function of a single variable f (x) = x4/3 , show that
13.12. The total annual cost C of operating a certain electric motor can be
expressed as a function of its horsepower, x, as follows
$0.2
C(x) = $120 + $1.5x + (1, 000).
x
Use Newton’s method to find the motor horsepower that minimizes the
total annual cost. Select an appropriate starting point and apply three
iterations of the method.
350 Numerical Methods and Optimization: An Introduction
minimize f (x)
subject to h(x) = 0,
where f (x) : IRn → IR, h(x) = [h1 (x), h2 (x), . . . , hm (x)]T : IRn → IRm . We
assume that m < n. Denote by
⎡ ∂h1 (x) ∂h1 (x)
⎤ ⎡ ⎤
∂x1 ∂x2 · · · ∂h∂x1 (x) ∇h1 (x)T
⎢ ∂h2 (x) n
⎥ ⎢
⎥ ⎢ ∇h2 (x)T ⎥
∂h2 (x)
⎢ ∂x1 · · · ∂h∂x2 (x) ⎥
⎢
Jh (x) = ⎢
∂x2 n ⎥=⎢ ⎥
.. .. .. .. ⎥ ⎣ ..
⎦
⎣ . . . . ⎦ .
∂hm (x) ∂hm (x)
··· ∂hm (x) ∇hm (x) T
∂x1 ∂x2 ∂xn
351
352 Numerical Methods and Optimization: An Introduction
minimize f (x1 , x2 )
subject to h1 (x1 , x2 ) = 0.
min f (y(t)).
t∈IR
df (y(t∗ ))
= 0.
dt
df (y(t∗ ))
= ∇f (y(t∗ ))T y (t∗ ),
dt
so
∇f (y(t∗ ))T y (t∗ ) = 0.
A similar property holds for the general case and is formulated in the following
theorem.
Constrained Optimization 353
minimize f (x)
(14.1)
subject to h(x) = 0,
where f (x) : IRn → IR, h(x) = [h1 (x), . . . , hm (x)]T : IRn → IRm , then
there exists λ = [λ1 , . . . , λm ]T ∈ IRm such that
m
∇f (x∗ ) + λi ∇hi (x∗ ) = 0. (14.2)
i=1
m
L(x, λ) = f (x) + λi hi (x)
i=1
m
∇f (x∗ ) + λi ∇hi (x∗ ) = 0
i=1
h(x∗ ) = 0,
which coincides with the FONC stated in the Lagrange theorem (the second
equation just guarantees the feasibility). This system has n + m variables
and n + m equations. Its solutions are candidate points for a local minimizer
(maximizer). The system is not easy to solve in general. Moreover, like in
the unconstrained case, even if we solve it, a solution may not be a local
minimizer–it can be a saddle point or a local maximizer. Figure 14.1 illustrates
the FONC.
Note that all feasible points are regular for this problem, so any local
minimizer has to satisfy the Lagrange conditions. We have
∇h(x∗ )
x∗
∇f (x∗ )
h(x) = 0
f (x) = c2
f (x) = c1 f (x∗ ) = c1 < c2
2x1 (1 + 4λ) = 0
2x2 (1 + λ) = 0
4x21 + x22 = 1.
The Lagrangian is
1/2
−1 x(3) 1
x (4) 0 x1
-1/2
x(2)
(P −1 Q − λIn )x = 0.
x∗ T Qx∗ − λ∗ x∗ T P x∗ = 0,
x∗ T Qx∗ = λ∗ .
Convex case
Consider a convex problem with equality constraints,
minimize f (x)
subject to h(x) = 0,
where f (x) is a convex function and X = {x ∈ IRn : h(x) = 0} is a convex set.
We will show that the Lagrange theorem provides sufficient conditions for a
global minimizer in this case.
1 T
L(x, λ) = x Qx + λT (Ax − b),
2
where λ ∈ IRm . The FONC can be expressed by the system
Qx + AT λ = 0
Ax − b = 0.
Ax = −AQ−1 AT λ,
so
b = −AQ−1 AT λ
and
λ = −(AQ−1 AT )−1 b.
Substituting this value of λ into (14.7), we obtain the global minimizer of the
considered problem:
x∗ = Q−1 AT (AQ−1 AT )−1 b.
In an important special case, when Q = In , the discussed problem becomes
1
min x2 .
Ax=b 2
Its solution,
x∗ = AT (AAT )−1 b,
gives the solution of the system Ax = b with minimum norm.
358 Numerical Methods and Optimization: An Introduction
minimize f (x)
subject to h(x) = 0
g(x) ≤ 0,
where f (x) : IRn → IR, h(x) : IRn → IRm (m < n), and g(x) : IRn → IRp .
This problem involves two types of constraints, equality and inequality
constraints. Recall that an inequality constraint gj (x) ≤ 0 is called active at
x∗ if gj (x∗ ) = 0. We denote by I(x∗ ) = {j : gj (x∗ ) = 0} the set of indices cor-
responding to the active constraints for x∗ . A point x∗ is called a regular point
for the considered problem if ∇hi (x∗ ), i = 1, . . . , m and ∇gj (x∗ ), j ∈ I(x∗ )
form a set of linearly independent vectors. The Lagrangian of this problem is
defined as
L(x, λ, μ) = f (x) + λT h(x) + μT g(x),
where λ = [λ1 , . . . , λm ]T ∈ IRm and μ = [μ1 , . . . , μp ]T ∈ IRp , μ ≥ 0. As before,
the multipliers λi , i = 1, . . . , m corresponding to the equality constraints are
called the Lagrange multipliers. The multipliers μj , j = 1, . . . , p correspond-
ing to the inequality constraints are called the Karush-Kuhn-Tucker (KKT)
multipliers.
The first-order necessary conditions for the problems with inequality con-
straints are referred to as Karush-Kuhn-Tucker (KKT) conditions.
minimize f (x)
subject to h(x) = 0
g(x) ≤ 0,
m
p
∇f (x∗ ) + λi ∇hi (x∗ ) + μj ∇gj (x∗ ) = 0
i=1 j=1
and
1. λ ∈ IRm , μ ∈ IRp , μ ≥ 0;
m
p
2. ∇f (x∗ ) + λi ∇hi (x∗ ) + μj ∇gj (x∗ ) = 0;
i=1 j=1
3. μj gj (x∗ ) = 0, j = 1, . . . , p;
4. h(x∗ ) = 0;
5. g(x∗ ) ≤ 0.
The Lagrangian is
2μ2 (x1 + 1) = 1
2μ2 x2 = −1
$ %
μ2 (x1 + 1) + x2 − 4
2 2
= 0
x21 + x22 ≤ 4
(x1 + 1) + 2
x22 ≤ 4
μ2 ≥ 0.
Note that μ2 = 0 (from the first equation), so μ2 > 0. Adding the first
two equations we get
x1 = −x2 − 1,
which, using the third equation, gives
√
x2 = ± 2.
360 Numerical Methods and Optimization: An Introduction
√ √
μ2 > 0, from the second equation x2 = − 2 and μ2 = 1/(2 2), so
Since √
x1 = 2−1. √ These values
√ of x1 and x2 satisfy the inequality constraints,
thus x∗ = [ 2 − 1, − 2]T satisfies the KKT conditions.
2μ1 x1 = 1
2μ1 x2 = −1
μ1 (x21 + x22 − 4) = 0
x21 + x22 ≤ 4
2
(x1 + 1) + x22 ≤ 4
μ1 ≥ 0.
Note that μ1 = 0 (from the first equation), so μ1 > 0. Adding the first
two equations we get
x1 = −x2 ,
which, using the third equation, gives
√
x2 = ± 2.
√ √
μ1 > 0, from the second equation x2 = − 2 and μ1 = 1/(2 2), so
Since √
x1 = 2. However, these values of x1 and x2 do not satisfy the last in-
equality constraint, hence the point is infeasible and the KKT conditions
are not satisfied.
From Figure 14.3 it is clear that the KKT point x∗ is the global minimizer.
√
The level set of the objective corresponding to the optimal value (1 − 2 2) is
shown by the dashed line (a tangent to the feasible region).
Constrained Optimization 361
x2
2
-3 -2 1 2 x1
x∗
-2
Convex case
Assume that the feasible set X = {x : h(x) = 0, g(x) ≤ 0} is a convex set
and f (x) is a convex function over X. We will show that in this case the KKT
conditions are sufficient conditions for a global minimizer.
minimize f (x)
subject to h(x) = 0
g(x) ≤ 0,
m
p
∇f (x∗ ) + λi ∇hi (x∗ ) + μj ∇gj (x∗ ) = 0
i=1 j=1
362 Numerical Methods and Optimization: An Introduction
and
μj gj (x∗ ) = 0, j = 1, . . . , p.
Proof. The necessity follows from Theorem 14.3. To establish the sufficiency,
assume that x∗ is a regular point satisfying the KKT conditions. Using the
first-order characterization of a convex function, for any x ∈ X:
m
p
∇f (x∗ ) = − λi ∇hi (x∗ ) − μj ∇gj (x∗ ).
i=1 j=1
m
p
f (x) − f (x∗ ) ≥ − λi ∇hi (x∗ )T (x − x∗ ) − μj ∇gj (x∗ )T (x − x∗ ).
i=1 j=1
Example 14.5 The problem in Example 14.4 is convex, hence, we can con-
clude that the only KKT point x∗ is the global minimizer for this problem.
Constrained Optimization 363
Here we assume that f (x) and h(x) are twice continuously differentiable. De-
note by ∇2xx L(x, λ) the Hessian of L(x, λ) as a function of x:
m
∇2xx L(x, λ) = ∇ f (x) +
2
λi ∇2 hi (x).
i=1
Since the problem max f (x) is equivalent to the problem min (−f (x)),
h(x)=0 h(x)=0
it is easy to check that by reversing the sign of the inequalities in (14.9)
364 Numerical Methods and Optimization: An Introduction
Example 14.6 Consider the problem from Example 14.1 (page 353): f (x) =
x21 + x22 ; h(x) = 4x21 + x22 − 1. There are four candidates for local optimizers:
(1) λ1 = −1, x(1) = [0, 1]T ;
(2) λ2 = −1, x(2) = [0, −1]T ;
(3) λ3 = −1/4, x(3) = [1/2, 0]T ;
(4) λ4 = −1/4, x(4) = [−1/2, 0]T .
We apply the second-order conditions to these points. We have
Thus,
y T ∇2xx L(x(1) , λ1 )y = −6c2 < 0, ∀c = 0,
and x(1) is a local maximizer. It is easy to check that T (x(2) ) = T (x(1) ) and
∇2xx L(x(2) , λ2 ) = ∇2xx L(x(1) , λ1 ), so x(2) is also a local maximizer.
Similarly, T (x(3) ) = T (x(4) ) = {y : y = [0, c]T , c ∈ IR} and
3 2
y T ∇2xx L(x(3) , λ3 )y = y T ∇2xx L(x(4) , λ4 )y = c > 0, ∀c = 0.
2
Thus, x(3) and x(4) are local minimizers.
minimize f (x)
subject to h(x) = 0 (P)
g(x) ≤ 0,
where f : IRn → IR, h : IRn → IRm , g : IRn → IRp . For x∗ ∈ IRn , I(x∗ ) denotes
the set of indices corresponding to active constraints at x∗ .
Constrained Optimization 365
m
p
L(x, λ, μ) = f (x) + λi hi (x) + μj gj (x),
i=1 j=1
we denote by
m
p
∇2xx L(x, λ, μ) = ∇ f (x) +
2
λi ∇ hi (x) +
2
μj ∇2 gj (x).
i=1 j=1
Let :
∗ y ∈ IRn : ∇hi (x∗ )T y = 0, i = 1, . . . , m
T (x ) = .
∇gj (x∗ )T y = 0, j ∈ I(x∗ )
The Lagrangian is
−1 + 2λx1 + 2μ(x1 + 1) = 0
1 + 2λx2 + 2μx2 = 0
$ %
μ (x1 + 1)2 + x22 − 4 = 0
x21 + x22 = 4
2
(x1 + 1) + x22 ≤ 4
μ ≥ 0.
To solve this system, we consider two cases: μ = 0 and (x1 + 1)2 + x22 − 4 = 0.
−1 + 2λx1 = 0
1 + 2λx2 = 0
x21 + x22 = 4
2
(x1 + 1) + x22 ≤ 4.
From the first two equations, noting that λ cannot be zero, we obtain
x1√= −x2 , and considering the third equation we have x1 = −x2 =
± 2. Taking into account the inequality constraint, we obtain a unique
solution to the above system,
(1)
√ (1)
√ √
x1 = − 2, x2 = 2, λ(1) = −1/(2 2), μ(1) = 0.
2. In the second case, (x1 + 1)2 + x22 − 4 = 0, the KKT system becomes
−1 + 2λx1 + 2μ(x1 + 1) = 0
1 + 2λx2 + 2μx2 = 0
2
(x1 + 1) + x22 = 4
x21 + x22 = 4
μ ≥ 0.
√
From the last two equalities we obtain x1 = −1/2, x2 = ± 15/2, and
using the first two equations we obtain the following two solutions:
(2) (2)
√ 1 √ 1 √
x1 = −1/2, x2 = 15/2, λ(2) = − (1 + 1/ 15), μ(2) = (1 − 1/ 15);
2 2
(3) (3)
√ 1 √ 1 √
x1 = −1/2, x2 = − 15/2, λ(3) = − (1−1/ 15), μ(3) = (1+1/ 15).
2 2
Constrained Optimization 367
Thus, there are three points satisfying the KKT conditions, x(1) , x(2) , and x(3) .
Next, we apply the second-order optimality conditions to each of these points.
Let h(x) = x21 +x22 −4, g(x) = (x1 +1)2 +x22 −4. The Hessian of the Lagrangian
as the function of x is
2(λ + μ) 0
∇2xx L(x, λ, μ) = .
0 2(λ + μ)
= {y ∈ IR2 : y1 = y2 }
= {y = [c, c]T : c ∈ IR}.
In this case,
√
−1/ 2 0√
∇2xx L(x(1) , λ(1) , μ(1) ) = ,
0 −1/ 2
√
and for any y ∈ T (x(1) ), we have y T ∇2xx L(x(1) , λ(1) , μ(1) )y = − 2c2 < 0 (if
c = 0). Therefore, x(1) is a strict local maximizer. It should be noted that
we would arrive at the same conclusion for any tangent space T (x(1) ) since
∇2xx L(x(1) , λ(1) , μ(1) ) is clearly negative definite and the inequality constraint
is inactive at x(1) .
For the second KKT point,
(2) (2)
√ 1 √ 1 √
x1 = −1/2, x2 = 15/2, λ(2) = − (1 + 1/ 15), μ(2) = (1 − 1/ 15),
2 2
we have
:
(2) (2) (2) y ∈ IR2 : ∇h(x(2) )T y = 0
T (x ) = T (x ,μ ) =
3 ∇g(x(2) )T y = 0 4
(2) (2)
y ∈ IR : 2
2x1 y1 + 2x2 y2 = 0
= (2) (2)
2(x1 + 1)y1 + 2x2 y2 = 0
√ :
y ∈ IR2 : −y1 + √15y2 = 0
=
y1 + 15y2 = 0
= {[0, 0]T }.
Hence, the tangent space has no nonzero elements, the SONC and SOSC are
automatically satisfied, and x(2) is a strict local minimizer.
368 Numerical Methods and Optimization: An Introduction
(3) (3)
√ 1 √ 1 √
x1 = −1/2, x2 = − 15/2, λ(3) = − (1 − 1/ 15), μ(3) = (1 + 1/ 15),
2 2
we also have T (x(3) ) = T (x(3) , μ(3) ) = {[0, 0]T }, implying that x(3) is a strict
local minimizer.
Note that the feasible region of this problem is a compact set, therefore, a
global minimizer exists. Since there are two local minimizers, one of them must
be global. Comparing the objective
√ function f (x) = √x2 − x1 at the points of
local minimum, f (x(2) ) = ( 15 + 1)/2, f (x(3) ) = (− 15 + 1)/2, we conclude
that the global minimum is achieved at x(3) .
14.2 Duality
Consider the functions f : X → IR, g : Y → IR, and F : X × Y → IR,
where X ⊆ IRm and Y ⊆ IRn . We assume that the global minima and maxima
do exist in all cases discussed below in this section. Suppose that f (x) ≤ g(y)
for all (x, y) ∈ X × Y . Then it is clear that
A result of this kind is called a duality theorem. It is easy to prove that the
following inequality holds:
hence
implying that all the above inequalities must hold with equality.
Next assume that
Then we have
Note that
f (x), if g(x) ≤ 0
sup L(x, μ) = sup{f (x) + μ g(x)} = T
μ≥0 μ≥0 +∞, otherwise,
Proof. By definition of the dual, d(μ) = min L(x, μ), hence for any μ ≥ 0
x∈X
and x∗ ∈ X, we have d(μ) ≤ f (x∗ ) + μT g(x∗ ). This implies that d(μ) ≤
Constrained Optimization 371
max d(μ) = d(μ∗ ). Since μ ≥ 0 and g(x∗ ) ≤ 0, it follows that μT g(x∗ ) ≤ 0 for
μ≥0
any μ, hence, d(μ∗ ) = f (x∗ ) + μ∗ T g(x∗ ) ≤ f (x∗ ).
The difference f (x∗ ) − d(μ∗ ) is called the duality gap.
The following result follows directly from Theorem 14.10.
min f (x).
x∈X
where ΠX (y) denotes the projection of y onto set X. The projection of y onto
X can be defined as
ΠX (y) = arg min z − y.
z∈X
This definition may not be valid since such a minimizer may not exist or
may not be unique in general. Even if it does exist, it may be as difficult to
find as to solve the original optimization problem. However, in some cases the
projection can be easily computed.
min z − y.
Az=b
min ξ.
Aξ=b−Ay
Thus,
where P = In − AT (AAT )−1 A is the orthogonal projector onto the null space
{x : Ax = 0} of A. Note that for any x ∈ IRn we have A(P x) = (A −
AAT (AAT )−1 A)x = 0.
Thus, we can write our iteration for the constrained problem in the form
In other words, instead of direction d(k) used for the unconstrained problem,
we will use the direction P d(k) in the constrained problem. This direction is
the projection of d(k) onto the null space of A.
Recall that in the gradient methods for unconstrained problems we used
a step
x(k+1) = x(k) + αk d(k) ,
where
d(k) = −∇k .
Consider a nonlinear programming problem
min f (x).
Ax=b
Constrained Optimization 373
d(k) = P (−∇k ),
x(k+1) = x(k) − αk P ∇k , k ≥ 0,
P = In − AT (AAT )−1 A,
αk = arg min f (x(k) − αP ∇k ).
α≥0
that is
∇f (x∗ ) − AT ((AAT )−1 A∇f (x∗ )) = 0,
so, the Lagrange conditions are satisfied with λ = (AAT )−1 A∇f (x∗ ).
On the other hand, assuming that there exists λ ∈ IRm such that
∇f (x∗ ) + AT λ = 0,
we obtain
Descent property
Consider the k th step of the projected steepest descent method and denote
by
φk (α) = f (x(k) − αP ∇k ).
The derivative of this function is
so,
φk (0) = −∇Tk P ∇k .
Using the following properties of the projector P ,
P T = P, P 2 = P,
we obtain
φk (0) = −∇Tk P ∇k = −∇Tk P T P ∇k = −P ∇k 2 .
Thus, if P ∇k = 0, then φk (0) < 0, so there exists ᾱ > 0 such that for any
α ∈ (0, ᾱ): φk (α) < φk (0). Hence, f (x(k+1) ) < f (x(k) ) and we have the descent
property.
Next we show that if x(k) → x∗ , where {x(k) : k ≥ 0} is the sequence
generated by the projected steepest descent method, then P ∇f (x∗ ) = 0.
Consider φk (α) = f (x(k) − αP ∇k ). Since in the steepest descent method αk
minimizes φk (α), by the FONC,
φk (αk ) = 0.
Note that if f (x) is a convex function, then the problem min f (x) is a convex
Ax=b
problem. In this case, if the projected steepest descent converges, then it
converges to a global minimizer.
minimize cT x
subject to Ax = b (14.13)
x ≥ 0,
We assume that all points generated by the method are interior, x(k) >
0, k ≥ 0. In the affine scaling method, the original LP is transformed to an
equivalent LP, so that the current point is “better” positioned for the projected
steepest descent method. It is based on observation that if the current point is
close to the “center” of the feasible region, then there is more space for move in
a descent direction; therefore a larger step toward the minimum can be made.
An appropriate choice for the “center” is the point e = [1, 1, . . . , 1]T ∈ IRn ,
which has equal distance to all bounds given by xi = 0, i = 1, . . . , n.
Denote by
⎡ (k) ⎤
x1 0 ... 0
⎢ (k) ⎥
⎢ 0 x2 ... 0 ⎥
Dk = diag(x(k) ) = ⎢ ⎢ .. .. .. .. ⎥
⎥.
⎣ . . . . ⎦
(k)
0 0 ... xn
y = Dk−1 x ⇔ x = Dk y,
minimize cTk y
subject to Ak y = b (14.14)
y ≥ 0,
where
ck = Dk c and Ak = ADk .
We have y (k) = Dk−1 x(k)
= e. Next, we make an iteration in the direction
of the projected steepest descent for problem (14.14). Since ∇(cTk y) = ck , we
obtain
d(k) = Pk ck ,
where 0 < α < 1 (typically α = 0.9 or 0.99 is chosen). Note that if d(k) = 0
and d(k) ≤ 0, then the problem is unbounded (there is no minimizer). Finally,
(k+1)
having computed yi , we need to find the corresponding feasible point of
the original problem (14.13) by applying the inverse scaling operation,
x(k+1) = Dk y (k+1) = Dk (e − αk d(k) ).
The affine scaling method is summarized in Algorithm 14.1.
TABLE 14.1: Affine scaling iterations for the LP in Example 14.11. All the
values are rounded to 7 decimal places.
T
k x(k) cT x(k) x(k) − x∗
1 [0.1000000, 1.6400000, 1.5400000] 9.7400000 0.1232883
2 [0.0100000, 1.6040000, 1.5940000] 9.6140000 0.0123288
3 [0.0010000, 1.6004000, 1.5994000] 9.6014000 0.0012329
4 [0.0001000, 1.6000400, 1.5999400] 9.6001400 0.0001233
5 [0.0000100, 1.6000040, 1.5999940] 9.6000140 0.0000123
6 [0.0000010, 1.6000004, 1.5999994] 9.6000014 0.0000012
7 [0.0000001, 1.6000000, 1.5999999] 9.6000001 0.0000001
8 [0.0000000, 1.6000000, 1.6000000] 9.6000000 0.0000000
X = {x ∈ IRn : gj (x) ≤ 0, j = 1, . . . , m}
m
Φ(x) = ((gj (x))+ )2 .
j=1
It is easy to see that the penalty functions have the following property: If
Φ1 (x) is a penalty for X1 and Φ2 (x) is a penalty for X2 , then Φ1 (x) + Φ2 (x)
is a penalty for the intersection X1 ∩ X2 .
The general scheme of penalty function methods is described in Algo-
rithm 14.2. The following theorem establishes its convergence.
is bounded, then
Algorithm 14.2 A general scheme of the penalty function method for solving
min f (x).
x∈X
1: choose a penalty Φ(x) of X
2: choose x0 ∈ IRn
3: choose a sequence of penalty coefficients 0 < tk < tk+1 such that tk → ∞
4: for k = 1, 2, . . . do
5: find a solution x(k) to minn {f (x) + tk−1 Φ(x)} starting with xk−1
x∈IR
6: if a stopping criterion is satisfied then
7: return x(k)
8: end if
9: end for
m
• Logarithmic barrier: F (x) = − ln(−gj (x)).
j=1
380 Numerical Methods and Optimization: An Introduction
m
• Exponential barrier: F (x) = exp −gj1(x) .
j=1
Barriers have the following property. If F1 (x) is a barrier for X1 and F2 (x)
is a barrier for X2 , then F1 (x)+F2 (x) is a barrier for the intersection X1 ∩X2 .
The general scheme of barrier methods is outlined in Algorithm 14.3.
Algorithm 14.3 A general scheme of the barrier function method for solving
min f (x).
x∈X
1: choose a barrier F (x) of X
2: choose x0 in the interior of X
3: choose a sequence of coefficients tk > tk+1 > 0 such that tk → 0, k → ∞
4: for k = 1, 2, . . . do
5: find a solution x(k) to the barrier problem min{f (x) + tk−1 F (x)}
x∈X
6: if a stopping criterion is satisfied then
7: return x(k)
8: end if
9: end for
Proof: Let F (x) ≥ F ∗ for all x ∈ X. For any x̄ in the interior of X we have
thus lim sup Ψ∗k ≤ f ∗ (since the opposite would yield lim sup Ψ∗k > f (x̄) for
k→∞ k→∞
some x̄ in the interior of X).
On the other hand,
Recall that to derive the (k + 1)st iteration of Newton’s method for solving
this system, we consider a linear approximation
where y (k) is the solution after k steps. Solve the system JFt (y (k) )z =
−Ft (y (k) ) for z, and set y (k+1) = y (k) + z. To ensure some desired convergence
and numerical stability properties, the primal-dual interior point methods use
step-length coefficients that may be different for different components of New-
ton’s direction z. More specifically, the system JFt (y (k) )z = −Ft (y (k) ) is given
by
⎡ 2 ⎤⎡ ⎤ ⎡ ⎤
∇xx L(y) 0 −JhT (x) −JgT (x) zx ∇x L(y)
⎢ 0 M 0 S ⎥ ⎢ zs ⎥ ⎢ Sμ + te ⎥
⎢ ⎥⎢ ⎥ ⎢ ⎥
⎣ Jh (x) 0 0 0 ⎦ ⎣ zλ ⎦ = − ⎣ h(x) ⎦ ,
Jg (x) Ip 0 0 zμ g(x) + s
Exercises
14.1. For a twice continuously differentiable function f : IRn → IR, let
x(k) ∈ IRn be such that ∇f (x(k) ) = 0 and ∇2 f (x(k) ) is positive defi-
nite. Consider the following constrained problem:
Show that the solution d∗ of this problem is the Newton’s direction for
f (x).
14.2. Given the equality constraints h(x) = 0, x ∈ IRn , where
f (x) = c4
∇g(x1 )
∇f (x1 ) f (x) = c3
x1
f (x) = c2
f (x) = c1
∇f (x2 )
x2
∇g(x2 )
(a) c1 ≥ c2 ≥ c3 ≥ c4 ;
(b) x1 is a local minimizer;
(c) x2 is a local minimizer;
(d) x1 is a global minimizer;
(e) x2 is a global minimizer.
where f, h : IR3 → IR, ∇f (x) = [10x1 + 2x2 , 2x1 + 8x2 − 5, −1]T , and
∇h(x∗ ) = [−12, −5, 1]T . Find ∇f (x∗ ).
14.6. Find all points satisfying FONC for the following problem:
minimize x2 − x1
subject to x21 − x32 = 0.
(a) Find the set of all regular points for this problem.
(b) Draw the feasible set and level sets of the objective function corre-
sponding to local minima.
(c) Does x∗ = [0, 0]T satisfy the FONC? Is x∗ a point of local mini-
mum? Explain.
14.9. Formulate the FONC (KKT conditions), SONC and SOSC for the max-
imization problem with inequality constraints:
maximize f (x)
subject to h(x) = 0
g(x) ≤ 0,
Constrained Optimization 385
where f : IRn → IR, h : IRn → IRm , g : IRn → IRp are twice continuously
differentiable functions.
14.10. Use KKT conditions to find all stationary points for the following prob-
lems:
(a) minimize 2x − x2
subject to 0 ≤ x ≤ 3
(b) minimize −(x21 + x22 )
subject to x1 ≤ 1
(c) minimize x1 − (x2 − 2)3 + 3
subject to x1 ≥ 1.
Which of these points, if any, are points of local or global minimum?
Explain.
14.11. Check that the following problem is convex and use the KKT conditions
to find all its solutions.
minimize exp{−(x1 + x2 )}
subject to exp (x1 ) + exp (x2 ) ≤ 10
x2 ≥ 0.
14.12. Use the SOSC to find all local minimizers of the problem
minimize x2
subject to x21 + (x2 − 4)2 ≤ 16
(x1 − 3)2 + (x2 − 3)2 = 18.
14.14. Find all points satisfying the KKT conditions for the following quadratic
programming problem
1 T
minimize 2 x Qx
subject to Ax ≤ b,
386 Numerical Methods and Optimization: An Introduction
14.15. Show that the dual function d(μ) defined in Eq. (14.12) at page 369 is
concave.
14.16. Apply two iterations of the affine scaling method to the following prob-
lem:
Use x(0) = [1/4, 1/2, 1/4]T as the initial point. At each iteration, use the
step-length coefficient α = 0.9.
Notes and References
There are many excellent books for further reading on the topics so concisely
introduced in this text. Here we provide several pointers based on our personal
preferences, which, we hope, will help the reader to avoid getting overwhelmed
by the variety of available choices.
The following texts are good choices for learning more about numerical
methods for problems discussed in Part II of this text, as well as their com-
puter implementations: [9, 14, 18, 24]. The classical book by Cormen et al. [13]
provides a great, in-depth introduction to algorithms. See [16, 28] for more
information on computational complexity.
The discussion in Sections 9.5 and 9.6 is based on [20] and [25], respectively.
The simplex-based approach to establishing the fundamental theorem of LP
presented in Chapter 10 is inspired by Chvátal [11]. Textbooks [19,31] contain
an extensive collection of LP exercises and case studies. Other recommended
texts on various aspects of linear and nonlinear optimization include [1–6, 10,
15, 17, 23, 26, 27, 29].
387
This page intentionally left blank
Bibliography
389
390 Numerical Methods and Optimization: An Introduction
[16] M.R. Garey and D.S. Johnson. Computers and Intractability: A Guide
to the Theory of NP-Completeness. W.H. Freeman and Company, New
York, 1979.
[17] I. Griva, S. Nash, and A. Sofer. Linear and Nonliner Optimization. SIAM,
Philadelphia, 2nd edition, 2009.
[18] R. W. Hamming. Numerical Methods for Scientists and Engineers. Dover
Publications, 1987.