# Exercise problem with one maximum, two minima and one saddle points

I want to build a single variable objective function (as an exercise problem in optimization for students) which has one maximum, two minima and an saddle point. How would I go about creating it? The function should preferably be a polynomial with integer coefficients so that students can easily solve the resulting equations.

I started with 5th degree polynomial $f(x)$. So the first order condition gives,

$f'(x) = (x-a)(x-b)(x-c)(x-d) = 0$

I then tried to solve for $a, b, c$ and $d$ by assuming:

1. $f''(a) = 5$ for setting $a$ as the minimum.
2. $f''(b) = 0, f'''(b)=10$ for setting $b$ as an saddle point.
3. $f''(c) = -5$ for setting $c$ as the maximum.
4. $f''(d) = 0, f'''(d)=0$ for setting $d$ as a minimum which looks like an inflection point.

However, the equations get cumbersome after a point and I have to resort to trial and error or Matlab's symbolic math to solve them. Even then, I only end up with floating point or complex coefficients.

Basically, I would like to explain the above concepts with just one exercise problem.

• @Semiclassical Updated. Commented Sep 3, 2014 at 16:07
• You need to specify the following: Are the points of interest (minimum, maximum, inflection points) to be contained in a finite interval, or over the entire real line? Are the number of such points exact--that is, you require exactly one maximum, two minima, and one inflection point? Are the extrema relative or global or either? Commented Sep 3, 2014 at 16:16
• @heropup A minimal problem would do. What do you mean by over the entire real line? a, b, c and d are just 4 points. So, the finite interval is whatever encloses these points. Commented Sep 3, 2014 at 16:19
• Do you mean that the inflection point must have zero slope at the same time ?
– user65203
Commented Sep 3, 2014 at 16:21
• @YvesDaoust The second order conditions are required to establish whether the point is maximum, minimum or inflection. Commented Sep 3, 2014 at 16:21

Your derivative needs two simple, one double and one triple root. $$f'(x)=(x-a)(x-b)^2(x-c)(x-d)^3.$$ Then $$f(x)=\int f'(x)dx+C,$$ a polynomial of degree 8.

For example, with $$a=\frac32,b=2,c=3,d=4$$,

Nothing simple.

• Thanks. This is what I wanted. The approach rather than a specific function. Commented Sep 3, 2014 at 18:23

Its derivative should have three simple zeroes and a double zero, which is easy to make, maybe: $$f'(x)=(x+1)x(x-1)^2(x-2)$$ and now you can just integrate the thing. Stick whatever constant you like on to make it look nice: $$f(x)=1-x^2 + x^3 + \frac14 x^4 - \frac35 x^5 + \frac16 x^6$$ I'm sure you can fiddle around a bit with the location of the stationary points to get something with small integer coefficients. And here is a graph of the result:

• I want the 2nd and 3rd derivative to be 0 at one of the minima. Commented Sep 3, 2014 at 18:21

If a is the minimum, b the maximum, c the inflection point and d the minimum masquerading as inflection point, we need a triple zero at d.

$f'(x)=(x-a)(x-b)(x-c)^2(x-d)^3$

I'm going to stick with Holographer's answer and use $f'(x)=(x+1)(x)(x-1)^2(x-2)^3$

$f(x)=\frac{1}{8}x^8-x^7+\frac{17}{6}x^6-\frac{13}{5}x^5-\frac{5}{2}x^4+\frac{20}{3}x^3-4x^2$

The result is similar to Holographer's, only the second minimum is flattened out a bit, because of the requirement that d masquerades as an inflection point.

Let's start with a polynomial with an obvious stationary point, the simplest of which is the cubic $y=x^3$. This is a non-decreasing function, so we'll need to alter it if we want minima and maxima. An easy ' perturbation' is to subtract off a term like $x^5$: this produces the requisite extrema without removing the stationary point. So $f(x)=x^3-x^5$ does the trick.