There are $100$ persons, including men,women and children. Then there are $100$ sweets.

  • Each man will get $10$ sweets
  • Each woman will get $5$ sweets
  • Each child will get $.5$ (i.e half) of the sweet

At the end of sharing every 100 person should get sweets, and there should be no sweets left.

How many men, women and children are present?

I have tried to make two equations by the way

  1. $M + W + C = 100$
  2. $10M + 5W + .5C = 100$

were $M$ => no. of men $W$ => no. of women and $C$ => no. of children

But in order to solve this equation of three variables, I think I need one more equation

But is there anything else that I miss here?

  • 1
    $\begingroup$ What are your thoughts? The usual start would be to declare some variables and then express the given requirements in terms of those variables. $\endgroup$
    – lulu
    Feb 26, 2020 at 11:47
  • $\begingroup$ I've edited the tags to include "discrete mathematics", which is where this problem lies. But I also advise that you tell us (you can edit your question by clicking "edit" just below the tags) what your thoughts are on the problem, and what you've tried. That was we can craft a better answer for you. $\endgroup$ Feb 26, 2020 at 11:47
  • $\begingroup$ I have tried to create an equation, (2 in fact). m+w+c = 100 10m+5w+.5c=100 or 20m + 10w + c = 200. $\endgroup$
    – Jithin
    Feb 26, 2020 at 11:49
  • 2
    $\begingroup$ Please edit your post to show your efforts (both equations). As you will have noticed, you have more unknowns than equations. The trick now is to keep in mind that $m,w,c$ must be non-negative integers. For example, we know $m\in \{0,1,2,\cdots, 10\}$ If you can't think of anything else, just try each of those. $\endgroup$
    – lulu
    Feb 26, 2020 at 11:51
  • 1
    $\begingroup$ It might also be of help to note that $c$ must be even (why?). Thus you can write $c=2C$ and get rid of the $.5$ $\endgroup$
    – lulu
    Feb 26, 2020 at 11:54

3 Answers 3


The part you are ignoring is that this is a diophantine equation -- that is, all of the variables must be non-negative integers. That will eliminate a large number of solutions to the two equations you listed.

Let's do it intuitionistically to start. We will imagine that there were $100$ children. That obviously doesn't work, because we have only given out $50$ candies. Now, every child we replace with a woman adds $4.5$ (i.e. $5-0.5$) candies, and every child we replace by a man adds $9.5$ (i.e. $10-0.5$) candies. So if $M$ is the number of men and $W$ is the number of women, to add in the missing fifty candies we must have $$4.5W+9.5M=50\\9W+19M=100$$

(or you could have doubled your second equation and subtracted it from your first one to get here if you like algebra more than not-algebra. ^_^)

This again must be solved with non-negative integers. There must be between zero and five men since $19\cdot5=95$, and so doing the math we need $9W\in\{5,24,43,62,81\}$. Obviously, only $81$ is a multiple of $9$, so the unique solution is $M=1,W=9$. Thinking about the children again, this leads to one man ($10$ candies), nine women ($45$ candies), and ninety children ($45$ candies), which properly adds to $100$.


Indeed, you have two equations. One is that there are $100$ people, i.e.


and the other is that there are $100$ sweets handed out to them with the particular distribution, i.e. $$10m + 5w + \frac{c}{2} = 100$$ this other equation can be written to avoid fractions, so

$$20m + 10w + c = 200$$

These are the only two equations you have, however there is another piece of information, and that is that $m$, $w$ and $c$ must all be nonnegative integers, i.e. $m,w,c\in\mathbb \{0,1,\dots,100\}$.

Now, using the first equation, we can get rid of one variable, let's say $c$. So

$$c=100-m-w$$ which means that the second equation becomes

$$20m + 10w + (100-m-w)=200$$ which simlifies to

$$19m + 9w = 100$$

This already tells you that $m\leq 5$, since if $m>5$, $w$ must be negative, which is impossible. So you can now simply test which of the values of $\{0,1,\dots, 5\}$ gives an integer value of $w$.

Or, you can go a little further. Note that since $9w=100-19m$, you need to find a value of $m$ such that $100-19m$ will be divisible by $9$. Now since $100$ leaves a remainder of $1$ when dividing by $9$, while $19$ leaves a remainder of $1$, you have

$$1\cdot 9 + 1 - m(2\cdot 9 + 1) = 9\cdot(1 -2m) + 1 -m$$ which shows that $100-19m$ will leave a remainder of $1-m$ when dividing by $9$, and therefore, $m=1$.

Note that the above calculation is more elegantly done in modular arithmetic, since

$$0=100-19m \equiv 1-19m \equiv 1-m\,(\mathrm{mod}\,9)$$

  • $\begingroup$ Yea, now i know the problem with this equation $\endgroup$
    – Jithin
    Feb 26, 2020 at 12:13
  • $\begingroup$ @MatthewDaly Thanks, fixed. $\endgroup$
    – 5xum
    Feb 26, 2020 at 12:13

The missing "equation" here is the fact that the variables $M$, $W$, and $C$ must all be nonnegative integers. From $10M+5W+{1\over2}C=100$ we see $C=2(100-10M-5W)=10(20-2M-W)$, so it makes sense to write $C=10c$ with $c$ a nonnegative integer. This turns the two equations into

$$M+W+10c=100\quad\text{and}\quad 2M+W+c=20$$

Subtracting the first from the second gives $M-9c=-80$, or $M=9c-80$, which implies $c\ge9$, in order to guarantee $M\ge0$. On substituting this expression for $M$ into the first equation, we have $(9c-80)+W+10c=100$, or $W=180-19c$, which implies $c\lt10$ in order to guarantee $W\ge0$. But the inequalities $9\le c\lt10$ together imply $c=9$, which gives $M=9\cdot9-80=1$, $W=180-19\cdot9=9$, and $C=10c=90$. Checking our work (which never hurts to do, and, for me at least, often helps avoid embarrassment), we have


Remark: The approach here is similar to those in Matthew Daly's and 5xum's answers, in that the key is the observation that the variables are nonnegative integers. The main difference is that the approach here begins by establishing that the variable $C$ must be a multiple of $10$, and then takes advantage of that fact to quickly limit the possibilities of which multiple it can be.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.