0

This seems like an obvious question, but I think it really lies in how you define the lcm of two numbers. In the homework problem I'm currently doing, lcm$(a,b)$ is defined as the smallest positive integer $m$ such that $a\mid m$ and $b\mid m$. This definition seems to work perfectly fine when $a,b \neq 0$. But to find lcm$(0,0)$ for example, does it fail? The requirement that $m \in \mathbb{N}$ means that lcm$(0,0)$ cannot exist, correct? For context, the problem I am solving is to show that the lcm exists for any $a,b \in \mathbb{Z}$

EDIT: I guess what I'm asking is should this definition in the homework question be changed to accommodate for this?

GTBailey
  • 243
  • 1
    What is the least common multiple of a pair numbers if their multiples are allowed to be negative? – Xander Henderson Jan 15 '24 at 14:29
  • @XanderHenderson I am suggesting that this definition should be changed to non-negative integers to include $0$, as opposed to including negative multiples. – GTBailey Jan 15 '24 at 14:31
  • 1
    It's a matter of convention. Some writers say that $\text {lcm}(0,a)$ is undefined but others set it to $0$. See, for instance Wikipedia. I note that Excel and Wolfram Alpha both evaluate LCM(0,1) to $0$. Personally, I prefer to set it to $0$ but it's just a convention. – lulu Jan 15 '24 at 14:31
  • 1
    As a curiosity: Excel refuses to evaluate $\text{lcm}(-1,-2)$ though I'd say that was unambiguously equal to $2$. WA does indeed evaluate it to $2$. – lulu Jan 15 '24 at 14:35
  • @lulu I agree it is unambiguously 2 and according to the definition in my question it should be 2 – GTBailey Jan 15 '24 at 14:36
  • 3
    Sure, just making the point that it is always a good idea to check on conventions. Especially in programming...you should never assume some language is using exactly the same definitions and conventions that you have in mind. – lulu Jan 15 '24 at 14:37
  • @XanderHenderson I have just thought as a follow up to my last message, including $0$ would imply that lcm$(a,b)=0$ for all $a,b \in \mathbb{Z}$ – GTBailey Jan 15 '24 at 14:56
  • @GTBailey Not necessarily but, yes, that is something that one needs to be careful about. – Xander Henderson Jan 15 '24 at 14:59
  • According to Wikipedia "In a principal ideal domain, the least common multiple of a and b can be characterised as a generator of the intersection of the ideals generated by a and b" – Somos Jan 15 '24 at 19:13
  • 1
    The accepted answer misses the essence of the matter. Namely, in number theory in general domains the definition of an $\rm:!lcm:!$ is that it is a common multiple that is divisibility-least, i.e. that divides every common multiple or, equivalently, that satisfies the linked universal property (see here or the 2nd dupe for more). This implies $, m = {\rm lcm}(a,0) = 0,$ since $,0\mid m\iff m = 0.\ \ $ – Bill Dubuque Jan 15 '24 at 22:26

1 Answers1

2

TL;DR: There are a number of ways of extending the idea of a "least common multiple" to nonpositive numbers (including zero). There are advantages and disadvantages to each, but it is ultimately a matter of convention. Pick a convention, and stick to it.


In mathematics, one typically starts with axioms and definitions, and then proves results which follow from there. All of these axioms and definitions are subject to convention and convenience, and different mathematicians will often use slightly different definitions, depending on what the overall goal of their work is. In the case of the least common multiple, a common set of definitions is something like the following:

Definition: Let $\mathbb{N}$ denote the set of positive integers. If $a,b\in \mathbb{N}$, then the least common multiple of $a$ and $b$, denoted by $\operatorname{lcm}(a,b)$ or $(a,b)$, is the smallest natural number $m$ such that $$ a \mid m \qquad\text{and}\qquad b \mid m. $$

