What is the sum of all the integral values of $a$ for which $\frac{ax^2 - 7x + 5}{5x^2 - 7x + a}$ takes all real values?

I've tried to equate this expression to $y$ and frame a quadratic equation in $x$ whose discriminant should be greater than $0$. But the solution is giving too hairy expressions. What could be some shorter way to proceed?

• Think about the asymptotes. You need to have at least one vertical asymptote. And you stand a good chance of missing the real value at the horizontal asymptote, so the graph of the "middle piece" needs to intersect $y=a/5$. – B. Goddard May 16 '17 at 13:00

Note that $a\ne5$, as otherwise, $\displaystyle \frac{ax^2 - 7x + 5}{5x^2 - 7x + a}=1$ for all $x\in\mathbb{R}$.

Suppose that $\forall y\in\mathbb{R}$, $\exists x\in\mathbb{R}$ such that $\displaystyle y=\frac{ax^2 - 7x + 5}{5x^2 - 7x + a}$.

\begin{align*} ax^2-7x+5&=5yx^2-7yx+ay\\ (a-5y)x^2-7(1-y)x+5-ay&=0 \end{align*}

If $a=5y$, the above equation is linear and has a real solution $x$.

If $a\ne 5y$, the above equation is and it has real solution if (*also hold for the case when $a=5y$)

\begin{align*} [-7(1-y)]^2-4(a-5y)(5-ay)&\ge0\\ 49-98y+49y^2-4(5a-25y-a^2y+5ay^2)&\ge0\\ (49-20a)y^2+(2+4a^2)y+(49-20a)&\ge0 \end{align*}

If $a$ and $y$ satisfy the above inequality, then there exists an $x$ such that $\displaystyle y=\frac{ax^2 - 7x + 5}{5x^2 - 7x + a}$.

If $y$ takes all real values, $(49-20a)y^2+(2+4a^2)y+(49-20a)\ge0$ for all $y\in\mathbb{R}$. So $49-20a>0$ and the quadratic equation $(49-20a)y^2+(2+4a^2)y+(49-20a)=0$ either has no real root or has a double real root. Therefore,

\begin{align*} (2+4a^2)^2-4(49-20a)(49-20a)&\le0\\ (1+2a^2+49-20a)(1+2a^2-49+20a)&\le0\\ (a^2-10a+25)(a^2+10a-24)&\le0\\ (a-5)^2(a-2)(a+12)&\le0\\ -12\le a&\le2 \end{align*}