$f(x)$ and $g(x)$ are monic cubic polynomials, with $f(x)-g(x)=r$. If $f$ has roots $r+1$ and $r+7$, and $g$ has roots $r+3$ and $r+9$, then find $r$. 
Let $f(x)$ and $g(x)$ be two monic cubic polynomials, and let $r$ be a real number. Two of the roots of $f(x)$ are $r+1$ and $r+7$. Two of the roots of $g(x)$ are $r + 3$ and $r + 9,$ and$$f(x) - g(x) = r$$for all real numbers $x.$ Find $r.$

So far, I have $$f(x)=(x-r-1)(x-r-7)(x-p)$$ and $$g(x)=(x-r-3)(x-r-9)(x-q).$$ From $f(x)-g(x)=r$, I know that their constant terms differ by $r$. I expanded the two functions but it was too complicated. I also plugged in $x=r+1,r+7,r+3,r+9$ into $f(x)-g(x)=r$, but it didn't do much.
Thanks in advance!!!!!
 A: Hint: We have $f(r+3)=r$ (why ?) and $p=\frac{9}{8}r + 3$ easily follows. Then, $f(r+9)=r=-2r + 96$. Can you finish from there ?
A: Your approach is fine. Note that\begin{multline}f(x)-g(x)=\\=(4-p+q)x^2+(2 r p+8p-12 q-2 q r-4 r-20)x-p r^2+q r^2-8 p r+12 q r-7 p+27 q.\end{multline}So, $4-p+q=0$; in other words, $p=q+4$. Replacing $p$ with $q+4$ in the coefficient of $x$ in $f(x)-g(x)$, we get that $4(3-q+r)=0$; in other words, $q=r+3$. And if replace $q$ with $r+3$ in the constant term of $f(x)-g(x)$, we get $32$. But we want this to be equal to $r$. Therefore, $r=32$.
A: Some properties of these two polynomials may be worth remarking upon first:
•  because  $ \ f(x) \ = \ g(x) + r \ \ , \ \ r \ $ real, the curves of the two functions never intersect;
•  for the same reason, the quadratic $ \ (b) \ $ and linear $ \ (c) \ $ coefficients are identical ;
•  from the given information about their respective zeroes, we determine that  $ g(r + 1) \ = \ -r \ \ , $ $ g(r + 3) \ = \ 0 \ \ , \ \ g(r + 7) \ = \ -r \ \ , \ \ g(r + 9) \ = \ 0 \ \ . $
We will also use your notation to write $ \ f(p) \ = \ 0 \ \ , \ \ g(q) \ = \ 0 \ \ .  $  Since the polynomials have three real zeroes, their curves have two relative extrema (the cubic "S - curve").  This tells us something significant about the zeroes:  "shifting" $ \ g(x) \ $ vertically by $ \ r \ $ moves the zeroes of $ \ g(x) \ $ at $ \ (r + 3) \ $ and $ \ (r + 9) \ $ "leftward" to the zeroes of $ \ f(x) \ $ at $ \ (r + 1) \ $ and $ \ (r + 7) \ \ , $  implying that $ \ r \ > \ 0 \ \ . $  (The relative maximum moves away from the $ \ x-$axis and the relative minimum, towards it.)  The third zero of these polynomials must therefore be between the other two $ \ ( \ r + 1 \ \le \ p \ \le \ r + 7 \ \ , \ \ r + 3 \ \le \ q \ \le \ r + 9 \ ) \ \ $  and $ \ q \ $ should "move rightward" to $ \ p \ \ . $  This last statement is confirmed from the Viete relations:  the quadratic coefficient is $$ b \ \ = \ \ -[ \ (r + 1) \ + \ p \ + \ (r + 7) \ ] \ \ = \ \  -[ \ (r + 3) \ + \ q \ +  \ (r + 9) \ ] $$ $$ \Rightarrow \ \ 2r \ + \ p \ + \ 8 \ \ = \ \ 2r \ + \ q \ + \ 12 \ \ \Rightarrow \ \  p \ = \ q + 4 \ \ .  $$
For what follows, we will re-label the given zeroes in terms of $ \ \rho \ = \ (r + 3) \ \ . \ $  The linear coefficient of these polynomials is then
$$ c \ \ = \ \ (\rho - 2)·(q + 4) \ + \ (\rho + 4)·(q + 4) \ + \ (\rho - 2)·(\rho + 4)  $$ $$ = \ \ \rho · q \ + \ (\rho + 6) · q \ + \ \rho ·  (\rho + 6)  $$
$$ \Rightarrow \ \ \rho^2 \ + \ 2·q·\rho \ + \ 10·\rho \ + \ 2·q \ \ = \ \ \rho^2 \ + \ 2·q·\rho \ + \ 6·\rho \ + \ 6·q \ \ \Rightarrow \ \ \rho \ \ = \ \ q \ \ . $$
So we discover that $ \ q \ = \ (r + 3) \ $ is in fact a double zero of $ \ g(x) \  \ . $  In turn, we find that $ \ p \ = \ q + 4 \ = \ (r + 3) + 4 \ = \ (r + 7) \ $ is a double zero of $ \ f(x) \ \ . $
If we designate $ \ d \ $ as the "constant term" of $ \ g(x) \ \ , \ $ we find
$$ d \ = \ -(r + 3)^2·(r + 9) \ \  \Rightarrow \ \ d \ + \ r \ = \ r \ - \ (r + 3)^2·(r + 9)   \ \ = \ \ -(r + 1)·(r + 7)^2 $$
$$ \Rightarrow \ \ -r^3 \ - \ 15r^2 \ - \ 62r \ - \ 81 \ \ = \ \ -r^3 \ - \ 15r^2 \ - \ 63r \ - \ 49 \ \ \Rightarrow \ \ r \ = \ 32 \ \ . $$
Our polynomials are therefore
$$ g(x) \ \ = \ \ (x - 35)^2 \ · \ (x - 41) \ \ = \ \ x^3 \ - \ 111x^2 \ + \ 4095x \ - \ 50225 \ \ \ \text{and} $$
$$ f(x) \ \ = \ \ (x - 33)  \ · \ (x - 39)^2 \ \ = \ \ x^3 \ - \ 111x^2 \ + \ 4095x \ - \ 50193 \ \ = \ \ g(x) \ + \ 32 \ \ . $$
[The relative extrema of $ \ g(x) \ $ are located at $ \ (35 \ , \ 0) \ $ and $ \ (39 \ , \ -32) \ \ , $ while those of $ \ f(x) \ $ are $ \ (35 \ , \ 32) \ $ and $ \ (39 \ , \ 0) \ \ . \ ] $
Incidentally, there is a complementary pair of polynomials for $ \ r \ = \ -32 \ \ : $
$$ g(x) \ \ = \ \ (x + 25)^2 \ · \ (x + 31) \ \ = \ \ x^3 \ + \ 81x^2 \ + \ 2175x \ + \ 19375 \ \ \ \text{and} $$
$$ f(x) \ \ = \ \ (x + 23)  \ · \ (x + 29)^2 \ \ = \ \ x^3 \ + \ 81x^2 \ + \ 2175x \ + \ 19343 \ \ = \ \ g(x) \ - \ 32 \ \ . $$
A: Let $\alpha$, $\beta$, and $\gamma$ be the roots of a monic cubic polynomial $p$.  Then:
$$p(x) = (x - \alpha)(x - \beta)(x - \gamma)$$
$$= x^3 - (\alpha + \beta + \gamma)x^2 + (\alpha\beta + \alpha\gamma + \beta\gamma)x - \alpha\beta\gamma$$
Matching up the coefficients with the general cubic $x^3 + bx^2 + cx + d$ (I'm omitting $a$ because we're given that it's 1) gives:
$$\alpha + \beta + \gamma = -b$$
$$\alpha\beta + \alpha\gamma + \beta\gamma = c$$
$$\alpha\beta\gamma = -d$$
These equations are called Vieta's formulas.
Now, let's consider two polynomials that are simple horizontal shifts of the given ones:
$$f_r(x) = f(x-r): \alpha = 1, \beta = 7, \gamma = s$$
$$g_r(x) = g(x-r): \alpha = 3, \beta = 9, \gamma = t$$
Since they differ only by a constant ($r$), they must have the same $b$ and $c$ coefficients, and have $d$ differ by $r$.  So,
$$1 + 7 + s = 3 + 9 + t$$
$$7 + s + 7s = 27 + 3t + 9t$$
$$-7s + 27t = r$$
Or, rearranging a bit:
$$s - t = 4\tag{1}$$
$$8s - 12t = 20\tag{2}$$
$$r + 7s - 27t = 0\tag{3}$$
A simple linear system of equations that can be solved for $r$, $s$, and $t$.  From (1), $s = t + 4$.  Substituting this into (2) gives:
$$8(t + 4) - 12t = 20$$
$$8t + 32 - 12t = 20$$
$$-4t = -12$$
$$t = 3$$
$$s = t + 4 = 7$$
Finally, substituting into (3) gives:
$$r + 7(7) - 27(3) = 0$$
$$r + 49 - 81 = 0$$
$$r = 32$$
