]> Constraints

Math Animated™
Mathematical Introduction for Physics and Engineering
by Samuel Dagan (Copyright © 2007-2020)

Chapter 3: Many Variables; Section 1: Differentiation; page 6

Home | Table of Contents | A-Z Index | Help

Previous topic: page 5 Stationary Points

Next topic: page 7 Jacobian


Constraints

Definition

In some applications of functions of many variables, their domains are restricted by constraints. A constraint is a functional relation among the variables. If the constraint can be solved as the dependence of one variable by the others, then the substitution of this variable in the function reduces by one the number of variables of the original function. The new function obtained this way can have different stationary points.

In order to clarify that, we will study the already known example of the function of two variables

z= xy 2 (3.1.6.1)

It is advisable to display Fig. Constraints, in parallel to this study, for illustration.

The constraint

x+y=0y=x (3.1.6.2)

obviously should change the saddle point to a maximum, as can be seen also from the substitution of y in (3.1.6.1):

z'= x 2 2 dz' dx =x d 2 z' d x 2 =1 }{ dz' dx =0 x=0 d 2 z' d x 2 <0 }maximum (3.1.6.3)

Similarly, the constraint

xy=0y=x (3.1.6.4)

brings a minimum to the same point.

A constraint can also create a stationary point, where the original function does not have one. For instance, the constraint

x+y=1y=1x (3.1.6.5)

that does not contain the original saddle point, gives rise to a new stationary point, which is a maximum.

z'= x( 1x ) 2 dz' dx = 2x+1 2 d 2 z' d x 2 =1 }{ dz' dx =0 x= 1 2 d 2 z' d x 2 <0 }maximum (3.1.6.6)

A constraint does not have to be of a linear character, as the examples used so far, but of any possible shape. In addition, there is no necessity of using Cartesian coordinates.

In the following example, polar coordinates will be used, for defining the constraint as a circle with radius of unity, centred at (x, y)=(0,1). According to (1.2.5.39), this circle is written as

r=2sinφfor0φπ (3.1.6.7)

and the function becomes

z= xy 2 = r 2 cosφsinφ 2 = r 2 sin( 2φ ) 4 (3.1.6.8)

After substituting r from (3.1.6.7) into (3.1.6.8), one obtains the constrained function z' as function of φ and its derivative.

z'=sin( 2φ ) sin 2 φ { dz' dφ =2[ cos( 2φ ) sin 2 φ+sin( 2φ )sinφcosφ ]= =2sinφ[ cos( 2φ )sinφ+sin( 2φ )cosφ ]= =2sinφsin( 3φ ) } (3.1.6.9)

According to (3.1.6.9), the stationary points are at

φ=0,    π 3 ,    2π 3 ,   ( π ) (3.1.6.10)

There are three stationary points. The point φ = π is the same as that for φ = 0. The second derivative gives

d 2 z' d φ 2 =2[ cosφsin( 3φ )+3sinφcos( 3φ ) ]= ={ 0forφ=0unspecified -6sin( π 3 )<0forφ= π 3 maximum 6sin( 2π 3 )>0forφ= 2π 3 minimum } (3.1.6.11)

In order to classify the case of φ = 0, one needs further differentiation.

d 3 z' d φ 3 =2[ 10sinφsin( 3φ )+6cosφcos( 3φ ) ]= =120forφ=0( π )inflectionpoint } (3.1.6.12)

In summary, if one expresses z as function of the polar coordinate φ along the constraint (3.1.6.7), then there is a maximum at φ = π/3 , a minimum at φ = 2π/3 , and an inflection point at φ = 0 (or π).

A function of two variables can be subject to one constraint. Two different constraints yield two equations with two unknowns, fixing the variables. A function of n variables can be subject to at most n−1 different constraints.

The next example, of three variables, consists in finding the closest distance between a point in three dimensional space ( x,y,z ) 0 =( x 0 , y 0 , z 0 ) and a plane containing the origin:

Ax+By+Cz=0 (3.1.6.13)

For the solution we'll use the distance squared

f( x,y,z )= ( x x 0 ) 2 + ( y y 0 ) 2 + ( z z 0 ) 2 (3.1.6.14)

and (3.1.6.13) as the constraint on the variables ( x,y,z ) .

By substituting z from (3.1.6.13) into (3.1.6.14) , it becomes a function of two variables:

f'( x,y,z )= ( x x 0 ) 2 + ( y y 0 ) 2 + ( Ax+By C + z 0 ) 2 (3.1.6.15)

