143
$\begingroup$

So I'm tutoring at the library and an elementary or pre K student shows me a sheet with one problem on it:

Put 9 pigs into 4 pens so that there are an odd number of pigs in each pen.

I tried to solve it and failed! Does anybody know how to solve this? This question seems ridiculously difficult and impossible IMO.

$\endgroup$
27
  • 15
    $\begingroup$ Surely you are not suggesting that school teachers would never ask a trick question? $\endgroup$
    – Old John
    Nov 7, 2013 at 1:11
  • 11
    $\begingroup$ The question fails to make it clear that a total number of 9 pigs is to be distributed into four pens; a possible interpretation is simply to put 9 pigs into each of four pens. This kind of imprecise language is one reason why users ask for one thing, but the software which is implemented does something else. :) $\endgroup$
    – Kaz
    Nov 7, 2013 at 3:34
  • 144
    $\begingroup$ This question is silly. You can't fit nine pigs into a pen. Only ink goes in pens. You have to liquidize the pigs into pig ink, and then you can divide the pig ink equally into four portions. $\endgroup$
    – Crashworks
    Nov 7, 2013 at 3:43
  • 11
    $\begingroup$ As far as I know, in my Ontarian school board, teachers ("good" or "bad" alike) wouldn't give questions like these without explicitly telling them that they are meant to be riddles. It would hurt the confidence of the students and become political. Perhaps this child knew it was a riddle and wanted to share it for the fun of it. $\endgroup$
    – SimonT
    Nov 7, 2013 at 4:06
  • 9
    $\begingroup$ One does not simply... imgur.com/vF5b3mf $\endgroup$
    – Simone
    Nov 8, 2013 at 10:16

18 Answers 18

210
$\begingroup$

Since this has been exposed, some claim, to be a riddle and not a bona fide math question, why not completely drive the stake through its heart:

Pen 1: 7 pigs

Pen 2: 1 pig

Pen 3: 3 pigs

Pen 4: -2 pigs

Now the astute reader will note that -2 pigs is a pretty darn odd number of pigs to be in a pen!

$\endgroup$
13
  • 67
    $\begingroup$ If anyone needs me, I am ducking under the table, well shielded from flying erasers. $\endgroup$
    – Kaz
    Nov 7, 2013 at 3:40
  • 54
    $\begingroup$ -2 may be even, but the concept of -2 pigs is indeed quite odd. $\endgroup$ Nov 7, 2013 at 8:38
  • 45
    $\begingroup$ -2 pigs = 500 pounds of bacon ? $\endgroup$
    – kriss
    Nov 7, 2013 at 8:54
  • 15
    $\begingroup$ Really nobody got it? Of course -2 is even! That's a cool answer! Check the meaning of "odd", it also means unusual, absurd. What he meant is "It's really absurd for -2 pigs to be in a pen." $\endgroup$ Nov 7, 2013 at 14:29
  • 3
    $\begingroup$ I have known this question/riddle for nearly half a century, and never expected to see still another good valid answer. $\endgroup$ Nov 10, 2013 at 1:58
208
$\begingroup$

It appears to be a trick question.

Make 3 pens, put 3 pigs in each pen. Then put a 4th pen around all 3 of the other ones, and you have 9 pigs in that pen.

Update

@MJD found a source for this problem with solution, see Boys' Life magazine from 1916.

