Formula for smallest distance between two parabolas I have been struggling with this problem I came across:

Create a general formula for finding the closest points between two
  parabolas. Given that the parabolas have opposing concavity and are not interesecting.

I want to answer this problem in the simplest way possible so I can plug in any a, b, and c and get out a value that will give me the points  that are closest together in pair of parabolas.
I have tried different approaches but I end up having to solve for x when x has exponents up to the power of three and I haven't been able to solve them correctly or efficiently.
My closest attempt is the following (sorry to be wordy):
The two parabolas $$f_1(x)=ax^2+bx+c$$$$f_2(x)=gx^2+hx+j$$ have the same slope at the closest distance between them.
 So I realized I needed a function that returned an x value based on a given slope (because the derivative of these parabolas are ax + b.) The functions are$$x_1(m)=\frac{m-b}{2a}$$ $$x_2(m)=\frac{m-h}{2g}$$
If I know that those are my x's and I know that at some m, the closest distance exists, then I can try to create a formula for finding the m that gives the closest distance. To do that we plug the 'x' functions into the distance formula.
$$d(m)=\sqrt{[x_1(m)-x_2(m)]^2+[f_1(x_1(m))-f_2(x_2(m))]^2}$$
and because this is a type of optimization problem, we can remove the square root (square both sides) before finding the derivative. We need to find the roots of the derivative to find our relative extrema of d(m). (for readability x1(m) -> x1 and f2(m) -> f2 etc.)
$$d'(m)=2(x_1-x_2)(x_1'-x_2')+2\Big[f_1(x_1)-f_2(x_2)\Big]\Big[f_1'(x_1)x_1'-f_2'(x_2)x_2'\Big]$$
divide both sides by two (remember, optimization) and expand the functions
$$d'(m)=(\frac{m-b}{2a}-\frac{m-h}{2g})(\frac{1}{2a}-\frac{1}{2g})+\Big[a(\frac{m-b}{2a})^2+b(\frac{m-b}{2a})+c-g(\frac{m-h}{2g})^2-h(\frac{m-h}{2g})-j\Big]\Big[a(\frac{m-b}{2a})(\frac{1}{2a})+b(\frac{1}{2a})-g(\frac{m-h}{2g})(\frac{1}{2g})-h(\frac{1}{2g})\Big]$$
But now here I am stuck. I don't know how to solve for m but I can see where m's roots are on a graphing calculator.
TL;DR used distance formula on two parabolas but ended with cubic functions that I don't know how to solve for. Help me find a way to complete this problem.
P.S. there are other questions covering this topic but they do not discuss a general formula for this.

I have an approach,
but there probably is one or more errors,
so I'll enter what I have
and hope that
others can
correct/complete this.
To start,
the two parabolas
have opposite direction,
so we can write them as
$f(x) = x^2+ax+b$
and
$g(x) = -x^2+cx+d$.
The derivatives are
$f'(x) = 2x+a$
and
$g'(x) = -2x+c$.
If the slope of $g(z)$
is the same as the slope of
$f(x)$,
then
$-2z+c = 2x+a$
or
$z = \frac12(c-a)-x
$.
The two points are
$(x, f(x))
=(x, x^2+ax+b)
$
and
$\begin{array}\\
(z, g(z))
&=(\frac12(c-a)-x, -(\frac12(c-a)-x)^2+c(\frac12(c-a)-x)+d)\\
&=(\frac12(c-a)-x, -(\frac14(c-a)^2-(c-a)x+x^2)+\frac12c(c-a)-cx+d)\\
&=(\frac12 u-x, -(\frac14 u^2-ux+x^2)+\frac12cu-cx+d)
\qquad\text{where } u = c-a\\
\end{array}
$
The distance squared
between these points is
$\begin{array}\\
D
&=(x-(\frac12 u-x))^2+\left(x^2+ax+b-(-(\frac14 u^2-ux+x^2)+\frac12cu-cx+d)\right)^2\\
&=(2x-\frac12 u)^2+\left(x^2+ax+b+(\frac14 u^2-ux+x^2)-\frac12cu+cx-d\right)^2\\
&=(2x-\frac12 u)^2+\left(2x^2+x(a-u+c)+b+\frac14 u^2+\frac12cu+d)\right)^2\\ 
&=(2x-\frac12 u)^2+\left(2x^2+2ax+b+\frac14 u^2+\frac12cu+d\right)^2\\ 
&=(2x-\frac12 u)^2+\left(2x^2+2ax+v\right)^2
\qquad\text{where } v = b+\frac14 u^2+\frac12cu+d\\ 
\end{array}
$
The derivative is
$\begin{array}\\
D'
&=2(2x-\frac12 u)+2(4x+2a)(2x^2+2ax+v)\\
&=4x-u+4(2x+a)(2x^2+2ax+v)\\
&=x (8 a^2 + x (24 a + 16 x) + 8 v + 4) + 4 a v - u
\qquad\text{(according to Wolfy)}
\end{array}
$
The next step should be
to find the root(s) of this,
but since there probably is a an error,
I'll leave it at this.
