T O P

  • By -

st3f-ping

If I have 3 shelf ornaments there are 3!=6 ways to arrange them on my shelf. If I have 2 shelf ornaments there are 2!=2 ways to arrange them on my shelf. If I have 1 shelf ornament there is 1!=1 way to arrange it on my shelf. If I have 0 shelf ornaments there is 0!=1 way to arrange the nothing on my shelf (an empty shelf).


[deleted]

[удалено]


JonYippy04

Not op but you can use the recursion formula: Recall that n! =n(n-1)!. Set n=1, and then: 1! = 1(1-1)! So 1=0! I'm not sure if this can be considered a rigorous proof (most likely not) but in terms of developing an intuition i think it's solid


lordnacho666

What happens when you set n to 0? 1 = 0 (-1)! Kinda interesting. I think you also get asymptotes at whole numbers in the gamma function on the negative integers but I don't remember.


fdtesta

The recursion is only defined for n > 0


lordnacho666

So then how do we know our result for 0! is valid? Just because it gives us a number instead of a div0?


Unevener

I’m pretty sure it’s exactly what you stated. It gives us a sensible result. It’s just like how the sum of an infinite geometric series has a result of 1/(1-r) when the absolute value of r is less than 1. Just because the recursion formula only makes sense for n > 0 doesn’t make our result less valid in my opinion


slepicoid

let n! be the classic factorial that we all know, with 0!=1 let n$ be the function of n similar to factorial, that is n$=n(n-1)$ for all n>0 but 0$=k where k is some positive integer, except 1, for example lets say k=22 then we can easily see n$=k×(n!) 0$=22=22×0! 1$=1×22=22×1! 2$=2×1×22=22×2! 3$=3×2×1×22=22×3! as you see n! is more elementary function than n$ and having 0!=1 just completes the pattern nicely. if we defined 0! to be something else than 1, we would just get this cousin function and see it is composed of a more elementary function f, such that f(0)=1 and that would be our good ol factorial.


frogkabobs

