# Decidability of factoring algebraic equations

Given an arbitrary algebraic equation, say for example the likelihood of the bernoulli distribution:

$$\prod_{i}^{n}\theta^{x_i}(1-\theta)^{1-x_i}$$

And some arbitrary factorization constraints, say:

$$f(x)g(\theta)e^{\phi(\theta)^{T}u(x)}$$

Can I factor the equation into the form above where f, g, and phi are functions depending only on x, theta, or x respectively? This is something as humans we do all the time. The problem I gave above is an instance of "is this distribution in the exponential family", but of course there are simpler and less puffy versions of this:

Given the equation:

$$f(x,y,z) = x^2 + y^3 - e^{z}$$

Can I factor this into:

$$f(x)*g(y)*h(y,z)$$

This feels undecidable to me. The tree of legal "algebra moves" from the root is infinite. If a program cannot find a solution in n moves, there is no guarantee that the solution is not at n + 1 moves, so I can't think of a halting condition. There doesn't even seem to be a good greedy solution to this, other than human intuition.

Any mathematica wizards out there know how to write a one liner to this?

Interesting question. Factorization of functions, including factorization of polynomials is in fact a classical problem throughout history of mathematics.

For the sake of contradiction, assume that $$x^2 + y^3 - e^{z} = f(x)*g(y)*h(y,z)$$

For the sake of simplicity, assume that $$f, g, h$$ are continuously differentiable inside $$D$$, the place where we are interested.

Now treating $$y$$ and $$z$$ as constant, take partial derivative with respect to $$x$$. (Aha, you might say, why didn't I think of that?!)

$$2x = f'(x)*g(y)*h(y,z)$$

Since $$2x$$ is not constant, $$f'(x)$$ cannot be constant 0. Shrinking $$D$$ if necessary to make sure $$f'(x)$$ is never 0, we have $$2x/f'(x) = g(y)*h(y,z)$$ That means, both $$2x/f'(x)$$ and $$g(y)*h(y,z)$$ are constant functions since the former is constant w.r.t. to $$y$$ and $$z$$ and the latter is constant w.r.t. to $$x$$. So we will have $$-e^z=\frac{\partial(x^2+y^3-e^z)}{\partial z} = \frac{\partial(f(x)*g(y)*h(y,z)}{\partial z}=\frac{\partial(f(x)*\text{(some constant)})}{\partial z}=0$$ which cannot be true.

The above reasoning should give you a pretty good idea that particular factorization cannot hold nicely because of too many independences between the variables in the factorization. In fact, we can show that no such $$f,g,h$$ exist without assuming continuity of any of $$f, g, h$$, as long as it is required that equality holds for a small 3D space. Note that 2D space will not be enough since we can have, letting $$x=0$$, $$0 + y^3-e^z=1*1*(y^3-e^z)$$

It will require some work to formulate the more general questions of decidability of function factorizations clearly enough so that it might be able to have a clear answer. It looks like if many dependencies are required, then the set of problems is probably decidable. If you are interested enough, you could try formulating those problems and raising new questions.

For related result on polynomials, we can search for "decidability of polynomial factorization".