# Find $p$ and $q$ such that $x^2+px+q<x$ iff $x \in (1,5)$

Find $$p$$ and $$q$$ such that $$x^2+px+q iff $$x \in (1,5)$$

I tried the following: $$x^2+px+q = (x+\frac{p}{2})^2+q-\frac{p^2}{4}$$ where the global minimum is $$q-\frac{p^2}{4}$$ if $$x = \frac{-p}{2}$$ However this doesn't seem to help with the problem at hand...

First rearrange as follows: $$x^2+px+q Recall from the properties of parabolas that $$ax^2+bx+c<0$$ between the (real) roots of the equation if $$a>0$$. So since in our case $$a=1>0$$, the parabola $$x^2+(p-1)x+q<0$$ between its zeros. So since we are given that $$x\in(1,5)$$ is the solution set, we surmise from above that $$x^2+(p-1)x+q=(x-1)(x-5)=x^2-6x+5\implies p=-5$$ and $$q=5$$
So $$1$$ and $$5$$ are the roots of $$x^2+px + q = x$$:
\begin{align*} (x-1)(x-5) &= 0\\ x^2 - 6x + 5 &= 0\\ x^2 - 5x + 5 &= x\\ p &= -5\\ q&= 5 \end{align*}