# 011. Finding a Cubic Function

#### Given a cubic function $f(x) = ax^3 + bx^2 + cx + d$ for a real number $a > 0$, $f(x)$ has a local minimum $-1$ and a local maximum $1$ on the interval $[-1, 1]$. When $f(1) = 1$ and $f(-1) = -1$, find $f(x)$.

A naive approach to find all coefficients is too complex. Rather using the following form is much more helpful to find them. Let $f'(\alpha) = f'(\beta) = 0$. \begin{aligned} f(x) &= a(x - 1)(x - \alpha)^2 + 1 \\ &= a \{ x^3 - (1 + 2\alpha)x^2 + (2\alpha + \alpha^2)x \} - a\alpha^2 + 1\\\\ f(x) &= a(x + 1)(x - \beta)^2 - 1 \\ &= a \{ x^3 + (1 - 2\beta)x^2 + (-2\beta + \beta^2)x \} + a\beta^2 - 1 \end{aligned}

Comparing coefficients, \begin{aligned} &\begin{cases} \; \beta - \alpha = 1 \\\\ \; (\alpha + \beta)(\alpha - \beta + 2) = 0 \\\\ \; a (\alpha^2 + \beta^2) = 2 \end{cases} \\\\ &\implies \alpha + \beta = 0 \\\\ &\implies \alpha = -\frac{1}{2}, \quad \beta = \frac{1}{2}, \quad a = 4 \\\\ &\implies f(x) = 4(x - 1)\left( x + \cfrac{1}{2} \right)^2 + 1 = 4x^3 -3x \end{aligned}