Your question is a bit vague.
In most algebras, terms in the algebra can be directly compared for equality by rewriting to some canonical form (meaning that terms in the same equivalence class always rewrites to the same canonical form).
For example, we can define canonical form for a polynomial to be .
We can rewrite and to show that since they have the same canonical form.
Furthermore, if the canonical form of two polynomials differ, then we can conclusively say they are different.