$\endgroup$
24
  • 20
    $\begingroup$ The trick is good (though I do not see why not just to build 4 nested pens and put all pigs into the innermost one). There are many other solutions in the same spirit (using the ambiguity in the problem statement). We can build 4 disjoint pens, put one pig in each of the first 3 and 6 in the fourth and let somebody try to convince us that there aren't 3 pigs in the last pen (if we have 6, we certainly can point out three (an odd number) of them that are in the pen). Another option is to have one extra pig in one pen (that the pens must be empty is as unclear as that they must be disjoint). $\endgroup$
    – fedja
    Nov 7, 2013 at 2:01
  • 56
    $\begingroup$ Basically, this is a riddle, not a maths question. $\endgroup$
    – TRiG
    Nov 7, 2013 at 2:58
  • 63
    $\begingroup$ Even simpler: if pens can be nested, then simply make this quadruple-walled pen: [[[[ 9 pigs ]]]]. Why go through all the trouble of dividing into groups of three? $\endgroup$
    – Kaz
    Nov 7, 2013 at 3:36
  • 10
    $\begingroup$ I wonder how well this riddle would go over with an 8-year old who lives on a farm? Surely farmers don't nest pig pens and would not even consider thinking about such a thing valid? $\endgroup$
    – Michael
    Nov 7, 2013 at 19:10
  • 24
    $\begingroup$ @Michael I wonder if this is also harder for those familiar with sets, who'd point out that $\{\{\{\{\bullet\}\}\}\}$ isn't four sets each containing $\bullet$, but a three sets that each contain one set, and one set that contains $\bullet$. Those familiar with strongly typed collections in programming languages would also complain that you can't put a Pig into a Set<Set<Pig>>. $\endgroup$ Nov 7, 2013 at 22:12
122
$\begingroup$

Lemma: $-\frac{1}{12}$ is an integer.

proof: Consider the Riemann zeta function $\zeta$ evaluated at $-1$. By analytic continuation, $\zeta(-1) = -\frac{1}{12}$. However, we also have the series expansion $\zeta(s)=\displaystyle \sum_{n=1}^\infty n^{-s}$, so (ignoring issues with convergence), $\zeta(-1)=1+2+3+\cdots$. This is an infinite sum of integers. Any finite sum of integers is an integer, and the since the integers are a closed set (and hence contain all limit points) this also holds in the limiting case. Hence $-\frac{1}{12}$ is an integer.

Corollary $\frac{2}{3}$ is odd.

proof: By above, since $-\frac{1}{12}$ is an integer, $4 (-\frac{1}{12})=-\frac{1}{3}$ is an even integer. Since the successor of any even integer is odd, $-\frac13 +1 = \frac23$ is odd.

Theorem It is possible to put 9 pigs in 4 pens such that each pen has an odd number of pigs.

proof: For the first pen, put $7$ of the pigs in. Cut the remaining $2$ pigs into equal thirds and put two of the thirds in each of the remaining pens. Since $7=2\times3+1$, $7$ is odd. By corollary above, $\frac23$ is odd. Hence all four pens have an odd number of pigs.

Note: The above is humor.

$\endgroup$
9
  • 6
    $\begingroup$ Interesting how Riemann shows up everywhere! $\endgroup$ Nov 7, 2013 at 8:08
  • 14
    $\begingroup$ It is true that $\frac 23$ is an odd integer! $\endgroup$
    – Asaf Karagila
    Nov 7, 2013 at 14:42
  • 1
    $\begingroup$ the infinite summation is only valid for $s>1$. $\endgroup$
    – pathfinder
    Nov 7, 2013 at 17:15
  • 5
    $\begingroup$ ^^^ thank you, poindexter. it was a joke. $\endgroup$ Nov 7, 2013 at 18:42
  • 1
    $\begingroup$ @JonathanLandrum poindexter - that just became my favorite word! $\endgroup$ Nov 8, 2013 at 22:48
102
$\begingroup$

It's not possible. Adding an even number of odd numbers will give an even number: $(2a+1) + (2b+1) = 2(a+b+1)$.

$\endgroup$
5
  • 59
    $\begingroup$ This is the correct solution. Kids who grow up on trick questions just end up being a bunch of smart ass. Methodological, evidence based argument should be what they are accustomed to. $\endgroup$ Nov 7, 2013 at 3:16
  • 37
    $\begingroup$ @SleeperSmith but what if life is a trick question? $\endgroup$
    – Andy
    Nov 7, 2013 at 4:47
  • 4
    $\begingroup$ @AndyPryor Trust me it isn't. Your parents would've picked your high school, college doctor/law degree, PHD, arranged marriage, asked favor for you to start at a big firm, decided the number of kids you should have.... If you are a chinese. (I'm a chinese. No that's a tongue in cheek joke. :p) $\endgroup$ Nov 7, 2013 at 4:50
  • 3
    $\begingroup$ @SleeperSmith There is something to be said for this from the standpoint of mastering technique, sir. But don't you think a dose of these "trick" questions might encourage creative thinking? This might be a soft skill, but it is an important one, especially for the many who do not pursue a rigorous adult eduction (many adults), or who must make abstract connections (ie, politicians.) $\endgroup$ Nov 8, 2013 at 5:15
  • $\begingroup$ It may be possible if you nest pens... $\endgroup$
    – alinsoar
    Dec 23, 2021 at 1:21
