# How many Muslims, Hindus, and Sikhs were there - and how much did they eat?

There are 40 people including Muslims, Hindus and Sikhs, and 40 plates of rice.

• 4 Muslims together eat 1 plate.
• 1 Hindu eats 4 plates.
• 1 Sikh eats 2 plates.

Find the total number of Muslims, Hindus, Sikhs and total number of plates eaten by each category, as there are no plates left and everyone eats something.

32 Muslims, 8 Hindus, 0 Sikhs, who eat 8, 32 and 0 plates of rice respectively.

Another:

24 Muslims, 1 Hindu, 15 Sikhs, who eat 6, 4 and 30 plates of rice respectively.

Explanation:

We have to solve the simultaneous equations:
$M+H+S=40$
$M/4+4H+2S=40$
Replacing $S$ gives:
$M/4+4H+2(40-M-H)=40$
$-7M/4+2H=-40$
$2H+40=7M/4$
$8H+160=7M$
$M=8H/7+160/7$
We can see $H$ must be $1\pmod7$, and so the only solutions are $H=1$ and $H=8$.

• no sir, answer should not be zero. – katifa Mar 17 '18 at 14:30
• @katifa if that's so, the question should say there is at least 1 sikh, 1 muslim, and 1 hindu – Destructible Lemon Mar 18 '18 at 23:20

Since this is essentially the same problem with different numbers, I’d like to bring Gareth’s ingenious approach here too: First,

decrease the amount each person eats by 1, then have 40 people eating, well, nothing.

The amounts become

H=3, S=1, and M=negative .75 plates.

From these, form all combinations that sum up to zero. They are

combo 1: H+4M (5 people)
combo 2: 3S+4M (7 people)
..and that’s it, really. All the other possible combos are combinations of these two.

Adding fives and sevens up, so that there is at least one of each, there is exactly one way to get 40: $1\times 5 + 5 \times 7$.

So, we need exactly 1 combo 1, and 5 of combo 2, which adds up to

1 hindu, 24 muslims and 15 sikhs.

## Why does this approach work?

The reason this works is that the "1" in the first spoiler block is not just any random "one", it's magical. To be more specific, it's the exact required amount that every person needs to eat on average. The second spoiler block's values indicate how much choosing each person causes us to deviate from the required average, and the third spoiler block lists every possible (linearly independent) combination where the average is exactly right, that is, the total deviation is zero.

Adding such combinations to one another will, of course, keep the average correct, so you get the correct average in the end, as was seen above. Adding people in any other proportion would cause the average to deviate from the required one, which means that there cannot possibly be a solution we somehow missed by this approach.

16 Muslims, 7 Hindus and 17 Sikhs.
We can express the problem in two equations:
$M + H + S = 40$ $(1)$
$M/4 + 4H + 2S = 40$ $(2)$

where

$M$ is the number of Muslims, $H$ the number of Hindus and $S$ the number of Sikhs. It seems at first glance that this is two equations for three variables, and so does not have a unique solution, but there are some constraints that help. Namely, we cannot have fractional or negative numbers of people. This means that we have the following additional constraints:
$H \leq 10$
$S \leq 20$
$M \leq 160$

Doubling the first equation and subtracting the second from it we get:
7/4M + 2H = 20
$\frac{7}{4}M - 2H = 20$, which gets the other answerer's result.

or

$H = 20 - \frac{7}{8}M$

at that point

$M$ has to be a multiple of 8 to satisfy the "No fractional people". $0$ is no good; 20 Hindus would eat more than all the rice, we'd need negative Sikhs. $16$ is the only number of Muslims that satisfies $0 \leq H \leq 10$.
And so we have $H = 20 - 7\frac{16}{8} = 7$, and $S = 40 - (7+16) = 17$.

• Answers are typically better with explanation :) – Quintec Mar 17 '18 at 17:09
• I know, I was just surprised that nobody had given that answer yet so I decided to hit "send" and then edit :p I don't know which of me or that other person is right, I just noticed I had a different answer. – Oosaka Mar 17 '18 at 17:17
• Doubling the first equation and subtracting it from the second should give $$\frac{7}{4}M$$, not $$\frac{7}{8}M$$. – justhalf Mar 17 '18 at 17:28
• @justhalf You're right, I mixed up two lines in my notes, but it doesn't matter I got a sign wrong anyway; the other answer is correct – Oosaka Mar 17 '18 at 17:31

Using the same strategy as my answer here:

Define a portion as 1/4 plate
Then there are 160 portions. Muslims eat 1 portion, Hindus 16, Sikhs 8.
Everyone eats at least one portion, so there are at least 40 portions eaten. There are 120 extra portions, Muslims eat 0 extra portions, Hindus 15, Sikhs 7.
120/15 = 8, so one solution is Hindus = 8, Sikhs = 0, Muslims = 32.
The other solution is add 15 to the number of Sikhs and subtract 7 from the number of Hindus (note that these two numbers are the number of portions the other group eats), giving Hindus = 1, Sikhs = 15, Muslims = 34.