Problems Warming up Find the domain of the following functions

Problems
Warming up
Find the domain of the following functions, establish in which set they are differentiable, then compute
critical points.
Apply 2nd order sufficient conditions to qualify them as local max, min, saddle or can’t tell.
1. f (x, y) = x3 + xy 2 − 2x2 + 4xy.
2. f (x, y) = ln(xy) − x − 2y 2
3. f (x, y) = x2 − 2x + y 2 − 2y
4. f (x, y) = −y 3 − y 2 + 3xy + 2y − 3x2
5. f (x, y) = (x − 1)3 + (y − 5)3 − 3y + x2 − 2x
6. f (x, y) = (x2 − 8x)y + ey
7. f (x, y) = ln(x2 + y 2 ) − xy
2
2
8. f (x, y) = ex +y − 2x2 y
p
9. f (x, y) = x2 − y 2
10. f (x, y) = ln(y − 2x2 − 1) − 3y 2
p
11. f (x, y) = (y + 1)2 + (x − 3)2 + 2
√
12. f (x, y) = − 2 xy + y +
x2
4
13. f (x, y) = ln x2xy
+y 2
Getting on
For all the preceding functions, discuss, whenever possible, whether local min and max are global.
1
Answer to problems
Altogether, we answer the warming up and the getting on part.
Solution to #1
The function f (x, y) = x3 + xy 2 − 2x2 + 4xy, is defined by a polinomial, hence is differentiable infinte
times, with continuous derivatives on R2 .
Gradient is
−4x + 4y + 3x2 + y 2
∇f (x, y) =
4x + 2xy
Critical points are solutions to
−4x + 4y + 3x2 + y 2 = 0
4x + 2xy = 0
that is the set
Z=
(0, −4), (0; 0),
Hessian matrix is
D2 f (x, y) =
−4
1) det D f (0, 0) = 4
−4
2) det D2 f (0, 0) = −8
8
3) det D2 f (2, −2) = 0
2
3) det D2 f (− 3 , −2) = 2
2
− , −2 ;
3
6x − 4
2y + 4
2y + 4
2x
(2, −2)
4 = −16 < 0, ⇒ (0; 0) saddle point.
0 −8 = −64 < 0, ⇒ (0; −4) saddle point.
0 0 = 32 > 0 and a1,1 = 8 > 0, ⇒ (2; −2) local min.
4 −8 0 2
= 32
3 > 0 and a1,1 = −8 < 0, ⇒ (− 3 ; −2) local max.
0 − 43 Local are not global, max and min. To prove it, it suffices to observe that
f (x, x)
=
2x3 + 2x2
and inf f (x, x)
=
−∞ while sup f (x, x) = +∞
R
R
Solution to #2.
The function f (x, y) = ln(xy) − x − 2y 2 , Hessian is defined on the open set
D = (x, y) ∈ R2 : x > 0, y > 0 ∪ (x, y) ∈ R2 : x < 0, y < 0
where it is infinite times continuously differentiable. Gradient is
1
−1
x
∇f (x, y) =
−4y + y1
Critical points are solutions to
1
x
−1=0
−4y + y1 = 0
2
which solutions are x = 1, y = − 12 , and x = 1, y = 21 so that the set of critical points is singleton
1
Z=
1,
2
Hessian matrix is
2
D f (x, y) =
− x12
0
0
− y12 − 4
−1 0
which is negative definite, 1, 12 local max.
0 −8
Note that no global min exists: if it existed, as D is an open set, it would be also a local min, but no
local min exists.
so that D2 f 1, 21 =
On the other hand, there is no global max either. Indeed, for x < 0 and y = −1 we have
lim f (x, −1) = lim f (−t, −1) = lim (ln t + t − 2) = +∞.
x→−∞
t→+∞
t→+∞
Remark. Note that the function is *not* concave on D, since D is not a convex set; f is concave on the
subset of the domain (x, y) ∈ R2 : x > 0, y > 0 where it attains maximum, but the same conclusion
cannot be drawn on the whole domain.
Solution to #3
f (x, y) = x2 − 2x + y 2 −2y, ,
2x − 2 = 0
Gradient is ∇f (x, y) =
,
2y − 2 = 0
2x − 2 = 0
Solution is: [x = 1, y = 1]
2y − 2 = 0
2 0
Hessian is
, f convex, global min
0 2
Max does not exist f (x, y) = (x − 1)2 + (y − 1)2 − 2 so that
lim f (x, x) = 2(x − 1)2 − 2 = +∞ ⇒ sup f = +∞
x→∞
R2
Solution to #4
1. f (x, y) = −y 3 − y 2 + 3xy + 2y − 3x2 ,
−6x + 3y
Gradient is ∇f (x, y) =
3x − 2y − 3y 2 + 2
i h
h
√
√
−6x + 3y = 0
97+1
Critical points
, x = − 97+1
,
y
=
−
, x=
2
24
12
3x − 2y − 3y + 2 = 0
−6
3
Hessian is D2 f (x, y) =
3 −6y − 2
√
−6
3
√
, determinant: −3 97 < 0 saddle
97+1
3 6 12 − 2
√
−6
3
√
, determinant: 3 97 a local max
97−1
3 −6 12 − 2
3
√
97−1
24 , y
=
i
√
97−1
12
Not a global max, for
sup f = lim f (0, −a) = lim
a→+∞
R2
a→+∞
a3 − a2 − 2a = +∞
No global min otherwise it should be a critical point. Indeed we can say more, that is
inf2 f = lim f (0, a) = lim −a3 − a2 + 2a = −∞
a→+∞
R
a→+∞
Solution to #5
f (x, y) = (x − 1)3 + (y − 5)3 − 3y + x2 − 2x, ,
2
2x + 3 (x − 1) − 2
Gradient is ∇f (x, y) =
2
3 (y − 5) − 3
2
2x + 3 (x − 1) − 2 = 0
Critical points
,
2
3 (y −
5) − 3 = 0
1
Solution is: x = 31 , y =6 , [x = 1, y = 6] , x
= 3 , y = 4 , [x = 1, y = 4]
6x − 4
0
Hessian is D2 f (x, y) =
,
0
6y − 30
−2 0
D2 f ( 13 , 6) =
, determinant: −12, saddle point
0 6
2 0
D2 f (1, 6) =
, determinant: 12, local min, not globlal for inf f = −∞
0 6
−2 0
1
2
D f ( 3 , 4) =
, determinant: 12, local max, not a global max for sup f = +∞
0 −6
2 0
D2 f (1, 4) =
, determinant: −12, saddle point
0 −6
Solution to #6
2
f (x, y) = (x
− 8x)y + ey
y (2x − 8)
Gradient is
−8x + ey + x2
Critical points
y (2x − 8) = 0
,
−8x + ey + x2 = 0
• if y = 0 ⇒ −8x + 1 + x2 = 0, Solution is: x = 4 −
(4 −
√
√
15, 0); (4 +
15, x =
√
√
15 + 4
15, 0) ,
• if x = 4 ⇒ ey − 16 = 0, y = ln 16
(4, ln 16)
Hessian is D2 f =
2
D f (4 −
D2 f (4 +
√
√
2y
2x − 8
√0 2 4 − 15 − 8
2 4−
√0 2 4 + 15 − 8
2 4+
15, 0) =
15, 0) =
2x − 8
ey
√
15 − 8
, determinant: −60, saddle point
1
√
15 − 8
, determinant: −60, saddle point
1
4
D2 f (4, ln 16) =
2 ln 16
8−8
8−8
eln 16
, determinant: 32 ln 16 > 0, local min, but not global, as
lim f (−a, −1) = lim
a→+∞
a→+∞
−(a2 + 8a) + e−1 = −∞ ⇒ inf f = −∞
Solution to #7.
f (x, y) = ln(x2 + y 2 ) − xy
The domain of f is D = R2 \ {(0, 0)}, while the gradient is
2y
2x
− y, 2
−x
∇f (x, y) =
x2 + y 2
x + y2
Note also that:
- partial derivatives are defined and continuous at every point in D,
- D is an open set
then f is differentiable in D.
Critical points are those P (x, y) such that ∇f (x, y) = 0, that is, the set of solutions of the system
(
2x
x2 +y 2 − y = 0
2y
x2 +y 2 − x = 0
Case 1: Assume x 6= 0 and y 6= 0 we have
(
(
(
y
y
x
2x
1
x2 +y 2 − y = 0
x2 +y 2 = 2x
2y = 2x
⇔
⇔
2y
1
x
1
x2 +y 2 − x = 0
x2 +y 2 = 2y
x2 +y 2 =
x
2y
(
2x2 − 2y 2 = 0
⇔
1
x
x2 +y 2 = 2y
(
⇔
(x + y)(x − y) = 0
1
x
x2 +y 2 = 2y
The first equation is satisfied either for (1a) x = y or (1b) x = −y
If (1a) pluggin into second equation we get
1
1
= ⇔ y 2 = 1 ⇔ y = 1, y = −1
2y 2
2
so that the system is satisfied by (1, 1) and (−1, −1).
If (1b), proceding similarly we get
1
1
= − ⇔ y 2 = −1
2y 2
2
that has no real solution.
Case 2: Let us wonder whether (0, y) with y 6= 0, or (x, 0) with x 6= 0 may be a solution. In the first
case we get
(
0−y =0
2y
y2 − 0 = 0
that has no solution. Similarly one derives that (x, 0) with x 6= 0 cannot be a solution.
Critical points of f are (1, 1) and (−1, −1).
We now compute Hessian matrix.
!
x2 −y 2
xy
−2
−4
2
2 − 1
2
2
2
2
(x +y )
(x +y )
D2 f (x, y) =
2
xy
−y 2
−4 (x2 +y
2 (xx2 +y
2 )2 − 1
2 )2
then
D2 f (1, 1) = D2 f (−1, −1) =
5
0
−2
−2
0
whose determinant is -4, then the matrix is indefinte and both critical points are saddle points.
Solution to #8
2
f (x, y) = ex
a) D = R2 ;
+y 2
− 2x2 y.
2
2
2
2
b) f is differentiable in D, with gradient ∇f (x, y) = 2x(ex +y − 2y), 2(yex +y − x2 )
c) Critical points are solutions to
(
2
2
2x(ex +y − 2y) = 0
2
2
2(yex +y − x2 ) = 0
The first equation is satisfied if one of the factors is null, that is:
2
2
(1) x = 0, or (2) ex +y − 2y = 0
2
In case (1), the 2nd equation gives 2yey = 0 ⇔ y = 0, that implies (0, 0) is critical.
2
2
x +y
In
into the 2nd equation, deriving 2(2y 2 − x2 ) = 0 ⇔ 2y 2 − x2 = 0 ⇔
√ case (2),√we plug 2y = e
( 2y − x)(
√ 2y + x) = 0, hence
√ either
(2a) x = 2y or (2b) x = − √
2y
In both cases, plugging x = ± 2y into the 1st equation and assuming (x, y) 6= (0, 0) (without loss of
generality, as (0,0) has been already computed as a solution), we derive
2
e3y = 2y.
2
Now we prove that such equation has no real solution, by showing the function ϕ(y) := e3y − 2y, has no
zeroes ϕ in R. In particular it suffices to show that ϕ is strictly positive everywhere.
2
Surely ϕ has no zero in (−∞, 0] because in such interval e3y > 0 while −2y ≥ 0, which implies ϕ(y) > 0
for all y ≤ 0.
There exist no zero of ϕ also in ]0, 21 ], that is for 0 < y ≤ 1/2, as
2
y > 0 ⇒ e3y > 1 and − 2y ≥ −1
so that
2
1
y > 0 ⇒ ϕ(y) = e3y − 2y > 1 − 1 = 0, ∀y ∈]0, ].
2
What is left to check is the zeroes in ]1/2, +∞[.
Note that if we show that ϕ0 (y) > 0 for all y > 1/2 (that is, ϕ increasing in ]1/2, +∞[) we may derive
that no zero exists in ]1/2, +∞[, as ϕ(1/2) > 0 and ϕ increasing in ]1/2, +∞[ implies ϕ(y) ≥ ϕ(1/2) > 0,
for all y ∈]1/2, +∞[.
Then we show now ϕ0 (y) > 0 for all y > 1/2.
2
2
Note that ϕ0 (y) = 6ye3x − 2, so that ϕ0 (1/2) = 3e3/4 − 2 > 0. Moreover ϕ00 (y) = e3y (6 + (6y)2 ) > 0 for
all y. Then ϕ0 is itself increasing and positive in 1/2, the it is strictly positive for all y > 1/2.
The only critical point is (0, 0).
d) Hessian is
!
2
2
2
2
2 0
2(ex +y + 2x2 ) − 4y 4x(yex +y − 1)
2
2
⇒
D
f
(0,
0)
=
D f (x, y) =
2
2
2
2
0 2
4x(yex +y − 1)
2(ex +y + 2y 2 )
Since fxx (0, 0) = 2 > 0, e det D2 f (0, 0) = 4 > 0 we derive (0, 0) is a local min.
Global minimization of f
(Weierstrass Theorem is needed, see lecture #2)
We now discuss whether (0;0) is also a GLOBAL min. The idea is to prove that the originale problem is
equivalent to maximizing f on a compact region.
6
2
2
As exponential function ex +y grows, positively, at infinity faster than x2 y one may guess that indeed a
global min does exist and is attained in a neighborhood of the origin. Nevertheless the assertion has to
be precisely proven.
We make use here of definition of global min and of Weierstrass Theorem in Rn .
If we show that f is coercive, that is in this case
lim
kxk→+∞
f (x) = +∞
we may then infer that the f attains its minimum on R2 , and that the local minimizer is indeed a global
minimizer. And consequently (0; 0) is shown to be the unique global minimum point for f on R2 .
(Why? If f coercive, there exists a radius R0 > 0 such that
inf2 f = inf f = min f
R
B R0
B R0
where B R0 = (x, y) ∈ R2 : x2 + y 2 ≤ R02 . Hence inf is indeed a min by means of Weierstrass Theorem,
because f is continuous and B R0 is a compact subset of Rn .
Moreover, that is also a global min for f on the entire R2 . Ultimately, the minimizer has to be a critical
point of f also, as it is a minimum attained on an open unbounded region.)
We then show that f is coercive. Let R > 0, and assume kxk = R. Then −x2 y ≥ −R3 so that for all
(x, y) ∈ ∂BR (0; 0) one has
2
f (x, y) ≥ eR − 2R3 =: ϕ(R)
Passing to limits as R → +∞, we derive
lim
kxk→+∞
f (x, y) ≥ lim ϕ(R) = lim
R→+∞
R→+∞
2
eR − 2R3 = +∞
which implies that f is coercive.
Solution to #9
p
f (x, y) = x2 − y 2
The domain is
D
= {(x, y) : (x − y)(x + y) ≥ 0}
= {(x, y) : x − y > 0 and x + y > 0} ∪ {(x, y) : x − y ≤ 0 and x + y ≤ 0}
but f is differentiable only at
D
◦
= {(x, y) : (x − y)(x + y) > 0}
= {(x, y) : x − y > 0 and x + y > 0} ∪ {(x, y) : x − y < 0 and x + y < 0}
At any couple of type (x, x) or (x, −x), f attains the value 0 which is the minimum attainable value,
hence
global min points are
{(x, x) : x ∈ R} ∪ {(x, −x) : x ∈ R}
Such points may not be met among critical points, as the function f is not differentiable at those points.
A global max does not exist, as
lim f (x, 0) = lim x = +∞
x→+∞
x→+∞
7

Gradient is 
√

x
x2 −y 2
−√
y

x2 −y 2
Critical points ∅
Solution to #10
1. f (x, y) = ln(y − 2x2 − 1) − 3y 2 ,
Domain D = {(x, y) : y > x2 + 1}
−4 y−2xx2 −1
Gradient is
−6y + y−2x1 2 −1
−4 y−2xx2 −1 = 0
,
Critical points
−6y + y−2x1 2 −1 = 0
Solution is:
P1
0,
P2
Hessian is
D2 f 0,
−4
(y−2x2 −1)
4x
(y−2x2 −1)2
√ 3+ 15
6
6
√
15
!
15
!
6
∈
/
D,
∈
D
!
6
0

1 − √15−3
2 − 6
,

24
− √15−3

=
0
3+
0,
4x
(y−2x2 −1)2
− (y−2x12 −1)2 −
√
3−
6
whose determinant is: −
36
√
2
( 15−3)
+6
24
− √15−3
√
= 192 15 + 720, Then P2 is a local max. P2
is the unique global maximizer.
f (x, y) < ln (y − 1) − 3y 2 ≤ max(ln (y − 1) − 3y 2 ) = f (P2 )
y>1
Alternative (very expensive) proof :
We now show that P2 is a global max. Indeed, let (x0 , y0 ) ∈ {(x, y) : y = 2x2 + 1}. Then
lim
(x,y)→(x0 ,y0 )
f (x, y) = ln(0+ ) − 3(x20 + 1)2 = −∞
so that there exists ε > 0 – for instance, one may choose ε = 0.01 – such that
sup f = sup f
D
Dε
where the closed set Dε is given by
Dε = {(x, y) ∈ D : y ≥ 2x2 + 1 + ε}
for in the complement set
(x, y)
∈
D r Dε = {(x, y) ∈ D : 2x2 + 1 < y < 2x2 + 1 + ε}
⇒ f (x, y) < ln ε − 3y 2 < ln ε = ln 0.01 = −4. 60 < f (P2 ) ' −3. 80
8
Let’s now show that
(∗)
lim
|(x,y)|→+∞,(x,y)∈D
f (x, y) = −∞
If we do so then
sup f = sup f = sup f
D
Dε
Dε ∩B
where B is a suitable closed ball centered at the origin and, being Dε ∩ B closed and bounded,
hence compact, f would attain its max in Dε ∩ B, hence in D, hence at P2 . Now note that (y > 0)
|(x, y)|
→ +∞ ⇔ (|x| → +∞) ∨ (|y| → +∞)
⇔ (|x| → +∞) ∨ (y → +∞)
so that, if y → +∞, then f (x, y) < ln y − 3y 2 → −∞; if instead |x| → +∞, then y → +∞, same
conclusion, so that (∗) is proved.
Solution to #11
Trivial: without any computation, (3, −1) is the global minimizer and no local max exists; sup f =
+∞.
Solution to #12
√
f (x, y) = − 2 xy + y +
x2
4 ,
,
The function is defined on
D = {(x, y) : xy ≥ 0}
but differentiable in
Do = {(x, y) : xy > 0}
1
1 √y
2 x − 2 xy
1 √x
− 2 xy + 1
Gradient is
(
Critical points
!
1
1 √y
2 x − 2 xy
− 12 √xxy + 1
=0
, Solution is: x = 12 , y = 18
=0
Hessian is
"
#
−3
−1
(xy) 2 + 12 − 14 (xy) 2
−1
− 32
1 2
− 41 (xy) 2
4 x (xy)
x= 12 ,y= 18
3
−1
4
=
−1 4
whose determinant is 2, so that 12 , 18 is a local min. Nonetheless, it is not a global min. Indeed
i
h √
2
1
f 21 , 18 = − 2 xy + y + x4
= − 16
x= 12 ,y= 81
h √
i
2
f (−1, −100) = − 2 xy + y + x4
= − 439
4 = −109. 75
1 2
4y
x=−1,y=−100
Solution to #13
f (x, y) = ln x2xy
+y 2 .
a) Domain:
D
xy
> 0, x2 + y 2 6= 0}
x2 + y 2
: xy > 0, (x, y) 6= (0, 0)}
= {(x, y) ∈ R2 :
= {(x, y) ∈ R2
= {(x, y) ∈ R2 : x > 0, y > 0} ∪ {(x, y) ∈ R2 : x < 0, y < 0}
9
b) ∇f (x, y) =
x2 −y 2
y 2 −x2
(x2 +y 2 )x , (x2 +y 2 )y
differentiable in all D (D open set and partial derivatives are contin-
uous at every point of D).
c) The set of critical points Z is made of the solutions to
( y2 −x2
(
y 2 − x2 = 0
(x2 +y 2 )x = 0
⇔
x2 −y 2
x2 − y 2 = 0
(x2 +y 2 )y = 0
⇔ (y − x)(y + x) = 0
that is
Z
= {(x, y) ∈ D : (y − x)(y + x) = 0}
=
{(x, y) ∈ D : y = x} ∪ {(x, y) ∈ D : y = −x}
= {(x, y) ∈ D : y = x} ∪ ∅
= {(x, y) ∈ D : y = x}
Let us try to apply 2nd order cpnditions. The Hessian matrix is
2
D f (x, y) =
x4 −4x2 y 2 −y 4
(x2 +y 2 )2 x2
y
4 (x2 +y
2 )2 x
y
4 (x2 +y
2 )2 x
2 2
4
−y +x
− 4x(x2y+y
2 )2 y 2
!
4
and computed at points of Z becomes
2
D f (x, x) =
− x12
1
x2
− x12
1
x2
so that fxx (x, x) < 0, but det Hf (x, x) = 0, so that 2nd order sufficient conditions do not apply. From
2nd order necessary conditions, we know that critical points cannot be local min, but could be max or
saddle.
Note further that the Hessian is negative or null in the domain
2
det D2 f (x, y) =
2
− (y − x) (x + y)
y 2 x2 (x2 + y 2 )
2
≤0
so that it is indefinite (not convex nor concave) in D − Z, and negative semidefinite in Z.
Indeed all points in Z are GLOBAL max. Note that, since on D we have xy > 0, then
0<
x2
1
xy
≤
2
+y
2
2
as the second inequality is true (x − y) ≥ 0. Moreover 21 is attained at all points of Z. Hence f attains
its GLOBAL max ( with max f = ln 12 ).
(The property is very easy to guess, nonetheless one may not get it at first sight. The one may start
analyzing level sets Γk of f , discovering that they are of type x2 + y 2 − 2αxy = 0, with α = 2e1k . Then,
by a change of coordinates, one checks that the curve x2 + y 2 − 2αxy = 0 describes two lines through the
origin, so that all level curves are indeed of type (x, βx) for some positive β. Since
f (x, βx) = ln
β
1 + β2
and such function of β attains its max at 1 on the positive real axis, then the maximizing level curve was
(x; x).)
10