In order to obtain (3.1.6.15), it was assumed that C≠0 . In any case, at least one of the constant factors of (3.1.6.13) should not vanish, and we could make a different substitution if C=0, without modifying the final result.

The derivatives are

{ f' x =2( x x 0 )+2( Ax+By C + z 0 ) A C f' y =2( y y 0 )+2( Ax+By C + z 0 ) B C { 2 f' x 2 =2( 1+ A 2 C 2 )>0 2 f' y 2 =2( 1+ B 2 C 2 )>0 2 f' xy =2 AB C 2 } (3.1.6.16)

which point to a minimum, since (3.1.6.16) also yields

D= 2 f' x 2 2 f' y 2 ( 2 f' xy ) 2 =4 A 2 + B 2 + C 2 C 2 >0 (3.1.6.17)

The application of

( 1+ B 2 C 2 ) f' x AB C 2 f' y =0 (3.1.6.18)

excludes the y variable and yields

( x x 0 )( A 2 + B 2 + C 2 )=A( A x 0 +B y 0 +C z 0 ) and   by   considerations   of   symmetry: ( y y 0 )( A 2 + B 2 + C 2 )=B( A x 0 +B y 0 +C z 0 ) ( z z 0 )( A 2 + B 2 + C 2 )=C( A x 0 +B y 0 +C z 0 ) } (3.1.6.19)

Yielding finally

( x x 0 ) 2 + ( y y 0 ) 2 + ( z z 0 ) 2 = ( A x 0 +B y 0 +C z 0 ) 2 A 2 + B 2 + C 2 (3.1.6.20)

Lagrange multipliers

Solving a constraint analytically, as one variable expressed in terms of the other variables, is sometimes a difficult or an impossible task. There is however a method for using the constraints, given as implicit functions. This method, called Lagrange multipliers, allows us to find the stationary points, but not their classes. It is extensively applied in physics for problems of minima or maxima. In case of doubt, one applies additional methods for finding the class.

We are going to study this method, and apply it to a few examples. We'll start with the case of a function with two variables and one constraint.

f=f( x,y )is   the   function S ( x,y )=0is   the   constraint } (3.1.6.21)

The differentials of (3.1.6.21) are

df= f x dx+ f y dy=0 dS= S x dx+ S y dy=0 } (3.1.6.22)

In (3.1.6.22) the top expression equals zero for a stationary point. On the other hand the differentials dx and dy are not independent, but related among them by the constraint. Therefore df is not a total differential, meaning that f x and f y do not vanish. The equality to zero of the bottom expression follows from the constant value of S. The relation between dx and dy is the same as at the top. We can rewrite (3.1.6.22) as

f x dx= f y dy S x dx= S y dy } (3.1.6.23)

and after a division side by side, to obtain

f x S x = f y S y =λ (3.1.6.24)

where λ is a factor or proportion that generally speaking is an unknown function of the variables. This yields two equations

f x λ S x =0 f y λ S y =0 } (3.1.6.25)

with three unknowns. By adding the constraint

S( x,y )=0 (3.1.6.26)

there are three equations with three unknowns. Their solution fixes the values of x, y and λ, for the stationary points. The value of λ, called the Lagrange multiplier, is a bonus but does not contain any important information.

As an example we'll use the function  z (3.1.6.8) with the constraint   S   from (3.1.6.7), which we rewrite in polar coordinates:

z( r,φ )= r 2 sin( 2φ ) 4 S ( r,φ )=r2sinφ=0 } (3.1.6.27)

The three equations to be solved simultaneously are

z r + λ S r = rsin( 2 φ ) 2 +λ=0 z φ +λ S φ = r 2 cos( 2φ ) 2 2λcosφ=0 r=2sinφ } (3.1.6.28)

The Lagrange multiplier from the top relation of (3.1.6.28) can be substituted in the next one, yielding two equations with two unknowns

r[ rcos( 2φ )+2sin( 2φ )cosφ ]=0 r=2sinφ } (3.1.6.29)

with one immediate solution:

r=0andφ=0( π ) (3.1.6.30)

For r≠0 , the substitution of r from the second relation of (3.1.6.29) into the first, yields

sinφcos( 2φ )+sin( 2φ )cosφ=sin( 3φ )=0 (3.1.6.31)

resulting with the same stationary points, as in (3.1.6.10). The classes of the stationary points can be found, by observing of the level lines of the function, shown in Fig. Constraints.

