Assuming $f\neq 0$ I'm trying to rewrite $$0 = 2 \cdot g \cdot ((x-a)^2 + 1) - 2 \cdot d \cdot f \cdot (x - a)$$
into a system of equations of the form
$a = $(something not containing $d$)
$d = $(something with $a$ in it)
I'm pretty sure you need to introduce another variable but I'm just not seeing the "trick".