A Calculus Problem About Finding a Cubic

6 minute read

Published:

I’m teaching Calculus 1 this semester and one of my former students introduced me to the following problem which needs only Calculus 1 ideas.

Problem: Let $f(x)$ be a cubic polynomial where the deg 3 term is $x^3$; that is, the leading coefficient is $+1$. Let $s(x) = \sin^2(\pi x)$ and $g(x) = f(s(x))$. Suppose know the following:

  1. The function $g$ has exactly 3 local maxima in the interval $[0,1]$ and they all have the same value.
  2. The maximum of $g$ is $\frac{1}{2}$ and the minimum is $0$. Find the $f$.

There are lots of possibilities for the behavior of $f$ and it can be fun to explore what $g$ looks like depending on different coefficients we set for $f$. Here is a Desmos link that’s fun to play with.

To begin, let’s first compute 1st and 2nd derivatives of $g$ and also make some general remarks.

  1. $g’(x) = \pi f’(\sin^2(\pi x))\sin(2\pi x)$ by the double angle formula.
  2. $g’‘(x) = \pi^2 f’’(\sin^2(\pi x))\sin^2(2\pi x) + 2\pi^2f’(\sin^2(\pi x))\cos(2\pi x)$.

The critical points of $g$ in the interval $[0,1]$ occur when $f’(\sin^2(\pi x))=0$ or $\sin(2\pi x)=0$. The latter happens at $x=0,\frac{1}{2},1$. We then see that $g’‘(0)=g’‘(1)=2\pi^2 f’(0)$ while $g’’(\frac{1}{2})=-2\pi^2 f’(1)$. So to test the concavity of local extrema, we need to know the signs of $f’(0)$ and $f’(1)$.

One way to determine that is to determine the location of the local extrema of $f$ (if they exist).

If $f(x)=x^3+bx^2+cx+d$, then $f’(x)=3x^2+2bx+c$ and its roots are $-\dfrac{b}{3}\pm \dfrac{\sqrt{b^2-3c}}{3}$.

Suppose we have distinct real roots here; then $f$ has two local extrema. Note that the local max must be at the smaller value since the leading coefficient of $f$ is $+1$. Interestingly, the two local extrema cannot both be in the interval $(0,1)$. To see why, suppose we have $-b -\sqrt{b^2-3c} \in (0,3)$. Then $b < -\sqrt{b^2-3c}<3+b$ which implies that $-b>\sqrt{b^2-3c}>-(3+b)$ and hence, $b^2>b^2-3c>(3+b)^2$. This means that $0>-3c$ or $0<c$. On the other hand, the other root is supposed to be in $(0,3)$ as well so we have $b<\sqrt{b^2-3c}<3+b$ and so $b^2<b^2-3c<(3+b)^2$ and $0<-3c$ which means $c<0$, a contradiction. Of course, it is possible to have cubics with both local extrema in $(0,1)$ but not if their leading coefficient is $+1$.

Anyways, let’s address the various cases. If the roots of $f’$ are not real, then $f’(x)>0$ which means it is monotonically increasing. In that case, the only critical points of $g$ are the three we already found: $x=0,\frac{1}{2},1$. Moreover, since $f’(0)>0$ and $f’(1)>0$, two are local minima and one is a local maximum. This doesn’t match the properties of $g$. Similarly, if the two local extrema of $f$ are both outside of $[0,1]$, then $g$ again has the three local extrema but two are local maxima and one is a local minimum.

There are some more edge cases such as $f$ having local extrema at $0,\frac{1}{2},1$ or if $f$ has a horizontal inflection point. But let’s take a look at the other scenarios: when $f$ has exactly one local extrema in $(0,1)$ not at $\frac{1}{2}$, whether it be a local max or min.

