Given $a,b,c,d,e,f\in\mathbb{Z}$, I'd like to find all $x\in\mathbb{Q}$ such that $$ \sqrt{\frac{ax^2+bx+c}{dx^2+ex+f}}\in\mathbb{Q}. $$ How would one approach such a problem?
As an explicit example, what are the solutions in the case where $(a,b,c,d,e,f)=(1,2,0,1,1,1)$?
Here's a solution due to Boris Alexeev.
We want $x\in\mathbb{Q}$ such that $\sqrt{p(x)/q(x)}\in\mathbb{Q}$. Suppose the roots of $p$ and $q$ are all distinct, since otherwise the problem is easier. Multiplying by $q(x)\in\mathbb{Q}$, we equivalently want $\sqrt{g(x)}\in\mathbb{Q}$, where $g(x):=p(x)q(x)$. That is, we want $(x,y)\in\mathbb{Q}^2$ such that $g(x)=y^2$. Since $g$ has all distinct roots by assumption, this is equivalent to finding rational points on a certain elliptic curve (see this treatment, for example). The desired solutions can therefore be obtained with the help of Magma or Sage.