In this framework, $\operatorname{lcm}(a,0)$ is undefined for all $a \in \mathbb{N}$ (as well as for $a=0$), since the least common multiple of $a$ and $b$ is only defined for natural numbers (which, in this context, are strictly positive). This notion of least common multiple is useful in a lot of applications—for example, some kinds of apportionment problems (where it doesn't make sense to consider non-positive numbers), certain encryption protocols, and in approximating orbital resonances. Not to mention the fact that a lot of important and interesting number theoretic results are proved for the natural numbers (rather than the integers).

That said, it is reasonable to ask if this concept can be extended to the integers, and it seems reasonably "obvious" how to define the least common multiple of $a$ and $b$ when neither is zero:

Definition: If $a,b\in \mathbb{Z}\setminus \{0\}$, then the least common multiple of $a$ and $b$, denoted by $\operatorname{lcm}(a,b)$ or $(a,b)$, is the smallest natural number $m$ such that $$ a \mid m \qquad\text{and}\qquad b \mid m. $$

Again, the least common multiple is always positive. But this does leave a bit of a problem, in that neither $a$ nor $b$ is permitted to be zero in this definition. So, what should be done about zero?

Given an integer $a$, there are a number of options:

  1. leave $\operatorname{lcm}(a,0)$ undefined; or
  2. define $\operatorname{lcm}(a,0)=0$.

Note that this list is not exhaustive, but it gives an idea of where to go. Each of these possible choices has advantages and disadvantages. For example, for $a,b\in\mathbb{N}$, $$ ab = \operatorname{lcm}(a,b) \cdot \operatorname{gcd}(a,b). $$ This formula can be generalized to non-zero integers by throwing in something extra to account for the signs of $a$ and $b$, but it fails pretty miserably if either $a$ or $b$ is zero (how should $\operatorname{gcd}(a,0)$ be defined to make the formula work?!). This suggests that it might be best to leave $\operatorname{lcm}(a,0)$ undefined.

On the other hand, taking $\operatorname{lcm}(a,0) = 0$ makes some sense. One has to be careful that this is regarded as a special case (since zero is a multiple of any integer, defining $\operatorname{lcm}(a,b)$ to be the smallest nonnegative integer which divides $a$ and $b$ is going to be a problem...), but making zero a special case should be fine.

Ultimately, either convention can be adopted (and, likely, there are other conventions that I am not creative enough to think up), as long as one is clear and consistent about their choice. The particular choice of convention will depend on what the goals of the author are, and what theorems or results that author hopes to derive from that definition.

Finally, very quick rundown of the conventions chosen by some bits of software available to me:

  1. Google Sheets: lcm(1,0) = 0 and lcm(0,0) = 0.
  2. Excel for Mac (version 16.16.27: lcm(1,0) = 0 and lcm(0,0) = 0
  3. Excel 365 (via SharePoint): lcm(1,0) = 0 and lcm(0,0) = 0
  4. Apple Numbers (version 11.1): lcm(1,0) = 0 and lcm(0,0) = 0
  5. Wolfram|Alpha: lcm(1,0) = 0 and lcm(0,0) = 0
  6. Desmos: lcm(1,0) = 0 and lcm(0,0) = undefined
  7. GeoGebra: lcm(1,0) = 0 and lcm(0,0) = 0
  8. Maple Calculator (a mobile app): lcm(1,0) = 0 and lcm(0,0) = 0
  9. PARI / GP: lcm(1,0) = 0 and lcm(0,0) = 0[1]
  10. Maxima: lcm(1,0) = 0 and lcm(0,0) = 0[1]

Based on this very unscientific sample, it would appear that most of the commonly used computational environments to which I have access have adopted the convention that $\operatorname{lcm}(a,0) = 0$.


[1] Thank you to Martin R for this one.

Martin R
  • 113,040
  • (Side note: There is \gcd in MathJax/LaTeX :) – Martin R Jan 15 '24 at 15:41
  • @MartinR How annoying. There is \gcd, but not lcm. Go figure. :/ – Xander Henderson Jan 15 '24 at 15:41
  • "since any integer divides zero, defining lcm(a,b) to be the smallest nonnegative integer which divides a and b is going to be a problem..." You seem to be using the gcd definition when talking about lcm here. – Jaap Scherphuis Jan 15 '24 at 15:46
  • @JaapScherphuis Ack! I'm being dyslexic again. Let me fix that. Thanks. – Xander Henderson Jan 15 '24 at 15:47
  • 1
    Another definition of lcm that works when one of $a$ or $b$ is zero is that it is the unique nonnegative integer $m$ such that $a \mid m$ and $b \mid m$, and whenever $a \mid c$ and $b \mid c$, one also has $m \mid c$. – Geoffrey Trang Jan 15 '24 at 15:58
  • When talking about divisibility it often makes sense to consider $0=2^\infty 3^\infty \cdots$, and have it greater than all other numbers. This preserves the least common divisor definition, and $v_p(\mathrm{lcm}(a,b)) = \max(v_p(a),v_p(b))$. – Command Master Jan 15 '24 at 15:58
  • @GeoffreyTrang I don't get it. No number is divisible by zero since dividing by zero is not possible, so what would you mean by $0|m$ or $0|c$? Or are you allowing $0|0$? – Jaap Scherphuis Jan 15 '24 at 16:04
  • 1
    @JaapScherphuis By definition, $a \mid b$ means $\exists c \in \mathbb{Z} , ac=b$. Note that $c$ need not be unique. In particular, $0 \mid 0$ (and then any integer would work for $c$). – Geoffrey Trang Jan 15 '24 at 16:14
  • @GeoffreyTrang: I think yours is the "correct" definition, since it generalises to any commutative ring $R$. Another way of saying it that works for principal ideal domains: if $a,b\in R$, then a lowest common multiple of $a$ and $b$ is a generator of the intersection of their ideals. In particular, if $R=\mathbb Z$ and one of $a$ and $b$ is zero, then $a\mathbb Z\cap b\mathbb Z={0}$, so the only lowest common multiple of $a$ and $b$ is $0$. – Joe Jan 15 '24 at 21:26
  • @Joe While I agree that this is a very nice definition, I am always hesitant to declare that any particular definition is the "best". These things are always context dependent, and in a classroom setting, the most general or abstract definition is often not the best, as it increases the cognitive load being placed on a student who is just trying to get familiar with the basic idea in a concrete setting. – Xander Henderson Jan 15 '24 at 21:28
  • Oh, I am not suggesting that this is how lowest common multiples should be introduced to students for the first time; I am only claiming that it is "correct" from a mathematical standpoint, not a pedagogical one. But I do find the "pre-calculus" definition a little misleading, for reasons discussed in an earlier stack exchange post: What is $\gcd(0,0)?$. – Joe Jan 15 '24 at 21:35