It can be shown that the method of Lagrange multipliers can be applied to obtain the stationary points of a function of any number n of variables, subject to any number of constraints k, providing that k<n. For this purpose one has to define k Lagrange multipliers, one for each constraint.

f( x 1 , x 2 ,....., x n )function   of   n   variables { S 1 ( x 1 , x 2 ,....., x n )=0 S 2 ( x 1 , x 2 ,....., x n )=0 ................................ S k ( x 1 , x 2 ,....., x n )=0 }   k   constraints   ( k<n ) λ 1 , λ 2 ,..., λ k one   multiplier   for   each constraint } (3.1.6.32)

For calculating the stationary points of the function, one has to use the k constraints of (3.1.6.32), in addition to the following n equations:

f x 1 + i=1 k ( λ i S i x 1 ) =0 f x 2 + i=1 k ( λ i S i x 2 ) =0 ................................ f x n + i=1 k ( λ i S i x n ) =0 } (3.1.6.33)

By doing so, the number of equations to be solved with Lagrange multipliers is larger, than by substituting k variables, a number equal to the number of constraints. In addition, the solution yields k number of multipliers, that do not contain important information. On the other hand, the equations obtained by the method of the Lagrange multipliers, are in many occasions, more convenient to solve. Furthermore the method deals easily with constraints given implicitly.

The example of the function f (3.1.6.14) with one constraint (3.1.6.13) will be reused, this time with the method of the Lagrange multipliers:

f( x,y,z )= ( x x 0 ) 2 + ( y y 0 ) 2 + ( z z 0 ) 2 S ( x,y,z )=Ax+By+Cz=0 } (3.1.6.34)

The four equations to be solved simultaneously are

f x +λ S x =2( x x 0 )+λA=0 f y +λ S y =2( y y 0 )+λB=0 f z +λ S z =2( z z 0 )+λC=0 Ax+By+Cz=0 } (3.1.6.35)

Excluding the unnecessary multiplier yields:

x x 0 A = y y 0 B = z z 0 C = λ 2 (3.1.6.36)

which leaves us with three linear equations

x x 0 A = z z 0 C y y 0 B = z z 0 C { A( x x 0 )+B( y y 0 )+C( z z 0 )= =( A x 0 +B y 0 +C z 0 ) } (3.1.6.37)

The substitution of ( x x 0 ) from the top equation of (3.1.6.37) into the last one, and the substitution of ( y y 0 ) from the second equation into the last one, solves the value of ( z z 0 ) :

z z 0 = C( A x 0 +B y 0 +C z 0 ) A 2 + B 2 + C 2 (3.1.6.38)

and by symmetry :

x x 0 = A( A x 0 +B y 0 +C z 0 ) A 2 + B 2 + C 2 y y 0 = B( A x 0 +B y 0 +C z 0 ) A 2 + B 2 + C 2 } (3.1.6.39)

yields the final result of f at the stationary point

( x x 0 ) 2 + ( y y 0 ) 2 + ( z z 0 ) 2 = ( A x 0 +B y 0 +C z 0 ) 2 A 2 + B 2 + C 2 (3.1.6.40)

in full agreement with (3.1.6.20).

Exercises

Exercise 1. Use Lagrange multipliers to find what is the shortest distance of the plane

Ax+By+Cz+G=0 withG0 }

from the coordinate's origin! (suggestion: first calculate the Lagrange multiplier .)

Exercise 2. The volume of a straight circular cylinder is V0. Find the radius r of the base and the height h, that minimize the surface area A of the cylinder?

  1. By using the exclusion of one of the variables, with verification of the minimum!
  2. By using the Lagrange multipliers! Compare the results!
  3. Without minimization, what happens with the surface, for the limit of r→0 ?

Exercise 3. A cuboid (rectangular box) is inscribed in the ellipsoid

x 2 a 2 + y 2 b 2 + z 2 c 2 =1

so that all its vertices are on the ellipsoid. Use Lagrange multipliers in order to find its largest volume!

Exercise 4. On the (x, y) plane there are the following geometrical forms: a straight line and a parabola.

y=x2 y= ( x+1 ) 2 +2
  1. Make a sketch!
  2. Prove that they are not intersecting!
  3. Use the Lagrange multipliers, to express the equations for the minimal distance between them! (suggestion: four variables)
  4. Calculate the minimal distance between them!

Previous topic: page 5 Stationary Points

Next topic: page 7 Jacobian

Home | Table of Contents | A-Z Index | Help