# 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.

## 7 thoughts on “Three easy steps to find all global extrema of a function”

1. Carlo

We claim maximising the square of a quantity is equivalent to maximising the absolute value of the quantity, that is x^2 >= y^2 iff abs(x) >= abs(y).

To prove the ‘only if’ sqrt both sides of the first inequality and sqrt(x^2) = abs(x) by definition, while the ‘if’ is easily shown by squaring both sides of the second inequality. The direction of the inequalities isn’t changed by either of these operations since both the square function and the sqrt function are strictly increasing for non-negative integers, and abs(x) and x^2 are always non-negative.

Substituting y = 5x-6, the expression to maximise is thus abs(4 cos^4 (y) – 3). Since – 3 is a *negative* constant, we are trying to minimise 4 cos^4 (y). We have 4 cos^4(y) >= 0 for all y (it’s a square), so we seek the value for which 4 cos^4 (y) = 0, that is cos y = 0. This is achieved when y = pi/2 (for example) and x = pi/10 + 1.2 . Finally, the value of the original expression in this case is (-3)^2 = 9.

1. Master Maths blogger Post author

Dear Carlo, your solution is almost correct. The only unclear place is the following. In addition to the fact that -3<0 at the same time (not after that) we should say that the lower bound of 4cos^4(y) is 0. If the first term was 4+cos^4(y) instead of 4cos^4(y), we should maximise this first term, not minimise. In such a case it's easier to argue in the opposite direction starting from the most internal function, not the most external. Here is the first step: cos(5x-6) varies between -1 and 1 over all real x, please continue to get a range (hence the greatest value) for the original function. We hope that you will complete the solution sooner than anyone else. Good luck!

1. Carlo

Right. I’ll give it a try. Let y = cos(5x-6). Then we have:
the range of cos(5x-6) is [-1,1]. That is, -1<=y=y^4=<1, in other words y^4==0. Putting everything together, 0<=y^4<=1, so the range of cos^4(5x-6) is [0,1].
Multiplying the previous inequality by 4, we get 0<=4y^4<=4, so the range of 4 cos^4(5x-6) is [0,4].
Subtracting 3 from the previous inequality we get -3<=4y^4-3=(4y^4-3)^2. This is enough to complete the proof.

1. Carlo

Sorry, I messed up. The last two phrases should read:
Subtracting 3 from the previous inequality we get -3<=4y^4-3=(4y^4-3)^2. This is enough to complete the proof.

1. Master Maths blogger Post author

It was a spam checker that was trying to quickly filter our a potential spam comment. Sorry about the confusion,

2. Master Maths blogger Post author

Dear Carlo, ok. Your are attempts are enough to claim the prize. Let us briefly summarise the solution: cos(5x-6) has the range [-1,1], then cos^4(5x-6) has the range [0,1], then 4cos^4(5x-6) has the range [0,4], then 4cos^4(5x-6)-3 has the range [-3,1], finally (4cos^4(5x-6)-3)^2 has the range [1,9]. The maximum value 9 is attained then cos(5x-6)=0, which is satisfied by infinitely many x. Thank you for your efforts!