65
$\begingroup$

Put 9 pigs into 4 pens so that there are an odd number of pigs in each pen.

What about the simplest solution? The case where the pens are 'embedded' within each other:

pigs in pens

Four pens, Nine in each. Nine is odd.

$\endgroup$
4
  • 2
    $\begingroup$ Oops, just realised there are a couple of similar answers. Will leave this for pictorial representation. $\endgroup$
    – azz
    Nov 7, 2013 at 14:08
  • 6
    $\begingroup$ I almost didn't upvote this to keep the votes at 9. :D $\endgroup$
    – codedude
    Nov 7, 2013 at 17:55
  • 1
    $\begingroup$ (Side note) would you believe I created this image with HTML & CSS as I couldn't be bothered opening up GIMP? $\endgroup$
    – azz
    Nov 8, 2013 at 13:33
  • 1
    $\begingroup$ don't worry I do that all the time :) $\endgroup$
    – codedude
    Nov 9, 2013 at 2:08
36
$\begingroup$

I think I finally got the teachers intended solution ;)

A pen is a closed fence, and since the earth is spherical there is no preferred side of the fence which is the enclosed one. Solution: Put 9 pigs anywhere, put 4 separate pens beside them.

$\endgroup$
2
  • 7
    $\begingroup$ brilliant! Solution in spherical geometry. $\endgroup$
    – kriss
    Nov 12, 2013 at 12:44
  • 1
    $\begingroup$ This works even with a single pig. $\endgroup$ May 28, 2016 at 21:36
34
$\begingroup$

There is many ways to do it. The real question is: how many? I wonder does the last in this picture counts?

pigs

$\endgroup$
2
  • 7
    $\begingroup$ To stay on the sensible (materially possible) side, I would propose that pens should be either disjoint or fully included in a larger one (intersection or any two pen is either empty or the smaller pen). That would exclude the last one (and the next to last has a pen with six pigs and should also be excluded). Now the problem begins to be interresting. Looks like a Lisp parenthesing problem. $\endgroup$
    – kriss
    Nov 7, 2013 at 12:50
  • $\begingroup$ @kriss Thx, next to last was wrong indeed (also the second one), counting to five is hard! Fixed it and also colored the pens for more clearity. $\endgroup$
    – swish
    Nov 7, 2013 at 13:50
15
$\begingroup$

Put 9 pigs into 4 pens so that there are an odd number of pigs in each pen. enter image description here

Each of pens $1,2,3,$ and $4$ have an odd number of pigs in them with $1$ each. The last $5$ pigs are liberally interpreted as being 'put into' the $4$ pens. Though they aren't inside one of the four pens they're inside the four pens.

I didn't see this in the pictured solutions so I thought I'd add it. Apologies if it was already mentioned. It was however mentioned that you could put $1$ in each of the $4$ pens and let the other $5$ roam free. But, what good are your pigs if when you want bacon you discover they walked away? This fixes your bacon in place. Nevertheless, I had fun drawing piggy banks!

$\endgroup$
12
$\begingroup$

Put one in each pen and let the other 5 roam.

No one said they all had to be enclosed in pens when you were done.

$\endgroup$
1
  • 12
    $\begingroup$ This solution does not "Put 9 pigs into 4 pens" $\endgroup$
    – rybo111
    Nov 10, 2013 at 12:08
12
$\begingroup$

Here are 88 solutions (I believe this is all of them):

