# Wikipedia:Reference desk/Archives/Mathematics/2019 November 8

Mathematics desk
< November 7 << Oct | November | Dec >> Current desk >
Welcome to the Wikipedia Mathematics Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.

# November 8

## Looking for a simple formula to solve my problem

Let's assume there were 6 specific people (I'll call them: 1,2,3,4,5,6) that visited in a zoo in total of 3 days. Now, we don't know exactly which number was in which day, but all we know that all of the 6 visited there and at least one of them was there in a day (no empty day). Now I'm looking for a way to find out all possibilities in order. (i.e. One possibility: in the first day number 1 visited, second day, numbers 2&3, while on the 3rd day were numbers 4 &5 &6 visited. Second possibility: in the first day numbers 4 &5 &6, second day, numbers 2&3, while the 3rd day number 1 visited). ThePupil (talk) 13:02, 8 November 2019 (UTC)

@ThePupil: For some reasons it look like searching for someone to do your homework for you... --CiaPan (talk) 14:11, 8 November 2019 (UTC)
My nickname is indeed ThePupil, but my question has to do nothing with a homework. I figured and wrote from myself a problem that I met many times in my life. Just found the time to write it down, simplify my problem, and to ask. ThePupil (talk) 14:24, 8 November 2019 (UTC)
It's not clear to me whether the people are allowed to visit only once; that seems to be implied by the examples but you don't actually say. If so then everyone visiting every day is a possibility and I'm guessing that the number of possibilities would be dramatically higher. Also, I don't know what you mean by "in order"; presumably some kind of lexicographic order. If you just want to count the number of possibilities, the Inclusion–exclusion principle seems like a good place to start, but it doesn't seem like a good idea to go into details without fully understanding the problem. --RDBury (talk) 14:56, 8 November 2019 (UTC)
You're right. I absolutely didn't described it well and it's a little bit more complicated. Any number can be used as many times as you wish, but the limitation is the total amount of 6. It means that you can use any number once or twice, while the total should not be more than 6. For example: On the first day person 1 (P1) visited, on the second day P2 vidsited, and on 3rd day P3 visited = in total 6. I think now I described it accurately for what I really want to know. I found 10 possibilities, but I'm not sure about that. Thank you. ThePupil (talk) 21:35, 8 November 2019 (UTC)
If you only wanted the number, then a formula might work, but it sounds like you also want to list the possibilities, in a specific order. In this case, you would need a computer program to run a simulation. You could also list them by hand, but it seems like too many possibilities for that to be convenient. The actual count will be somewhat less than 36 (729), since that would allow each person to visit on any 1 of the 3 days, without restrictions. To figure the actual number, subtract from the unrestricted possibilities count (729) all the possibilities where day 1, 2, and/or 3 is empty. Show your work and we will check it for you. We can also help with coding the simulation. SinisterLefty (talk) 16:11, 8 November 2019 (UTC)
I can write the possibilities, but a formula can help me to understand if the amount of the possibilities is correct or maybe I forgot or added some by mistake. ThePupil (talk) 21:35, 8 November 2019 (UTC)
I just wrote a simulation which lists all the possibilities. It took me 23 minutes (I had several typos or it would have been quicker). One thing it showed me was that you need to be careful when subtracting all the possibilities when day 1, 2 and/or 3 is empty, because some of the possibilities involve 2 days being empty, and you must avoid subtracting those possibilities twice. One way is to subtract all the possibilities when day 1 is empty, and subtract all the possibilities when day 2 is empty, and subtract all the possibilities when day 3 is empty, then add back in the cases where 2 of the days are empty, to avoid the double-count. SinisterLefty (talk) 16:59, 8 November 2019 (UTC)
I found 10 only if I subtracted the empty days.
As I said to RDBury, I absolutely didn't described it well and it's a bit more complicated. Any number can be used as many times as you wish, but the limitation is the total amount of 6. It means that you can use any number once or twice, while the total should not be more than 6. For example: On the first day person 1 (P1) visited, on the second day P2 vidsited, and on 3rd day P3 visited = in total 6. I think now I described it accurately for what I really want to know. I found 10 possibilities, but I'm not sure about that. Thank you. ThePupil (talk) 21:35, 8 November 2019 (UTC)
So, person 1 could visit 6 times alone, as long as no day was empty ? Perhaps you should list the 10 possibilities you came up with, so we know what you mean. SinisterLefty (talk) 21:42, 8 November 2019 (UTC)
So, with this new info, let's think about the potential combos of people, before thinking of the days for each:
• Person 1 shows up 6 times.
• Person 2 shows up once, and person 1 shows up 4 times.
• Person 2 shows up twice, and person 1 shows up twice.
• Person 2 shows up thrice.
• Person 3 shows up once, and person 1 shows up 3 times.
• Person 3 shows up once, and person 2 once, and person 1 once.
• Person 3 shows up twice (can be eliminated because that would leave a day empty).
• Person 4 shows up once, and person 1 shows up twice.
• Person 4 shows up once, and person 2 shows up once (eliminated).
• Person 5 shows up once, and person 1 shows up once (eliminated).
• Person 6 shows up once (eliminated).
So, I see 7 viable cases. I'd write a mini program to simulate each, and add up the total, or do so manually. For the first case, I see the following possibilities:
A. Day 1 has person 1 show up 4 times. They show up again once on Day 2 and Day 3.
B. Same as above, but with the 4 visits on Day 2.
C. Same as above, but with the 4 visits on Day 3.
D. Day 1 has person 1 show up 3 times, followed by twice on Day 2 and once on Day 3.
E. Same as above but swap Days 2 and 3.
F. Same as D, except everyone goes one day later (with those on Day 3 now going on Day 1).
G. Same as E, except everyone goes one day later (with those on Day 3 now going on Day 1).
H. Same as F, except everyone goes one day later (with those on Day 3 now going on Day 1).
I. Same as G, except everyone goes one day later (with those on Day 3 now going on Day 1).
J. Person 1 shows up twice each day.
In table form:
  Day 1   Day 2   Day 3
=====   =====   =====
A 1111      1       1
B   1     1111      1
C   1       1     1111
D  111     11       1
E  111      1      11
F   1      111     11
G   11     111      1
H   11      1     111
I   1       11    111
J   11      11     11


So, we have 10 possibilities just with person 1. Obviously there will be more when we add in person 2 and 3 and 4. SinisterLefty (talk) 22:12, 8 November 2019 (UTC)
The total number (no visits!) should be not bigger and not smaller than 6. I'll write here the possibilities and it'll help to understand me exactly. I'll write it shortly in such way: 1,1,4 (=P.1 on the 1st day, P.1 again on the second day. P.4 on the third day -in total it's 6. Here are the 10 possibilities:
1st possibility-1,1,4
2nd possibility-4,1,1
3rd possibility-1,4,1
4th possibility-1,3,2
5th possibility-1,2,3
6th possibility-3,2,1
7th possibility-2,2,2
8th possibility-2,1,3
9th possibility-3,1,2
10th possibility-4,1,1
I didn't notice more possibilities.ThePupil (talk) 22:27, 8 November 2019 (UTC)
So are you now saying that only one person can visit on a given day ? That wasn't my understanding.
One number is what should I say. Indeed all my initial description was incorrect.ThePupil (talk) 22:57, 8 November 2019 (UTC)
You need a more systemic approach to avoid missing or duplicating possibilities. For example, your 2 and 10 are the same. And you missed 2,3,1. SinisterLefty (talk) 22:47, 8 November 2019 (UTC)
It's needless to say that you're right about both: 1. I counted twice the same possibility. 2. I omitted one possibility. If I'll find a way (formula that already exists?) to find out quickly and confidently the number of possibilities (10 in the case, right?) as well as the possibilities in details, it would be great to avoid such mistake.ThePupil (talk) 22:57, 8 November 2019 (UTC)
We would have to do it piece-wise:
A) Combos of (4, 1, 1) = 3 possible positions for the 4, and the positions of the 1's are set automatically.
B) Combos of (2, 2, 2) = just 1.
C) Combos of (3, 2, 1) = 3 positions for number 3, leaving 2 positions for number 2, and just 1 for number 1. That's 3×2×1 = 6 positions total.
So, we add 3 + 1 + 6 to get 10. SinisterLefty (talk) 00:47, 9 November 2019 (UTC)
"Indeed all my initial description was incorrect." Then perhaps you should restate your problem from scratch. Confusing is your, "On the first day person 1 (P1) visited, on the second day P2 vidsited, and on 3rd day P3 visited = in total 6." By "person 1", did you intend "1 person"? As stated, you appear to be summing the visitors' labels, not their count.
If your solution for six visits in three days are the ten possibilities you gave above, then it appears as if you are asking for a general count and method of enumeration of the possible number of visitors each day from a total of v visits over d days with at least one visit each day.
If that is the case, you may be interested in Stars and bars (combinatorics).
Per Stars and bars (combinatorics)#Theorem one, there are ${\displaystyle \textstyle {v-1 \choose d-1}}$ possibilities, which for your v=6 & d=3 is ${\displaystyle \textstyle {5 \choose 2}=10}$.
Note that you can also use Stars and bars (combinatorics)#Theorem two distributing the v-d "surplus" visits (those beyond the required one) over d days, giving the same ${\displaystyle \textstyle {v-d+d-1 \choose d-1}=\textstyle {v-1 \choose d-1}}$.
For enumeration, list in the natural order given in Lexicographical order#Cartesian products those n-tuples from {1,2,...,v}d such that ∑xi=v. For your v=6 & d=3, the enumeration would be:
(1,1,4), (1,2,3), (1,3,2), (1,4,1), (2,1,3), (2,2,2), (2,3,1), (3,1,2), (3,2,1), (4,1,1).
-- ToE 03:21, 9 November 2019 (UTC)
Thank you for the answer. I found the following simple formula very useful: "${\displaystyle \textstyle {v-1 \choose d-1}}$ possibilities, which for your v=6 & d=3 is ${\displaystyle \textstyle {5 \choose 2}=10}$". But I didn't understand how did you find the enumeration, and also It's not understood why you found 8 possibilities only while in fact there are 10 possibilities.93.126.116.89 (talk) 23:11, 9 November 2019 (UTC)
"... why you found 8 possibilities only while in fact there are 10 possibilities." ? I listed ten possibilities -- the same as yours but without the repetition or omission, and in a consistent order.
A natural algorithm for enumerating the possibilities in Lexicographical order#Cartesian products, is:
#include <stdio.h>

