Finding Critical Points - CriticalPoints.nb

Finding the Critical Points

Define the function, let's say f(x), then find the solutions of f '(x)=0.

This method will obviously only find critical points, where the first derivative equals 0. Mathematica is not very helpful in finding critical points where the first derivative fails to exist.

f[x_]=x^4-3x^3+x^2+3x+7

Solve[f'[x]==0,x]

Here is another example:

f[x_]=x^2 Exp[x]

Solve[f'[x]==0,x]

Using the Second Derivative Test

Here is our last example again:

f[x_]=x^2 Exp[x]

Solve[f'[x]==0,x]

Next, we compute the second derivative at x=-2 and at x=0:

f''[-2]

Here is its numerical value:

N[f''[2]]

f''[0]

Since the second derivative is negative at x=-2, x=-2 is a local maximum; at x=0, the second derivative is positive, henceforth a local minimum occurs at x=0. Let's check this graphically:

Plot[f[x],{x,-6,1}]

The Graphical Approach

If Mathematica is unable to solve the equation f '(x)=0 algebraically, we can still graph the first derivative to estimate where it is equal to 0. Here is an example (Remember that "Log[x]" denotes the natural logarithm!)

f[x_]=Log[x]Sin[x]

f'[x]

The following graph depicts f(x) in red, and f '(x) in blue, for x-values between 0 and 10. We can see that in this example critical points occur at about x=0.4, x=2.1, x=4.8 and x=7.9.

Plot[{f[x],f'[x]},{x,0,10},PlotStyle->{{AbsoluteThickness[2],RGBColor[1,0,0]},{AbsoluteThickness[2],RGBColor[0,0,1]}}]

An Application: Snell's Law

This example refers to Chapter 5.5, Problems 21 and 22. With the notation of Figure 5.74, we have to minimize the time t(x) needed for the light ray to travel from Point A to Pint B. 
t(x) is given by

t[x_]= Sqrt[(c-x)^2+a^2]/(Subscript[v, 1])+ Sqrt[x^2+b^2]/(Subscript[v, 2])

t'[x]

It is quite hard to solve the equation t '(x)=0 for x, but if you read the problem carefully, you will see that that might not be necessary to do. Evaluate the next command only if you have some spare time to wait for the answer.

Solve[t'[x]==0,x]

Instead we will solve for (Subscript[v, 1]):

sol=Solve[t'[x]==0,(Subscript[v, 1])]

... and thus the quotient  (Subscript[v, 1])/(Subscript[v, 2])equals:

(Subscript[v, 1])/(Subscript[v, 2])==Simplify[sol[[1,1,2]]/(Subscript[v, 2])]

Note that the right side is indeed the quotient ((sin (Subscript[θ, 1]))/(sin (Subscript[θ, 2]))).

Why all this? We now know that the critical point satisfies Snell's Law. But is the crtitical point an absolute minimum?
Let's look at the second derivative.

t''[x]

Simplify[t''[x]]

Written like this you can see that the second derivative will always be positive, and thus the solution given by Snell's Law is indeed an absolute minimum.

Etc.

Author: H. Knaust (helmut@math.utep.edu)
Created: August 2000
Last Edits: March 5, 2012