[2,[2,[4,[1]]]]
[4,[2,[2,[1]]]]
[2,[1]],[3],[3]
[1],[[3]],[5]
[4,[[2,[3]]]]
[[6,[[3]]]]
[6,[1,[1],[1]]]
[2,[[[7]]]]
[1],[3],[4,[1]]
[[3]],[3],[3]
[2,[1],[1],[5]]
[2,[4,[2,[1]]]]
[1,[2,[1]],[5]]
[1],[3],[[5]]
[1,[3],[4,[1]]]
[[4,[4,[1]]]]
[1,[[3]],[5]]
[2,[5,[1],[1]]]
[7,[[1]],[1]]
[4,[[[5]]]]
[5,[1],[[3]]]
[1],[1],[6,[1]]
[[8,[[1]]]]
[1,[1],[[7]]]
[[2,[6,[1]]]]
[[[2,[7]]]]
[6,[1],[1],[1]]
[[1]],[3],[5]
[1,[3],[2,[3]]]
[3,[1],[2,[3]]]
[[2,[[7]]]]
[[4,[[5]]]]
[[6,[2,[1]]]]
[1,[[1]],[7]]
[1],[1],[2,[5]]
[2,[6,[[1]]]]
[1,[1],[4,[3]]]
[2,[[2,[5]]]]
[[3],[3],[3]]
[[[6,[3]]]]
[[[8,[1]]]]
[5,[1],[2,[1]]]
[4,[4,[[1]]]]
[[[4,[5]]]]
[2,[2,[[5]]]]
[1,[1],[2,[5]]]
[1],[1],[4,[3]]
[2,[4,[[3]]]]
[6,[2,[[1]]]]
[[[[9]]]]
[6,[[[3]]]]
[[1,[1],[7]]]
[1],[2,[1]],[5]
[1,[1],[6,[1]]]
[2,[1,[1],[5]]]
[2,[[4,[3]]]]
[8,[[[1]]]]
[4,[3,[1],[1]]]
[1,[3],[[5]]]
[4,[1],[1],[3]]
[[4,[2,[3]]]]
[2,[2,[2,[3]]]]
[[3,[3],[3]]]
[[3,[1],[5]]]
[3,[[3]],[3]]
[3,[1],[[5]]]
[[2,[4,[3]]]]
[2,[1,[3],[3]]]
[[1],[3],[5]]
[2,[[6,[1]]]]
[4,[1,[1],[3]]]
[3,[2,[1]],[3]]
[6,[[2,[1]]]]
[[1],[1],[7]]
[2,[3,[1],[3]]]
[1],[3],[2,[3]]
[[7,[1],[1]]]
[[1,[3],[5]]]
[[5,[1],[3]]]
[[2,[2,[5]]]]
[2,[1],[3],[3]]
[5,[[1]],[3]]
[4,[2,[[3]]]]
[3,[[1]],[5]]
[[1]],[1],[7]
[4,[[4,[1]]]]
[3,[1],[4,[1]]]
[1],[1],[[7]]
$\endgroup$
1
  • 9
    $\begingroup$ You should supply your code and try to convince us that it produces all possible solutions. $\endgroup$
    – miracle173
    Dec 30, 2014 at 20:52
11
$\begingroup$

Suppose you have 4 pens. An odd number looks like this: $2a + 1$ for some integer $a \ge 0$. Now make for pens and add.

$$2a+1+2b+1+2c+1 +2d+1 = 2(a+b+c+d) + 4 = 2(a+b+c+d+2).$$

The result is even.

$\endgroup$
2
  • 1
    $\begingroup$ There is no stipulation that an odd integer must also be positive. $\endgroup$ Nov 7, 2013 at 18:43
  • $\begingroup$ That does not matter here. But if it's being asked of small kids, it's not likely that signed numbers are under discussion. $\endgroup$ Nov 7, 2013 at 18:56
10
$\begingroup$

Nobody said the pens were disjoint. With non-disjoint pens, there are many solutions.

$\endgroup$
2
  • 13
    $\begingroup$ But... are the pigs disjoint? $\endgroup$ Nov 8, 2013 at 22:43
  • 5
    $\begingroup$ @BrunoJoyal: if the pigs aren't disjoint, then it's just a matter of time until you have at least 10 pigs, at which time the problem can be solved easily with disjoint pens. $\endgroup$ Nov 10, 2013 at 14:06
5
$\begingroup$

Just put the pigs in the first pen, then put that pen inside the next pen, etc.

The last pen will contain a pen that contains a pen that contains a pen that contains 9 pigs, but all 4 pens will contain 9 pigs.

You could also put 3 pigs each in 3 pens, and put those 3 pens inside the bigger pen.

$\endgroup$
4
$\begingroup$

