My scenario is that I need to express with mathematical syntax the following condition:

There are three integers: ${a, b}$ and ${c}$.

Case 1: two of the three can be zero.

Case 2: only one can be zero.

Case 3: none can be zero.

The last condition is easy: ${a, b, c \neq 0}$ but I can't figure out the other. I was looking for something easy to read, if the mathematical expression is too messy I prefer to write it by word. Thank you.

  • $\begingroup$ Hello, welcome to Math.SE. Please, try to make the title of your questions more informative. E.g., Why does $a\le b$ imply $a+c\le b+c$? is much more useful for other users than A question about inequality. For more information on choosing a good title, see this post. $\endgroup$
    – Lord_Farin
    Oct 17, 2013 at 16:35

4 Answers 4


For something like this you'd usually be alright writing it in english, but if you must use logical notation then the first condition can be written as:

$$ a \neq 0 \vee b \neq 0 \vee c \neq 0 $$

And the second can be phrased with material implications as:

\begin{align} a = 0 \implies b,c \neq 0 \\ b = 0 \implies a,c \neq 0 \\ c = 0 \implies a,b \neq 0 \end{align}

You could also do this with set notation and the $\exists!$ quantifier, read as "there exists exactly one", but the english statements are probably the nicest.


For all the cases: $\;a,b,c\in\Bbb Z\;$ :

First case, $\;abc=0\;$ , and either $\;a\neq0\,,\,\,or\;\;b\neq 0\,,\;\;or \;\;c\neq 0\;$

Second case: $\;abc=0\;$ , and either $\;ab\neq 0\;,\;or\;\;ac\neq 0\;,\;\;or\;\; bc\neq 0\;$

Third case: $\;abc\neq 0\;$

  • $\begingroup$ Why bring in multiplication? This makes the answer unnecessarily specific to zero. $\endgroup$ Oct 17, 2013 at 15:54
  • $\begingroup$ Because imo is the simplest, shortest and nicest way, and by far, to express mathematically the conditions the OP gave. $\endgroup$
    – DonAntonio
    Oct 17, 2013 at 18:14
  • $\begingroup$ Well, I'll give you "shortest" :) $\endgroup$ Oct 17, 2013 at 18:24
  • $\begingroup$ this applies even in R or C, not only Z $\endgroup$
    – phuclv
    Mar 10, 2015 at 14:02

You don't actually need complex conditions like other answers

When I was in junior high school my teacher used $a^2 + b^2 > 0$ a lot to indicate that both cannot be zero at the same time. The same thing can apply to 3 variables

  • Case 1: two of the three can be zero, i.e. all three can't be zero at the same time

    $a^2 + b^2 + c^2 \neq 0$, or

    $a^2 + b^2 + c^2 > 0$

    Alternatively $|a| + |b| + |c| > 0$ or any other even positive powers can also be used

  • Case 2: only one can be zero

    $(ab)^2 + (bc)^2 + (ca)^2 \neq 0$

  • Case 3: none can be zero

    $(abc)^2 \neq 0$

    Just a joke, for conformity with the above solutions. Of course you just need $abc \neq 0$

  • 1
    $\begingroup$ Neat answer. At first glance I think this could be generalized to any number of variables, using summations and products, in a compact expression. $\endgroup$
    – Sturm
    Mar 10, 2015 at 14:02

Because of your use of the word "can", I assume that you mean "at most" in each case. As ymbirtt pointed out, it's probably best just to write it in English. Here is how I would write it with logical formulas. The advantage of this way is that it is easy to generalize to other situations.

It's easier to express (1) as "at least one is nonzero" than "at most two are zero" and similarly it's easier to express (2) as "at least two are nonzero" than "at most one is zero", so we will do it this way.

  1. $a \ne 0 \vee b \ne 0 \vee c \ne 0$

  2. $(a \ne 0 \wedge b \ne 0) \vee (a \ne 0 \wedge c \ne 0) \vee (b \ne 0 \wedge c \ne 0)$

  3. $(a \ne 0 \wedge b \ne 0 \wedge c \ne 0)$

Although the parentheses in case (3) aren't necessary, I included them so you can see the pattern. Each case has been expressed as a disjunction ("or") of conjunctions ("and" statements,) so it is said to be in disjunctive normal form.

As you can see, if we try to do this with more variables $a$, $b$, $c$, $d$,..., the statements will get very long. This is why it is better to write it in English: formal logic can't concisely express "at least $n$ many of the statements...are true" or "at most $n$ many of the statements...are true" (not without bringing in set theory, anyway.)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .