# Why can one not factor 0?

I was trying to understand the structure of (a-b), where "a" and "b" were two very large expressions. So I was doing things like (a-b).simplify_full().factor(). I discovered the following anomaly.

```
sage: var ('a', 'b') #Adequate for illustration
(a, b)
sage: (a-b); (a-b).factor()
a - b
a - b
sage: b=a #By chance, "a" and "b" were equivalent.
sage: (a-b); (a-b).factor()
0
Traceback (most recent call last):
...
ArithmeticError: factorization of 0 is not defined
```

I would have expected 0.factor() to give 0.

A closer look at

`0.factor??`

shows that this case should not occur:From my point of view, the implementer was blessed to translate "factorization" as "

primefactor decomposition". (With recorded unit.) And zero is not a prime. Note that a factorization object is more complicated, for instance:so there is a difference between the "printed factorization" and the "factorization object" with the above hidden dictionary representation.

My surprise arises from working in the symbolic ring and being unexpectedly dumped into the integer ring, thereby triggering and error. Annoying.

It's not dumped into the integer ring, but rather converted to a polynomial with rational coefficients (line 10812 in symbolic/expression.pyx). This polynomial happens to be zero, and Sage code declares that the zero polynomial cannot be factored. (Note that if you try

`(a-b+6).factor()`

, the answer will be 6, not 2*3: the factorization is done over QQ.)Thanks. In future I will bracket this pattern with a conditional to avoid the Traceback.