The problem as stated is impossible under the usual interpretation, because the sum of four odd numbers will be even, and so can't equal $9$. But the trick question interpretation from Amzoti's comment/answer seems pretty plausible!

$\endgroup$
4
$\begingroup$

Put 6 pigs in the first pen, then 1 pig in each subsequent pen. Don't feed the pigs in the first pen. The first pen will contain an odd number of pigs soon enough.

Another option is to make sure that of the 6 pigs in the first pen, one is the mother, the remainder being piglets and hope for the worst. Same result. That's how pigs get down.

$\endgroup$
2
  • $\begingroup$ Horrible, yes. But logically, what's wrong with questioning the mathematical model that pairs integers with pigs? They can indeed literally disintegrate. $\endgroup$
    – minopret
    Nov 9, 2013 at 2:21
  • $\begingroup$ @minopret I suspect that everything was wrong with every facet of this question... $\endgroup$
    – Tonithy
    Nov 9, 2013 at 2:25
2
$\begingroup$

Let's rephrase the problem using well defined mathematical terms: as far as I know pigs and pens are not such well defined unambiguous mathematical terms.

Maybe something like:

Dispatch integers from 1 to 9 between 4 sets of integers.

It becomes obvious that it is impossible if sets are disjoint, and trivial if they are not.

And as more "classical" question we could also ask how many ways there is to dispatch these integers between 4 sets where number of items in every set is odd.

$\endgroup$
3
  • $\begingroup$ Forgive me for not being knowledgeable in this subject area, but how would one go about proving that it is impossible to do this for disjoint sets? I find this question/riddle/problem intriguing. $\endgroup$
    – jacobq
    Feb 12, 2014 at 7:02
  • $\begingroup$ Would it be similar to Matt E's answer about the sum of 4 odd integers always being even? $\endgroup$
    – jacobq
    Feb 12, 2014 at 7:04
  • $\begingroup$ I call it obvious because I can proove it with a direct enumerative approach. You must put at least 1 pig in each pen because 0 is even, but if you put 1 in the first 3 pens you get 6 in the last one. Now to fix that you must remove at least one pig from the largest pen. 1 won't do (because the pig will make the target pen even, 2 or 4 won't do because the source pen will have an even number of pigs, 3 and 5 similarly won't do if you examine all possible dispatchs. Of course there are other ways to prove it (and generalise it), but the above reasoning is enough. $\endgroup$
    – kriss
    Feb 12, 2014 at 8:21
1
$\begingroup$

Just put all the 9 pigs within a pen. Then build a second pen all around the first, a third one all around the second and so on. You will end up by having each pen containing an odd number of pigs.

$\endgroup$
-1
$\begingroup$

I assume in elementary school they are not expected to know the parity of zero, so why not this:

3,3,3,0

Thats 9, and all "not even" (again, forget about the parity of zero).

$\endgroup$
5
  • 14
    $\begingroup$ I don't think it's unreasonable for elementary school students to know the parity of zero. And if they really don't know, how can they be expected to use it in the solution? Not to mention that this solution is just purely wrong. $\endgroup$
    – EuYu
    Nov 7, 2013 at 3:02
  • 3
    $\begingroup$ I don't understand all the down votes. In elementary school, I didn't know that 0 was even. I thought it was capable of both, just like from a theoretical point of view, you could have positive zero and negative zero. Didn't know this was such a serious question. No body else took it seriously, especially the "put three pens inside the fourth" answers. That's clearly not the answer either. $\endgroup$ Nov 7, 2013 at 14:15
  • $\begingroup$ It's certainly not an odd number though! $\endgroup$
    – James
    Nov 7, 2013 at 14:19
  • 21
    $\begingroup$ @NicholasYost Because you can't use lack of knowledge to prove things. It's like saying "Just make 1 pen with all the pigs in it because I didn't know $1 \neq 4$" $\endgroup$ Nov 7, 2013 at 15:40
  • 1
    $\begingroup$ You also can't have positive zero and negative zero. You can put a plus or a minus sign in front of it, but it still just equals zero. Indeed, any reasonable definition of "positive" or "negative" usually boils down to be greater than or less than zero. $\endgroup$ Jan 11, 2014 at 5:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .