# Check if the expression is not equal zero with modular arithmetic

If we have a claim such as $$\frac{1}{3} - 2 + (2 + \frac{5}{4}) \cdot 5 = 0$$, and want to check it using computer, I can think of two things we can do. Either build a tool that can calculate symbolically and get that the above expression is exactly $$\frac{175}{12}$$ which is not $$0$$, or store it in, say, double format and evaluate it getting $$14.5833$$ and hoping that it is indeed close to that number, thus, not $$0$$. Problem with the first approach is that it is very expensive. Problem with second is that it can be inaccurate. Maybe above example is not illustrative enough but imagine something like $$(2 + \sqrt{5})^{\frac{1}{3}} - (\sqrt{5} - 2)^\frac{1}{3} - 1$$ is relatively hard to teach a machine to manipulate algebraically to see that it is indeed $$0$$, and evaluating it in double precision probably yields to some $$10^{-16}$$ error, and we can't be certain if it is $$0$$ or not.

Now, for some expressions there is a solution for us, if we think, that the expression is not $$0$$ that is exact and cheap. Simply take couple of distinct prime numbers $$p$$ and calculate the expression modulo that number. If we get non-zero for some $$p$$, we can conclude that statement is false. (Of course, if we get $$0$$ for each $$p$$, we can't know for sure that it is zero, but I am interested only in knowing for certain that it is not $$0$$). Now, this is true whenever we can do modular calculus, so as long as we stay within $$+, -, \cdot, :$$ we are fine. We can even deal roots in this way with a bit of care since we might have multiple choices, but with a bit of branching we can save ourselves.

My question is can we extend this to other functions such as $$\log, \sin, \cos, e^x$$. Essentially, I think it is enough to analyse $$e^x$$ since all the others are derived from that. My intuition says we can't, since if we could, statement like what is $$e$$ congruent to modulo $$5$$ would make sense. And I think it doesn't, but can't seem to find anything about that. So, yes I know it is a bit vaguely posted question, but I guess we can narrow it to, another a bit vague: does "What is $$e$$ modulo 5?" make sense? If yes, what is it congruent to, if not, why not?

• This is heavily studied in computer algebra, e.g. see the links in this prior similar question. – Bill Dubuque Jan 31 at 0:05
• Thanks, but that is not exactly what I was looking for. Maybe I gave to much of a background, maybe I should have just asked "Is it sensible to ask what is $e$ modulo $5$?" Anyways, any other reference on the subject is appreciated – prosinac Feb 1 at 21:40
• If you chase citations from the links there you will find there is much literature on this and related problems in computer algebra. – Bill Dubuque Feb 1 at 22:07