Chapter 17. Critical points

§17.1 [TEXT] Critical points in 18.01

First, a comparison to 18.01. Way back when you had a differentiable single-variable function 𝑓:ℝ→ℝ, and you were trying to minimize it, you used the following terms:

18.01 termMeaning
Global minimumMinimum of the function 𝑓 across the entire region you’re considering
Local minimumA point at which 𝑓 is smaller than any nearby points in a small neighborhood
Critical pointA point where 𝑓′(𝑥)=0
Table 7: 18.01 terminology for critical points

Each row includes all the ones above it, but not vice-versa. Here’s a picture of an example showing these for a random function 𝑓(𝑥)=−15𝑥6−27𝑥5+23𝑥4+𝑥3. From left to right in Figure 36, there are four critical points:

Note there’s no global minimum at all, since the function 𝑓 goes to −∞ in both directions as 𝑥→−∞ or 𝑥→+∞.

Figure 36: Some examples of critical points in an 18.01 graph of a single variable function.

§17.2 [TEXT] Critical points in 18.02

In 18.02, when we consider 𝑓:ℝ𝑛→ℝ the only change we make is:

Definition
For 18.02, we generalize the definition of critical point to be a point 𝑃 for which ∇𝑓(𝑃)=𝟎 is the zero vector. (The other two definitions don’t change.)

As soon as I say this I need to carry over the analogous warnings from 18.01:

Warning
  • Keep in mind that each of the implications

    Global minimum⟹Local minimum⟹Critical point, i.e. ∇𝑓=𝟎

    is true only one way, not conversely. So a local minimum may not be a global minimum; and a point with gradient zero might not be a minimum, even locally. You should still find all the critical points, just be aware a lot of them may not actually be min’s or max’s.

  • There may not be any global minimum or maximum at all, like we just saw.
Definition
In 18.02, a critical point that isn’t a local minimum or maximum is called a saddle point.
Example

The best example of a saddle point to keep in your head is the origin for the function

𝑓(𝑥,𝑦)=𝑥2−𝑦2.

Why is this a saddle point? We have 𝑓(0,0)=0, and the gradient is zero too, since

∇𝑓=(2𝑥2𝑦)⟹∇𝑓(0,0)=(2⋅02⋅0)=(00).

The problem is that the small changes in 𝑥 and 𝑦 clash in sign. Specifically, if we go a little bit to either the left or right in the 𝑥-direction, then 𝑓 will increase a little bit, e.g.

𝑓(0.1,0)=𝑓(−0.1,0)=0.01>0.

But the −𝑦2 term does the opposite: if we go a little bit up or down in the 𝑦-direction, then 𝑓 will decrease a little bit.

𝑓(0,0.1)=𝑓(0,−0.1)=−0.01<0.

So the issue is the clashing signs of small changes in 𝑥 and 𝑦 directions. This causes 𝑓 to neither be a local minimum nor local maximum.

There’s actually nothing special about ±𝑥 and ±𝑦 in particular; I only used those to make arithmetic easier. You can see Figure 37 for values of 𝑓 at other nearby points.

Figure 37: Values of 𝑓(𝑥,𝑦)=𝑥2−𝑦2 at a distance of 0.1 from the saddle point (0,0). Green values are positive and red ones are negative. It’s a saddle point because there are both.
Remark

The name “saddle point” comes from the following picture: if one looks at the surface

𝑧=𝑥2−𝑦2

then near (0,0) you have something that looks like a horse saddle. It curves upwards along the 𝑥-direction, but downwards along the 𝑦-direction.

We’ll get to the recipe for distinguishing between saddle points and local minimums and maximums in a moment; like in 18.01, there is something called the second derivative test. First, one digression and a few examples of finding critical points.

§17.3 [SIDENOTE] Saddle points are way more common than critical inflection points

At first glance, you might be tempted to think that a saddle point is the 18.02 version of the critical inflection point. However, that analogy is actually not so good for your instincts, and saddle points feel quite different from 18.01 critical inflection points. Let me explain why.

In 18.01, it was possible for a critical point to be neither a local minimum or maximum, and we called these critical inflection points. However, in 18.01 this was actually really rare. To put this in perspective, suppose we considered a random 18.01 function of the form

𝑓(𝑥)=□𝑥3+□𝑥2+□𝑥+□

where each square was a random integer between −1000000 and 1000000 inclusive. Of the approximately 1025 functions of this shape, you will find that while there are plenty of critical points, the chance of finding a critical inflection point is something like 10−15 — far worse than the lottery. (Of course, if you know where to look, you can find them: 𝑓(𝑥)=𝑥3 has a critical inflection point at the origin, for example.)

In 18.02 this is no longer true. If we picked a random function of a similar form

𝑓(𝑥,𝑦)=□𝑥3+□𝑥2+□𝑥+□𝑦3+□𝑦2+□𝑦+□

where we fill each square with a number from −1000000 to 1000000 then you’ll suddenly see saddle points everywhere. For example, when I ran this simulation 10000 times, among the critical points that showed up, I ended up with about

And the true limits (if one replaces 106 with 𝑁 and takes the limit as 𝑁→∞) are what you would guess from the above: 25%, 25%, 50%. (If you want to see the code, it’s in the Appendix, Chapter 56.)

Why is the 18.02 situation so different? It comes down to this: in 18.02, you can have two clashing directions. For the two experiments I’ve run here, consider the picture in Figure 38. Here 𝑃 is a critical point, and we consider walking away from it in one of two directions. I’ll draw a blue + arrow if 𝑓 increases, and a red − arrow if 𝑓 decreases.

Figure 38: Why the 18.01 and 18.02 polynomial experiments have totally different outcomes.

In the 18.01 experiment, we saw that two arrows pointing opposite directions almost always have the same color. So in 18.01, when we could only walk in one direction, that meant almost every point was either a local minimum or a local maximum. But the picture for 18.02 is totally different because there’s nothing that forces the north/south pair to have the same sign as the east/west pair. For a “random” function, if you believe the colors are equally likely, then half the time the arrows don’t match colors and you end up with a saddle point.

This whole section was for two-variable functions 𝑃(𝑥)+𝑄(𝑦), so it’s already a simplification. If you ran an analogous three-variable experiment defined similarly for polynomials 𝑓(𝑥,𝑦,𝑧)=𝑃(𝑥)+𝑄(𝑦)+𝑅(𝑧):

If we return to the world of any two-variable function, the truth is even more complicated than this. In this sidenote I only talked about functions 𝑓(𝑥,𝑦) that looked like 𝑃(𝑥)+𝑄(𝑦) where 𝑃 and 𝑄 were polynomials. The 𝑥 and 𝑦 parts of the function were completely unconnected, so we only looked in the four directions north/south/east/west. But most two-variable functions have some more dependence between 𝑥 and 𝑦, like 𝑓(𝑥,𝑦)=𝑥2𝑦3 or 𝑓(𝑥)=𝑒𝑥sin(𝑦) or similar. Then you actually need to think about more directions than just north/south/east/west.

Digression

For example, Poonen’s lecture notes (see question 9.22) show a weird monkey saddle: the point (0,0) is a critical point of

𝑓(𝑥,𝑦)=𝑥𝑦(𝑥−𝑦)

where the values of 𝑓 nearby split into six regions, alternating negative and positive, in contrast to Figure 37 where there were only four zones on the circle. (See also Wikipedia for monkey saddle.) Poonen also invites the reader to come up with an octopus saddle (which sounds like it needs sixteen regions, eight down ones for each leg of the octopus).

§17.4 [RECIPE] Finding critical points

For finding critical points, on paper you can just follow the definition:

Recipe for finding critical points

To find the critical points of 𝑓:ℝ𝑛→ℝ

  1. Compute the gradient ∇𝑓.
  2. Set it equal to the zero vector and solve the resulting system of 𝑛 equations in 𝑛 variables.

The thing that might be tricky is that you have to solve a system of equations. Depending on how difficult your function is to work with, that might require some creativity in order to get the algebra right. We’ll show some examples where the algebra is really simple, and examples where the algebra is much more involved.

Sample Question
Compute the critical points of 𝑓(𝑥,𝑦,𝑧)=𝑥2+2𝑦2+3𝑧2.

Solution. The gradient is

∇𝑓(𝑥,𝑦,𝑧)=(2𝑥4𝑦6𝑧).

In order for this to equal (000), we need to solve the three-variable system of equations

2𝑥=04𝑦=06𝑧=0

which is so easy that it’s almost insulting: 𝑥=𝑦=𝑧=0. The only critical point is (0,0,0).□

Sample Question
Compute the critical points of 𝑓(𝑥,𝑦)=𝑥𝑦(6−𝑥−𝑦).

Solution. This example is a lot more annoying than the previous one, despite having fewer variables, because casework is forced upon you. You need to solve four systems of linear equations, not just one, as you’ll see.

We expand

𝑓(𝑥,𝑦)=6𝑥𝑦−𝑥2𝑦−𝑥𝑦2.

So

∇𝑓=(6𝑦−2𝑥𝑦−𝑦26𝑥−𝑥2−2𝑥𝑦).

Hence, the resulting system of equations to solve is

𝑦(6−2𝑥−𝑦)=0𝑥(6−2𝑦−𝑥)=0.

The bad news is that these are quadratic equations. Fortunately, they come in factored form, so we can rewrite them as OR statements:

𝑦(6−2𝑥−𝑦)=0⟹(𝑦=0 OR 2𝑥+𝑦=6)𝑥(6−2𝑦−𝑥)=0⟹(𝑥=0 OR 𝑥+2𝑦=6).

So actually there are 22=4 cases to consider, and we have to manually tackle all four. These cases fit into the following 2×2 table; we solve all four systems of equations.

Top eqn. gives 𝑦=0Top eqn. gives 2𝑥+𝑦=6
Bottom eqn. gives 𝑥=0{𝑦=0𝑥=0⟹(𝑥,𝑦)=(0,0){2𝑥+𝑦=6𝑥=0⟹(𝑥,𝑦)=(0,6)
Bottom eqn. gives 𝑥+2𝑦=6{𝑦=0𝑥+2𝑦=6⟹(𝑥,𝑦)=(6,0){2𝑥+𝑦=6𝑥+2𝑦=6⟹(𝑥,𝑦)=(2,2)

So we get there are four critical points, one for each case: (0,0), (0,6), (6,0) and (2,2).□

§17.5 [TEXT] General advice for solving systems of equations

In the last example with 𝑓(𝑥,𝑦)=𝑥𝑦(6−𝑥−𝑦), we saw the solving a system of equations is not necessarily an easy task. In general, solving a system of generic equations, even when the number of variables equals the number of unknowns, can be disproportionately difficult in the number of variables.

Digression: Even simple-looking systems can be challenging

It’s easy to generate examples of systems that can’t be solved by hand. But it’s also possible to generate examples of systems that look innocent, and can be solved by hand in a nice way, but for which finding that nice way is extremely challenging.

One example of such a system of equations is to solve over ℝ the system

𝑥3=3𝑥−12𝑦+50𝑦3=12𝑦+3𝑧−2𝑧3=27𝑧+27𝑥.

There is a way to solve it by hand, but it’s quite hard to come up with, even for the best high school students in the world. (The source of the problem is the USA Team Selection Test 2009.)

This means that you need to put away your chef hat for a moment and put on your problem-solving cap: The good news is that it’s all high-school algebra: no calculus involved, no derivatives, etc. The bad news is that it’s tricky. You really have to think.

Tips on systems of equations
  • When solving a system of equations, treat it like a self-contained algebra puzzle. That means you cannot just blindly follow a recipe, but need to actually think.

  • Possible strategy in some situations: try to isolate one variable in terms of others. For example, if you see 𝑥2+𝑥+2𝑦=7, one strategy is to rewrite it as 𝑦=12(7−(𝑥2+𝑥)) and then use that substitution to kill all the 𝑦’s for your system. This reduces the number of variables by 1, at the cost of some work.

  • If there’s symmetry in the system of equations, see if you can exploit it to save work.

  • Try to factor things when you spot factors. For example, if you see 𝑥𝑦−𝑥=0, write it as 𝑥(𝑦−1)=0, then either 𝑥=0 or 𝑦=1.

  • If you are taking square roots of both sides: that is, if 𝑎2=𝑏2, you conclude 𝑎=±𝑏, not 𝑎=𝑏.

  • Be careful in making sure you don’t miss cases if you start getting OR statements. In the last example, there were 22=4 cases. You can easily imagine careless students accidentally forgetting a case.

  • See if you can “guess” some obvious solutions to start (e.g. all-zero). If so, note them down so you know that they should show up later.

I also need one warning: be really careful about division by zero. For example, in the example from last section, careless students might try to divide by 𝑦 and 𝑥 to get

6𝑦−2𝑥𝑦−𝑦2=0⟹2𝑥+𝑦=66𝑥−2𝑥𝑦−𝑥2=0⟹𝑥+2𝑦=6.

But this is wrong, because 𝑥 and 𝑦 could be zero too! If you make this mistake you’re only getting to one of the four critical points. This is important enough I’ll box it:

Warning: Watch for division by zero
Any time you divide both sides of an equation, ask yourself if you the expression you’re dividing by could be 0 as well. If so, that case needs to be handled separately.

I’m going to give two examples, each with three variables, to show these ideas in the tip I just mentioned. Fair warning: these are deliberately a bit trickier, to give some space to show ideas. Don’t worry if you can’t do these two yourself. The exam ones will probably tone down this algebra step a bit.

Sample Question

Compute all the critical points of the function

𝑓(𝑥,𝑦,𝑧)=𝑥3+𝑦3+𝑧3−3𝑥𝑦𝑧.

Solution. We first compute the gradient:

∇𝑓=(3𝑥2−3𝑦𝑧3𝑦2−3𝑧𝑥3𝑧2−3𝑥𝑦).

The critical points occur when ∇𝑓=𝟎, which gives us the system of equations (after dividing by 3):

𝑥2=𝑦𝑧𝑦2=𝑧𝑥𝑧2=𝑥𝑦.

We’d like to divide out by the variables, but this would be division by zero. Indeed, note (0,0,0) is a solution!

Now let’s suppose all the variables are nonzero. Then we can write the first equation safely as 𝑧=𝑥2𝑦 and use that to get rid of 𝑧 in the second equation:

𝑦2=(𝑥2𝑦)𝑥⇒𝑥3=𝑦3.

Similarly, we get 𝑦3=𝑧3 and 𝑧3=𝑥3.

So in fact 𝑥=𝑦=𝑧, because we can safely take cube roots of real numbers. And any triple with 𝑥=𝑦=𝑧 works fine.

In conclusion, every point of the form (𝑡,𝑡,𝑡) is a critical point — an infinite family of critical points!□

Sample Question

Compute all the critical points of the function

𝑓(𝑥,𝑦,𝑧)=𝑧(𝑥−𝑦)(𝑦−𝑧)−2𝑥𝑧.

Solution. The gradient is given by

∇𝑓=(𝑧(𝑦−𝑧)−2𝑧𝑧(−2𝑦+𝑥+𝑧)𝑦(𝑥−𝑦)−2𝑧(𝑥−𝑦)−2𝑥).

That looks scary, but it turns out the first two equations factor. Cleaning things up, we get:

𝑧(𝑦−𝑧−2)=0𝑧(−2𝑦+𝑥+𝑧)=0𝑦(𝑥−𝑦)−2(𝑥−𝑦)𝑧−2𝑥=0.

In the first equation, we have cases on 𝑧=0 and 𝑦=𝑧+2.

In conclusion, the answer is

(𝑦2𝑦−2,𝑦,0) for every 𝑦≠2, plus one extra point(3,1,−1).

□

§17.6 [RECIPE] The second derivative test for two-variable functions

Earlier we classified critical points by looking at nearby points. Technically speaking, we did not give a precise definition of “nearby”, just using small numbers like 0.01 or 0.1 to make a point. So in 18.02, the exam will want a more systematic theorem for classifying critical points as local minimum, local maximum, or saddle point.

I thought for a bit about trying to explain why the second derivative test works, but ultimately I decided to not include it in these notes. Here’s some excuses why:

Digression

The issue is that getting the “right” understanding of this would require me to talk about quadratic forms. However, in the prerequisite parts Alfa and Bravo of these notes, we only did linear algebra, and didn’t cover quadratic forms in this context at all. I hesitate to introduce an entire chapter on quadratic forms (which are much less intuitive than linear functions) and then tie that to eigenvalues of a 2×2 matrix just to justify a single result not reused later. (Poonen has some hints on quadratic forms in section 9 of his notes if you want to look there though.)

The other downside is that even if quadratic forms are done correctly, the second derivative test doesn’t work in all cases anyway, if the changes of the function near the critical point are sub-quadratic (e.g. degree three). And multivariable Taylor series are not on-syllabus for 18.02.

So to get this section over with quickly, I’ll just give the result. I’m sorry this will seem to come out of nowhere.

Recipe: The second derivative test

Suppose 𝑓(𝑥,𝑦) has a critical point at 𝑃. We want to tell whether it’s a local minimum, local maximum, or saddle point. Assume 𝑓 has a continuous second derivative near 𝑃.

  1. Let 𝐴=𝑓𝑥𝑥(𝑃), 𝐵=𝑓𝑥𝑦(𝑃)=𝑓𝑦𝑥(𝑃), 𝐶=𝑓𝑦𝑦(𝑃). These are the partial derivatives of the partial derivatives of 𝑓 (yes, I’m sorry), evaluated at 𝑃. If you prefer gradients, you could write this instead as

    ∇𝑓𝑥(𝑃)=(𝐴𝐵),∇𝑓𝑦(𝑃)=(𝐵𝐶).
  2. If 𝐴𝐶−𝐵2≠0, output the answer based on the following chart:

    • If 𝐴𝐶−𝐵2<0, output “saddle point”.
    • If 𝐴𝐶−𝐵2>0 and 𝐴,𝐶>0, output “local minimum”.
    • If 𝐴𝐶−𝐵2>0 and 𝐴,𝐶<0, output “local maximum”.
  3. If 𝐴𝐶−𝐵2=0, the second derivative test is inconclusive. Any of the above answers are possible, including weird/rare saddle points like the monkey saddle. You have to use a different method instead.

The quantity 𝐴𝐶−𝐵2 is sometimes called the Hessian determinant; it’s the determinant of the matrix (𝐴𝐵𝐵𝐶).

Tip

It is indeed a theorem that if 𝑓 is differentiable twice continuously, then 𝑓𝑥𝑦=𝑓𝑦𝑥. That is, if you take a well-behaved function 𝑓 and differentiate with respect to 𝑥 then differentiate with respect to 𝑦, you get the same answer as if you differentiate with respect to 𝑦 and respect to 𝑥. You’ll see this in the literature written sometimes as

𝜕𝜕𝑥𝜕𝜕𝑦𝑓=𝜕𝜕𝑦𝜕𝜕𝑥𝑓.
Warning: This is only for two variables
The second derivative test only works for 𝑓(𝑥,𝑦). There is no analog for 𝑓(𝑥,𝑦,𝑧) in this class.
Sample Question

Use the second derivative test to classify the critical point (0,0) of the function

𝑓(𝑥,𝑦)=𝑥3+𝑥2+𝑦3−𝑦2.

Solution. Start by computing the partial derivatives:

∇𝑓=(3𝑥2+2𝑥3𝑦2−2𝑦)⟹{𝑓𝑥=3𝑥2+2𝑥𝑓𝑦=3𝑦2−2𝑦.

We now do partial differentiation a second time on each of these. Depending on your notation, you can write this as either

∇𝑓𝑥=(6𝑥+20)∇𝑓𝑦=(06𝑦−2)

or

𝑓𝑥𝑥=6𝑥+2,𝑓𝑥𝑦=𝑓𝑦𝑥=0,𝑓𝑦𝑦=6𝑦−2.

Again, the repeated 𝑓𝑥𝑦=𝑓𝑦𝑥 is either 𝜕𝜕𝑦(6𝑥+2)=0 or 𝜕𝜕𝑥(6𝑦−2)=0; for well-behaved functions, you always get the same answer for 𝑓𝑥𝑦 and 𝑓𝑦𝑥.

At the origin, we get

𝐴=6⋅0+2=2𝐵=0𝐶=6⋅0−2=−2.

Since 𝐴𝐶−𝐵2=−4<0, we output the answer “saddle point”.□

Sample Question
Compute the critical points of 𝑓(𝑥,𝑦)=𝑥𝑦+𝑦2+2𝑦 and classify them using the second derivative test.

Solution. Start by computing the gradient:

∇𝑓=(𝑦𝑥+2𝑦+2).

Solve the system of equations 𝑦=0 and 𝑥+2𝑦+2=0 to get just (𝑥,𝑦)=(−2,0). Hence this is the only critical point.

We now compute the second derivatives:

𝑓𝑥𝑥=𝜕𝜕𝑥(𝑦)=0𝑓𝑥𝑦=𝑓𝑦𝑥=𝜕𝜕𝑦(𝑦)=𝜕𝜕𝑥(𝑥+2𝑦+2)=1𝑓𝑦𝑦=𝜕𝜕𝑦(𝑥+2𝑦+2)=2.

These are all constant functions in this example; anyway, we have 𝐴=0, 𝐵=1, 𝐶=2, and 𝐴𝐶−𝐵2=−1<0, so output “saddle point”.□

§17.7 [EXER] Exercises

Exercise 17.1. Compute the critical point(s) of 𝑓(𝑥,𝑦)=𝑥3+2𝑦3−6𝑥𝑦 and classify them as local minimums, local maximums, or saddle points.
Exercise 17.2. Compute the critical point(s) of 𝑓(𝑥,𝑦,𝑧)=𝑥2+𝑦3+𝑧4 and classify them as local minimums, local maximums, or saddle points.
Exercise 17.3 (*). Does there exist a differentiable function 𝑓:ℝ2→ℝ such that every point in ℝ2 is a saddle point?
Exercise 17.4 (*). Give an example of a differentiable function 𝑓:ℝ2→ℝ with the following property: every lattice point (𝑥,𝑦) (i.e. a point where both 𝑥 and 𝑦 are integers) is a saddle point, and there are no other saddle points. For example, (2,−7), (100,100), and (−42,−13) should be saddle points, but (12,0), (𝜋,−2), and (7,11) should not be.