TITLE: Does this polynomial exist?
QUESTION [6 upvotes]: I'm looking for a polynomial $P(x)$ with the following properties:

$P(0) = 0$.
$P\left(\frac13\right) = 1$
$P\left(\frac23\right) = 0$
$P'\left(\frac13\right) = 0$
$P'\left(\frac23\right) = 0$

From 1 and 3 we know that $P(x) = x\left(x - \frac23\right)Q(x)$. From 4 and 5 we know that $P'(x) = \alpha\left(x - \frac13\right)\left(x - \frac23\right)$.
$$
\begin{align}
P(x) & = \alpha\int\left(x - \frac13\right)\left(x - \frac23\right)\text{d}x \\
& = \alpha\left(\frac13x^3 - \frac12x^2 + \frac29x + \text{C}\right)
\end{align}
$$
Now 1 implies that the constant is $\text{C} = 0$, but 3 implies that the constant is $\text{C} = -\frac{2}{81}$. Am I doing something wrong or does this polynomial not exist? 
If it doesn't exist, how close could I get to making a polynomial that satisfies these 5 conditions?

REPLY [16 votes]: This is the same solution as Ross's, but from a more linear algebra focused perspective.
You have five linearly independent conditions, so a polynomial with five parameters should work.
$P(x) = ax^4 + bx^3 + cx^2 + dx + e$
Now your five conditions can be written as such:

$e = 0$
$a(\frac{1}{3})^4 + b(\frac{1}{3})^3 + c(\frac{1}{3})^2 + d(\frac{1}{3}) + e = 1$
$a(\frac{2}{3})^4 + b(\frac{2}{3})^3 + c(\frac{2}{3})^2 + d(\frac{2}{3}) + e = 0$
$4a(\frac{1}{3})^3 + 3b(\frac{1}{3})^2 + 2c(\frac{1}{3}) + d = 0$
$4a(\frac{2}{3})^3 + 3b(\frac{2}{3})^2 + 2c(\frac{2}{3}) + d = 0$

We can group these five equations together in matrix-vector form as 
$\left( \begin{array}{ccccc}
0 & 0 & 0 & 0 & 1 \\
\frac{1}{81} & \frac{1}{27} & \frac{1}{9} & \frac{1}{3} & 1 \\
\frac{16}{81} & \frac{8}{27} & \frac{4}{9} & \frac{2}{3} & 1 \\
\frac{4}{27} & \frac{3}{9} & \frac{2}{3} & 1 & 0 \\
\frac{32}{27} & \frac{12}{9} & \frac{4}{3} & 1 & 0 \end{array} \right) \cdot \left( \begin{array}{c} a \\ b \\ c \\ d \\ e \end{array} \right) = \left( \begin{array}{c} 0 \\ 1 \\ 0 \\ 0 \\ 0 \end{array} \right) $
Use a computerized linear algebra solver to find
$\left( \begin{array}{c} a \\ b \\ c \\ d \\ e \end{array} \right) = \left( \begin{array}{c} 81 \\ -108 \\ 36 \\ 0 \\ 0 \end{array} \right)$
So your polynomial is $P(x) = 81x^4 - 108x^3 + 36x^2$. This is the same one Ross Millikan found.
The advantage of this method is that it is more flexible. You could start with $P(x) = ax^{50} + bx^{42} + cx^9 + dx^2 + e$ if you wanted a find a degree 50 polynomial that would also work. You could even start with a function that wasn't polynomial at all. The disadvantage is that if you have more than 4 parameters or so then solving the system will be too cumbersome to do by hand, and you'll have to rely on a computer.