int main()
{
int i,j;
for (i=1; i<=4; ++i)
for (j=1; i+j<=5; ++j)
printf("%d,%d,%d\n",i,j,6-i-j);
return 0;
}

-- ToE 10:08, 10 November 2019 (UTC)
Or more generally, and recursively:
#!/usr/bin/perl -l

sub visit {
my ($days,$visits, @preceeding) = @_;
if ($days == 1) { print join ", ", @preceeding,$visits;
} else {
foreach my $v (1..$visits-$days+1) { visit($days-1, $visits-$v, @preceeding, \$v)
}
}
}

visit(3,6);

If you follow the logic there, that is what you do in your head when you enumerate them by hand. Code is clearer than words, but you start assigning visit numbers for the earliest days first, ranging from the lowest possible number of visits (1) to the highest (the most which would still allow each remaining day a visit), until the last day when your hand is forced and you must assign the balance of visits remaining. Then step back to the previous day and increase that day's number of visits, unless it is maxed out in which case you step back again. Repeat until you have maxed out your visits on the first day and you are done. -- ToE 12:54, 10 November 2019 (UTC)
And if you want to play with that code but don't have perl installed, you can do so on various sites such as the www.tutorialspoint.com/execute_perl_online.php coding ground. Paste it in the code space, press "Execute", and look at the output to see the repeated descending pattern in the last day's visits and repeated ascending pattern in the earlier days' visits. -- ToE 13:02, 10 November 2019 (UTC)
For better answer than yours, I really couldn't expect... it's really perfect. Thank you very much!93.126.116.89 (talk) 02:52, 11 November 2019 (UTC)
Aside: Is there a name for ${\displaystyle \{x\in \mathbb {Z} ^{k+1}:x_{0}+\dots +x_{k}=M,x_{i}\geq 0,i=0,\dots ,k\}}$ -- sort of an M-scaled integer version of a standard simplex? -- ToE 04:27, 9 November 2019 (UTC)
I don't know if there is a name for that specific family of sets, but you may find the article Ehrhart polynomial relevant. --RDBury (talk) 11:41, 9 November 2019 (UTC)

## Do area of tetrahedron faces determine volume?

Do the areas of the four faces of a tetrahedron uniquely determine volume? And if so, is there a relatively easy formula similar to Heron's formula (or even the Heron's formula#Heron-type formula for the volume of a tetrahedron for calculating the volume of a tetrahedron from the 6 edges.)Naraht (talk) 14:36, 8 November 2019 (UTC)

Since both the area of a face of a regular tetrahedron and the volume of a regular tetrahedron have only one variable (the edge length), then you can trivially create an equation to relate the volume to the area of one face. It's a simple algebra exercise. If you're looking for a general equation for irregular tetrahedrons, since the faces will have different areas, I'm not sure that's possible. --Jayron32 14:41, 8 November 2019 (UTC)
There is a way to assemble four congruent isosceles triangles into a tetrahedron, and for a fixed area of triangle the volume of the tetrahedron would still depend on the shape of the triangles. So in general the volume of the tetrahedron can't be determined by the areas of the faces. There is a Heron-like formula for the volume of a tetrahedron based on the lengths of the six edges, and in general a formula for the hypervolume of an n-simplex based on the lengths of its edges; see Tartaglia's formula. --RDBury (talk) 15:11, 8 November 2019 (UTC)
PS, the general formula is the Cayley–Menger determinant. --RDBury (talk) 15:55, 8 November 2019 (UTC)
Yeah, I was thinking of the equilateral tetrahedron when I said "regular". For ones that have four equivalent non-equilateral triangles, I hadn't thought of that. --Jayron32 15:45, 8 November 2019 (UTC)
Of all the possible shapes of isosceles triangles, the one that gives the maximum volume is the equilateral triangle. For the right isosceles triangle the volume is 0, and the volume approaches 0 if the base approaches 0 and the height increases to maintain the same area. The configuration with isosceles triangles is easiest to see, but it's possible to make a tetrahedron with four copies of any acute triangle. --RDBury (talk) 16:44, 8 November 2019 (UTC)
PS. There is an article on the shape I'm referring to: Disphenoid. --RDBury (talk) 10:11, 9 November 2019 (UTC)