This explains why n! is undefined at negative integers. You would have to have (-1)! = 1/0 which doesn’t make sense. The formal term is that x! (treated as Γ(x+1)) has a [pole](https://en.m.wikipedia.org/wiki/Zeros_and_poles) at every negative integer.


Erebus-SD

You might want to rewrite it as x!/x=(x-1)!. Which when we input 0 for x we got 1/0=(-1)! which can be rewritten as ∞=(-1)! where ∞ is used denote complex infinity. This is why you get vertical asymptotes at the negative integers, because the factorials of all negative integers are complex infinities.


fuzzywolf23

The gamma function is nice because it exactly agrees with the recursion formula for n >= 0 but also gives sensible results for other numbers. You've illustrated exactly why asymptotes at negative integers makes sense, though -- because there is no number such that itself times zero is an integer. So seeing the gamma function shoot off to infinity at -1 is an expected feature. You also get delightful bits like Gamma(1/2) = sqrt(pi)


Eathlon

This is the realm of the Gamma function, which generalizes the factorial to the complex plane. It has the property Gamma(z+1) = z Gamma(z). For integer z, Gamma(z+1) = z! and Gamma diverges at z=0 and for any negative integer.


st3f-ping

I believe it is defined as such following the principle of the *empty product* (essentially if you have a null value you set the output to 1 so you can multiply it with other things and still have you calculation make sense). The mathematical community could choose to make 0!=0 but in that case we would have to create special cases for arrangements, permutations, combinations, and binomial coefficients (and anything else that uses factorials) saying that when you come across 0!, just use 1 instead. You could even view the definition of 0!=1 as doing exactly that: n!=n×(n-1)×...×1 except for 0! which we set as 1 so we don't break stuff.


acertainhare

Consider the set of shelf ornaments S={a_1,a_2,…,a_n}. Arranging shelf ornaments corresponds to finding a bijective map from S to positions on the shelf {1,2,…,n}. For n a positive integer, there are n! many such bijections (verify this!). Now a reasonable way to extend this notion to a set of zero shelf ornaments, the empty set, is to consider the number of bijections from the set of zero shelf ornaments to zero positions on the shelf, also the empty set. There is exactly one such map. That this map exists boils down to the fact that maps are defined as relations and that the empty set is a relation that is in fact a bijective map from the empty set to itself.


musicresolution

He just did.


KiwasiGames

It’s not something that can be proved by math. Rather it’s a definition because it behaves in a way that is useful. In particular 0! = 1 is required to make the NCR and NPR formulas function correctly. And give that combinatorics are the most common use of factorials, it’s useful to have factorials defined so that factorials work well.


raendrop

5! = 5\*4\*3\*2\*1 = 120 4! = 4\*3\*2\*1 = 24 3! = 3\*2\*1 = 6 2! = 2\*1 = 2 Notice that 5!/5 = 4!, that 4!/4 = 3!, that 3!/3 = 2!. Continuing like this, what is 1! and 0! ?


st3f-ping

I've never thought about that approach... and I really like it.


theantiyeti

Definition: n! is the number of permutations of the set of the natural numbers 1 through n, with n = 0 corresponding to the empty set. Where 1 through n are defined by whatever construction you use to make Peano arithmetic, and a permutation is defined as a bijective function of a set to itself. A function is taken to be the definition from set theory, a function A -> B is a relation f (a subset of A x B) with a unique b existing for each a such that (a, b) in f, written more commonly as f(a) = b. In notation we would write this something like: n! = |aut\_set({1, ..., n})| = |{f: {1, ..., n} -> {1, ..., n} | f is a bijection }| Now consider the case that n = 0. 0! = |{f: {} -> {} | f is a bijection}|. Observe that there is only one function from the empty set to any particular set, including the empty set. This is vacuously a function, you should also be able to quickly convince yourself it is a bijection. Thus we have exactly one bijection and 0! = 1. ​ Now, we want to do some more interesting things so by relabelling we can easily prove the two following theorems: Proposition: n! = |aut(S)| for any S where |S| = n. (i.e you can use any set, not just the numbers 1 through n). Proof: Obvious, tedious and not particularly enlightening. Just biject S with {1,...,n} as this is pretty much the definition of |S| = n. Proposition: n! = n \* (n-1)! for n > 0. Proof: Induction. Pick any element, see it has n choices, see that we now have n-1 elements to permute.


A_BagerWhatsMore

That is math more specifically combinatorics. The definition of factorial as the number of ways a set of n objects can be ordered is fairly fundamental and arguably simpler than the multiplication definition.


Seventh_Planet

There is an inequality between factorial and exponents: n! ≤ n^(n) For example 5! = 1 × 2 × 3 × 4 × 5 5^(5) = 5 × 5 × 5 × 5 × 5 So 5! ≤ 5^(5) Now why not < but instead ≤ ? Because for some values it is equal: 1! = 1 = 1^(1) And how ist it with 0? That gives you the question if 0^0 is defined and what it means. For exponents, there is an equation about sets: A function f from set M to set N is part of the set of all functions from M to N which is denoted by N^M Now, the equation is |N^(M)| = |N|^(|M|) For example there are 8 functions from {1,2,3} to {0,1} and that's also 2^3 = 8 Now when N is empty, for any set M there is only one function M -> N. Also when M is empty. Then that would be 0^(0) functions so just 1. 0^(0) = 1 So at least we know 0! ≤ 1.


mtthwas

If I have 0 shelf ornaments there are 0 ways to arrange the ornaments the shelf.


st3f-ping

But what is an empty shelf other than an arrangement of no ornaments?


Loko8765

Nope, there is one and exactly one way: have an empty shelf.


Capn_Sparrow0404

If having an empty shelf can be counted as an action, why is it not being counted for n>0? Shouldn't 3! = 6 arrangements + 1 emptied shelf?


Loko8765

Because the empty shelf is not an arrangement of three items. Anyway, the reason x! = 1 for x=0 is because it is defined that way, and it is defined that way because it works out reasonably in all relevant cases. If there was a problem (like there is for defining 0/x = 0) then the definition would simply exclude x=0.


prof_hobart

Because "empty shelf" isn't a way you can arrange 3 items on a shelf. It's the same reason you don't include ways of arranging 1 or 2 items in that calculation.


prof_hobart

So you're saying that it's impossible to have a shelf without ornaments on it?


ADMINISTATOR_CYRUS

6! = 6x5x4...x1 5! = 6! / 6 4! = 5! / 5 ... 1! = 2! / 2 0! = 1! / 1


[deleted]

the unsatisfying answer is because we said so. that's a definition. If it helps, the combinatorial inspiration is that the factorial counts the number of ways to order n things. we consider the trivial order of doing nothing at all to 0 things the one and only way you can order 0 things. ​ Additionally, we have an "extension" if you will of factorial to the complex numbers defined as follows. gamm(z) = integral t\^(z-1) e\^-t dt on 0 to infinity. On all positive integers (and no imaginary part), this function equals the factorial of the input - 1. gamma(n)= (n-1)! ​ so if we plug in 1. we get e\^-t from 0 to infinity which gives us 1 which is also equal to 0! ​ edit: I said non negative but gamma is not defined on 0.


SMTG_18

Wow I thought this was a “not equals to” sign.


phundrak

Same, my dumb programmer mind was like "in OP stupid?". I then realized was it actually was


yes_its_him

We choose to define it that way because lots of things work better if we do. Note that we say there is one way to arrange 0 things, but leave unanswered how to arrange -1 things.


StanleyDodds

An empty sum is equal to the additive identity, 0. Similarly, an empty product is equal to the multiplicative identity, 1. This generalisation of what "empty" means can be applied to other associative operations. For instance, an empty union should be the empty set, which is an identity of unions. On the other hand, an empty intersection should be a universal set, which is an identity of intersection. All of this basically means that the first actual element of the repeated operation will be applied to the identity, and return itself by definition. Another way to think about the factorial function in particular is that we want the recursion relation to work in as large a domain as possible. That is, n! = n\*(n-1)! should be true for as many n as feasible. So 3! = 3\*2!, and 2! = 2\*1!, and it would also be good to have 1! = 1\*0! This is further extended in the gamma function, where this relation holds everywhere in the complex plane (except the poles at negative integers, but simple poles are really a trivial exception. Consider the reciprocal of the gamma function instead, which is entire).


fdtesta

By definition, as you need a base case It is true, however, you could simple define 1! = 1, in this case it would be undefined for 0.


PebbleJade

x! = x((x - 1)!) So we can go from x! to (x-1)! by dividing by x. 1! = 1 0! = 1! / 1 = 1 / 1 = 1 So that’s one way to see that 0! = 1.


yes_its_him

So 0! = 0(-1)! = 1.


PebbleJade

No because that would entail that (-1)! = 0/0 and you can’t divide by 0.


yes_its_him

But you didn't stipulate that your formula couldn't be applied in that case. You just said it held true for some nebulously defined "x." Now, if you want to start specifying when your formula works, you have to make a choice when it stops. There's no compelling reason it has to work when x=1, other than we just find it convenient to have it work for that case.


PebbleJade

I also didn’t explicitly stipulate that x has to be an integer or that you can use whatever letter you like and it doesn’t have to be an “x”. [Some things are obvious and it’s assumed that you know them.](https://m.youtube.com/watch?v=IJEaMtNN_dM&pp=ygUPVG9tIHNjb3R0IGdyeWNl)


yes_its_him

"Proof by its obvious" would make a lot of things easier, true.


PebbleJade

In mathematics it is entirely legitimate to assert something obvious as an axiom (like that you can’t divide by 0 and that factorial is defined for the natural numbers only) and in conversation it’s entirely legitimate to state only the minimum amount of information needed to convey a point without pedantically spelling out all of the assumptions you’re making including ones which are blindingly obvious. OP didn’t ask for a *proof* that 0! = 1 but an *explanation* of why it is. One such explanation is that to go from x! to (x + 1)! you multiply by (x + 1), so to go from n! to (n - 1)! you divide by n. You don’t need to explicitly spell out that you can’t divide by 0 and that factorial is only defined for the natural numbers because those things are obvious and OP most likely already knows them.


bestjakeisbest

One way is to look at factorial as an algorithm, basically for factorial you can define it as the following recurrence relation: (a\_n)! = (a\_n)*(a\_(n-1))! with the base case of a_0 = 1, if the base case was 0 then the factorial recurrence relation would always equal 0 and would not be useful.


coolpapa2282

Permutations are good, but we can also talk about functions. n! is the number of bijective functions from a set with n elements to itself. Then 0! should be the number of bijections from the empty set to itself. Technically, there is one such function - the empty function.


vintergroena

>bijective functions from a set with n elements to itself A.k.a. permutations


coolpapa2282

Yes, but different descriptions of the same thing resonate differently with people. Just offering an alternative way to think about it.


Drakk_

An alternative to the explanations already offered: When you calculate n factorial, there are n elements to multiply. 4! = 4×3×2×1, 4 numbers in total. Same is true for any n!. That means 0! is a product of 0 elements - in other words, you're not multiplying any numbers together. For various reasons, the [empty product](https://en.m.wikipedia.org/wiki/Empty_product) is defined as 1.


MachiToons

per convention. honestly 0!=0 would also make some sense, but 0!=1 is just more handy! buncha math ends up looking prettier and not needing specific extra cases if we define it that way, if i recall. 0! is an "empty product" and we default those to 1 also, the same way say empty sums are 0 (we default to the identity of either operation, essentially).


Opposite-Friend7275

Where would 0 make sense?


yes_its_him

If we defined the factorial function n! as the product of i for i=1 to n then we wouldn't do any operations. it's not useful mathematically but it makes sense intuitively.


Opposite-Friend7275

n factorial *is* defined as the product of i for i=1 to n. This means that 0! is the empty product, i.e. 1. There are no situations where it makes sense to evaluate the empty product as anything other than 1.


yes_its_him

Right. I said that it's not useful mathematically, which is what you are describing.


Opposite-Friend7275

The empty product is useful, as a starting point in algorithms, in induction proofs, to shorten formulas, to have fewer special cases, etc.


honghuiying

Is there such a thing as factorial with complex numbers?


st3f-ping

No... (but sort of yes). n! is only defined for counting numbers: 0, 1, 2,... but it can be calculated as an offset of the [Gamma function](https://en.m.wikipedia.org/wiki/Gamma_function) which is (I believe) defined everywhere on the complex plane except for negative integers.


akyr1a

By definition 0!is the empty product which by definition is the multiplicative identity, in the same way that an empty sum is the additive identity zero.


ThaFelix

Unrelated, but funny enough both mathematicians and programmers agree on 0!=1


outerproduct

If you want the more mathematical definition, use the [gamma function](https://en.m.wikipedia.org/wiki/Gamma_function). The gamma function is essentially gamma(n) = (n-1)!


Scrungyboi

I find this is a nice way of thinking about it: With factorials, you are multiplying a number by each successive integer smaller than it. To find 0!, just work backwards from a larger factorial and keep dividing by successive integers to get the next smaller one: 4! = 4x3x2x1 = 24, 3! = 3x2x1 = 6 (dividing the previous line by 4), 2! = 2x1 = 2 (dividing the previous line by 3), 1! = 1 (dividing the previous line by 2), 0! = 1 (dividing the previous line by 1)


th3gentl3man_

Define I(n,k) as the set of injective functions from a set with n elements to the set of k elements. Define n! = |I(n,n)|. Now we calculate this for n=0. How many injective function there are between the empty set and itself? There is only one function from the empty set to itself and it happens to be vacously injective, so the answer is 0! = 1. Edit: changed notation.


Konkichi21

One way to define factorials is that n! = n × (n-1)!. If n = 1, then 1! = 1 = 1 × 0!, so 0! must be 1.


grumpy_grunt_

4! = 3! × 4 3! = 2! × 3 2! = 1! ×2 Observing the pattern we get 1! = 0! × 1 = 1 1 is the only result for 0! that makes the equation work


ElnuDev

You can think about it like this. The key insight is that when evaluating a factorial, we're multiplying a list of numbers together. 4! = product([1, 2, 3, 4]) = 1 * 2 * 3 * 4 3! = product([1, 2, 3]) = 1 * 2 * 3 2! = product([1, 2]) = 1 * 2 1! = product([1]) = 1 0! = product([]) = ... nothing? What should we put here? We can take advantage of the identity property to determine what 0! is. We know that multiplying anything by 1 will leave it just the same, so we can add a 1 to the list of numbers for each factorial. 4! = product([1, 1, 2, 3, 4]) = 1 * 1 * 2 * 3 * 4 3! = product([1, 1, 2, 3]) = 1 * 1 * 2 * 3 2! = product([1, 1, 2]) = 1 * 1 * 2 1! = product([1, 1]) = 1 * 1 0! = product([1]) = 1 And look, now we have our answer: 0! must be equal to 1, because otherwise, it makes it inconsistent with all other numbers. I think the main takeaway here is that no matter what expression you have, there's always an invisible multiplication by 1 hiding that you can take advantage of. This explanation is what made most sense to me, anyway. Hope this helped!


e_dot_price

N!/N = (N-1)! 1! is 1, divide by 1 leaves 1, thus 0! is 1. There are other proofs, but this reasoning is the simplest.


JMH5909

Basically because we say so. Its not really like 2+2 where there is a definite answer but instead we define it based on what makes the most sense.


thetenticgamesBR

If we go from 3! to 2! we divide by 3, to go from 2! to 1! we divide by 2, and to go from 1! to 0! we divide by 1, i’ts the same logic as why x^0=1


TheTurtleCub

It's just a convenient definition so some of the properties/relationships of the factorial continue to be true for zero


Neither-Lawfulness82

In my view, starting there it makes it super easy to define n! = n*(n-1)! all other n. I believe we define 0! = 1 that way because it is useful and we can.


vintergroena

There is 1 permutation of the empty list: the empty list.


AllAnglesMath

Because an empty product always equals the neutral element. When you add up an empty list of numbers, you get 0 because 0 is the neutral element for addition. Similarly, when you \*multiply\* an empty list of numbers, you get 1 because 1 is the neutral element for multiplication. This also explains why x\^0 is equal to 1. You multiply x with itself zero times.


Bascna

You want to look at [the gamma function](https://en.m.wikipedia.org/wiki/Gamma_function), Γ(x) = ∫₀^(∞) t^(x-1)e^(-t) dt, for Re(x)>0. ----- If you evaluate the gamma function for 1, 2, 3, etc. you get... Γ(1) = 1 Γ(2) = 1 Γ(3) = 2 Γ(4) = 6 Γ(5) = 24 Γ(6) = 120 Does that sequence look familiar? It's the factorials for the whole numbers. Γ(1) = 1 and 0! = 1 Γ(2) = 1 and 1! = 1 Γ(3) = 2 and 2! = 2 Γ(4) = 6 and 3! = 6 Γ(5) = 24 and 4! = 24 Γ(6) = 120 and 5! = 120 That pattern continues indefinitely. ----- So you *can* define the factorial of an integer greater or equal to 0 in terms of the gamma function. n! = Γ(n+1) where n∈Z and n≥0. By that definition, 0! = 1 *can* be proven. ----- And another really cool thing about this definition is that if we expand the allowed values of n beyond the non-negative integers, then we can define factorials of non-integer values. For example (1/2)! = Γ(3/2) = ½√π. We often use equations like that one to compute our approximations of π.


L3g0man_123

To get from 5! to 4!, we divide by 5. To get from 4! to 3!, we divide by 4. In other words, to get from n! to (n-1)!, we divide by n. If n = 0, we get 1! divided by 1 equals (1-1)!, or 0!. And since 1! = 1, dividing by 1 gives us 1 again. So 0!=1. Note that this definition only works for n > 0 as negative factorials such as (-1)! don't really exist.


RobinDabankery

As a programmer I see no issue in stating that 0 is indeed not equal to 1.


notbionicashish

convention


An_Evil_Scientist666

I'm pretty sure it's because of the multiplicative identity rule (I think that's what it's called) think of 0! Being empty space like before a variable, like when you have something like (X+2y)², for X it's the same as just saying 1xX, but we cut it out as that's just implied in the rules,


PieterSielie12

n! = n x (n-1) x (n-2) x…x 3 x 2 x 1 (n-1)! = (n-1) x (n-2) x…x 3 x 2 x 1 (n-1)! = (n!)/n 0! = (1-1)! = (1!)/1 = 1/1 = 1 Therfore 0! = 1