# Method to square polynomials by making a change of variable

I am working with elliptic curves defined over $\mathbb{Q}(t)$, my current task is to search is to search torsion-free points in these curves after possibly changing $t$ by a rational function $r(u)$. For that, I consider the elliptic curve $$E: y^2+a_1 xy +a_3 y=x^3+a_2x^2+a_4x+a_6$$ where $a_i\in \mathbb{Q}[t]$ and I do computational searches between rational functions $$R_{a}\in\mathbb{Q}(t)$$ where $a$ is a parameter ranging over a subset of $\mathbb{Z}^n$ for some $n$ and selecting those for which the discriminant over $y$ after substituting $x$ by $R_a$ gives us a rational function of the form $$R_0^2P$$ where $P$ or $P^{-1}$ is an irreducible polynomial in $\mathbb{Q}[t]$. Once I have obtain this I want to obtain a rational function $r\in\mathbb{Q}(u)$ such that $$P(r)=P_0^2$$ for some $P_0\in\mathbb{Q}(u)$, obtaining in this form a possibly torsion-free point of the elliptic curve $$E: y^2+a_1(r) xy +a_3(r) y=x^3+a_2(r)x^2+a_4(r)x+a_6(r)$$ In the quadratic case (when P is quadratic) this is easy to do, the problem is when $P$ is not quadratic. Do you know any method to do this? Or any necessary or sufficient conditions are given?

-