# Three easy steps to find all global extrema of a function

In this post we discuss global extrema of a real-valued 1-variable function over all reals.

### Step 1: find all stationary points of a given function

By definition a stationary point of a function $$f(x)$$ is a solution of $$f'(x)=0$$. In this step many students waste their time by evaluating the 2nd derivative $$f”(x)$$ at each stationary point to determine if it is a local extremum, maximum or minimum. We shall detect global extrema simply by comparing $$f(x)$$ at all critical points, which is usually easier than $$f”(x)$$.

### Step 2: find all points where the 1st derivative is undefined

This important step is often missed. For example, the derivative of $$f(x)=|x|$$ is never zero.
However, we should certainly consider the point $$x=0$$, where the derivative of $$f(x)=|x|$$ is undefined. Otherwise we miss the global minimum of $$f(x)=|x|$$ at $$x=0$$ over all reals.

### We should consider all critical points and possibly more

All points where $$f'(x)=0$$ or $$f'(x)$$ is undefined are usually called critical. Sometimes we might not be sure if the derivative $$f'(x)$$ is well-defined or not.

A common mistake in sketching the graph $$y=|\cos x|$$ is to draw neighbourhoods of the points $$x=\frac{\pi}{2}+\pi n$$ for any integer $$n$$, where $$\cos x=0$$, either as smooth arcs in $$y=\cos^2 x$$ above or as vertical cusps in $$y=\sqrt{|\cos x|}$$ below.

In fact, the neighbourhoods of these points locally look like $$y=|x|$$, see the picture at the beginning of the post. Indeed, $$y=cos x$$ looks like $$y=x$$ around the points $$x=\frac{\pi}{2}+\pi n$$. So the derivative of $$f(x)=|\cos x|$$ is actually undefined at $$x=\frac{\pi}{2}+\pi n$$ for any integer $$n$$.

However we don’t need to justify this conclusion if we are interested only in extreme values of $$f(x)=|\cos x|$$. We may simply consider all “potentially critical” points, namely $$x=\frac{\pi}{2}n$$ for any integer $$n$$, where $$f'(x)=0$$ (at local extrema $$x=\pi n$$ of $$y=\cos x$$) or where $$f'(x)$$ might be undefined for $$f(x)=|\cos x|$$.

### Step 3: compare the function values at all critical points

Finally we should simply compare the values of $$f(x)$$ at all (potentially) critical points and choose the points that have the largest and smallest values.

For instance, $$f(x)=|\cos x|$$ over all real x has the largest value 1at the infinitely many global maxima $$x=\pi n$$ and the smallest value 0 at the infinitely many global minima $$x=\frac{\pi}{2}+\pi n$$ for any integer $$n$$. Here is the full justification of the extreme values: $$0\leq|\cos x|\leq 1$$ for all $$x$$.

If we are interested in extreme values of a function over a closed interval, not over the whole real line, then there is an extra step that will be discussed in one of our future posts.

The traditional riddle below is Problem 3.5 in our current MAT 2014 course, which was modified from original Question 1B in past exam MAT 2007.

• Riddle 18: Find the greatest value of $$(4\cos^4(5x-6)-3)^2$$ over all real $$x$$.
• How to submit: to write your full answer, submit a comment.
• Hint: you can write a full solution to this riddle in 1-2 lines.
• Warning: using derivatives is possible, but is hard to justify.
• Prize: free 1-year access to one of our interactive web tutorials.
• Restriction: only the first correct public answer will be rewarded.
• Update: Carlo has solved the problem, see this attempt and the final solution.

If you wish to receive e-mails about our new posts (for a quicker chance to answer a riddle and win a prize) or distance courses, please contact us and tick the box “keep me updated”. You can easily unsubscribe at any time by e-mailing “unsubscribe” in the subject line.