# Is there an easy way to factor polynomials with two variables?

On a recent precal test, I saw a question involving the following expression:

$$(x+1)^2-y^2$$

Which factored out into:

$$(x+y+1)(x-y+1)$$

This wasn't very hard, considering that it was already written as the difference of two squares. I then thought "this is easy, but how would I have done it if it weren't easy?"

Let's say that I had to factor something unholy, such as

$$2 a^2 + a^3 - 2 a^4 - a^5 - 2 b - a b + 4 a^2 b - a^4 b - 2 b^2 + a b^2 + 3 a^2 b^2 + 3 a^3 b^2 + a^4 b^2 - 2 b^3 - 3 a b^3 + a^2 b^3 + a^3 b^3 - 2 b^4 - a b^4$$

Of course, this was reverse-engineered, so I already know that the answer is:

$$(a + 2) (a + b + 1) (b - a^2) (a - b^2 - 1)$$

This, in turn, means that the zeros of the polynomial are located at:

\begin{align} \ a & = -2 \\ a & = -b-1 \\ b & = a^2 \\ a & = b^2+1 \\ \end{align}

One approach that I was thinking about was possibly formatting the polynomial into a table, like so:

$$\begin{array}{c|lcr} & a^0 & a^1 & a^2 & a^3 & a^4 & a^5 \\ \hline b^0 & 0 & 0 & 2 & 1 & -2 & -1 \\ b^1 & -2 & -1 & 4 & 0 & -1 & 0 \\ b^2 & -2 & 1 & 3 & 3 & 1 & 0 \\ b^3 & -2 & -3 & 1 & 1 & 0 & 0 \\ b^4 & -2 & -1 & 0 & 0 & 0 & 0 \\ \end{array}$$

Does this table tell me anything about the underlying factorization?

Given a large polynomial with two variables, is there a reasonably efficient way of factoring it?

I know this is nothing algorithmical but for simple polynomial $F(x,y)$ e.g. with integer coefficients it is an approach. It basically consists of plotting the zeros $Z(F) = \{(x,y) \in \mathbb R^2 | F(x,y)=0\}$.

If you consider two polynomials $F(x,y)$ and $G(x,y)$ then $Z(F\cdot G) = Z(F) \cup Z(G)$. That means if you look at the plot of the zeros, you will probably be able to guess different "components" that were just multiplied together. A plot of your example: As the algebraic curves are usually quite well behaved (usually without many singularities / self intersections $^*$) it can be easy to find low degree factors. In this case e.g. the lines we see that $a = -2$ is one line here, so $(a+2)=0$ must be a factor. We can factor this factor out

$F(a,b)=(-a^4+a^3 b^2-a^3 b+a^2 b^3+a^2 b^2+2 a^2 b+a^2-a b^3+a b^2-b^4-b^3-b^2-b)(a+2)$

and repeat the process. Another line is $b = -a-1$ or $(b+a+1)=0$

$F(a,b)=(-a^3+a^2 b^2+a^2+a b-b^3-b)(a+2)(a+b+1)$

Then we have two parabolas: $b = a^2$ and $a = b^2+1$, which can again be factored out.

What you have to consider here is that powers of those factors are not visible in the graph, but if you see the same line again (e.g. $a=-2$) after factoring it out, you know that you have to add this factor one more time, e.g. $(a+2)^2$ e.t.c. But you might also have factors that do not show up at all, e.g. $(x^2+1)$ which is never zero on $\mathbb R^2$.

This is obviously a simple example, and it can still get quite complicated, but it works quite well with lower degree integer polynomials.

Other than that the field that investigates questions like those is called algebraic geometry but that is usually even more abstract, that means using fields other than $\mathbb R$.

$^*$ There are examples e.g. $y^2 = x^3-3x+2$: PS: Common zeros of two polynomials over a ring (e.g. another polynomial ring) can be studied using the resultant.