Proving that an algebraic expression cannot be a square Say that I have an expression in several variables, like $zxy+z^5x^2y^2 + xy + 24z$. To prove that it's not a perfect square, I write it in terms of one of the variables, say $x$. This makes it  a polynomial of degree $2$. 
Now expand out $(a+bx)^2$ and match up the corresponding coefficients, and if the coefficients are impossible given what I know about the other variables, does this prove that the expression cannot be a perfect square? Thanks.
 A: The polynomial ring $\mathbb{C}[x_1,\ldots,x_r]$ is a unique factorization domain. This means that for a polynomial $P$ you can write it as $P=P_1^{\alpha_1}\ldots P_r^{\alpha_r}$, with $P_i$ irreducible. Of course, we don't know yet this factorization otherwise we would know it is a square.
Let's take a variable $x$ that appears in the polynomial. I would take the variable which appears with smallest maximal degree. You can write $P$ as a polynomial in $x$ with coefficients that are polynomials in the other variables. Take derivative $P_x$ with respect to $x$.  Compute the greatest common divisor $D$ of $P$ and $P_x$. There are algorithms for that. Search for the keyword resultant and/or discriminant. Divide $P$ by $D$. That should gives us $R=P_1\ldots P_r$. 
If $P$ is a square it should be divisible by $R^2$. Dividing $P/R^2$ subtracts $2$ from each of the $\alpha_i$. 
Repeating the above procedure with $P/R^2$ instead of $P$ successively, eventually gets you to the polynomial $1$ if and only if $P$ was a square. If you ever get that the $P$ you are working with in one of the iterations is not divisible by the corresponding $R^2$ then it wasn't a square.