If $f$ has a local max at say, $\beta \in (0,1)$ and $\beta \neq \frac{1}{2}$, then $f’(0)>0$ and $f’(1)<0$. So the 3 local extrema of $g$ we found before are all local minima. Moreover, $s(x)=\sin^2(\pi x)$ is periodic with period 1 and on $[0,1]$, it also takes on all values in $[0,1]$. It takes on all values twice except for 1 which it takes on once at $\frac{1}{2}$. In particular, there exist $\beta_1,\beta_2$ such that $s(\beta_i)=\beta$. Hence, $g’’(\beta_i) = \pi^2 f’’(\beta)(s’(\beta))^2$ (the next term in $g’’$ is 0 since $f’(\beta)=0$). Since $\beta$ is a local max, we have $f’’(\beta)<0$ and so $g’’(\beta_i)<0$. This gives us 2 local maxima which isn’t enough.

However, if $f$ has a local min at $\beta \in (0,1)$ and $\beta \neq \frac{1}{2}$, then $f’(0)<0$ and $f’(1)>0$. Then we have 3 local maxima at $0,\frac{1}{2},1$ for $g$ and in addition, 2 local minima at $\beta_1,\beta_2$. So this is a good candidate for what $f$ may look like based on the properties of $g$; it has two local extrema with the local max at a point $\alpha <0$ and a local min at $\beta \in (0,1)$ where $\beta \neq \frac{1}{2}$.

Writing $f’(x) = 3(x-\alpha)(x-\beta)$, we have $f(x) = x^3-\frac{3}{2}(\alpha+\beta)x^2+3\alpha \beta x +d$ where $d$ is some constant.

Now, we’re told that the three local max of $g$ on $[0,1]$ all have the same value. Our local maxima are at $0,\frac{1}{2},1$ and so we need $g(0)=g(\frac{1}{2})=g(1)$. But $g(0)=g(1) = f(0)$ and $g(\frac{1}{2})=f(1)$. Since $s(x)$ is periodic with period 1, these local maxima are in fact, global maxima and must equal $\frac{1}{2}$ by the second property. Hence, $f(0)=d=\frac{1}{2}$. Then, $\frac{1}{2} = 1-\frac{3}{2}(\alpha+\beta)+3\alpha \beta + \frac{1}{2}$. Rearranging, we have $3(\alpha+\beta)-6\alpha \beta =2$. This defines a real 1-dim algebraic variety and we’re looking for solutions to the equation where $\alpha <0$ and $\beta \in (0,1)$ and $\beta \neq \frac{1}{2}$. On the other hand, the local minima are in fact, global minima and should take on the value $0$. So we want $g(\beta_i) = f(\beta)=0$. That is, $\beta^3-\frac{3}{2}(\alpha+\beta)\beta^2+3\alpha \beta^2 + \frac{1}{2} = 0$. Doing some algebra, we get $\beta^3-3\alpha \beta^2 = 1$. This defines another real 1-dim algebraic variety and we can try to find where they intersect.

Note that the equation $3\alpha+3\beta-6\alpha \beta = 2$ leads us to conclude that $6\alpha \beta^2 = 3\alpha \beta + 3\beta^2 -2\beta$. The other equation is equivalent to $2\beta^3-6\alpha \beta^2=2$. Putting these together, we have $2\beta^3 -3\beta^2 +(2-3\alpha)\beta-2=0$. There is a cubic formula (similar to the quadratic formula) and we can look for roots of this cubic where we treat $\beta$ as the single variable and $\alpha$ as constant. But this doesn’t get us closer to finding actual values for $\alpha,\beta$. However, we also have graphing tools and we can get an approximation for the values. We’ll find that the two varieties intersect in two points. Only one of the points satisfies our conditions $\alpha<0$ and $\beta \in (0,1)$: $(\alpha,\beta) \approx (-0.87348,0.56067)$. So then, $f(x)\approx x^3+0.46921x^2-1.469202x + 0.5$.

If we use the other point of intersection of the two varieties, we have $(\alpha,\beta) \approx (0.42753,1.64993)$. In this case, $f(s(x))$ will have 3 local minima all equal to $\frac{1}{2}$ and 2 local maxima of the same value around $0.9$.