# Chicken Problem from Terry Tao's blog (system of Diophantine equations)

This problem was posted by Terry Tao in his blog earlier. It's actually from his son's Math Circle. It took him $15$ minutes to solve it. I guess we all can take a crack at it.

Three farmers were selling chickens at the local market. One farmer had $10$ chickens to sell, another had $16$ chickens to sell, and the last had $26$ chickens to sell. In order not to compete with each other, they agreed to all sell their chickens at the same price. But by lunchtime, they decided that sales were not going so well, and they all decided to lower their prices to the same lower price point. By the end of the day, they had sold all their chickens. It turned out that they all collected the same amount of money, $\$35$, from the day's chicken sales. What was the price of the chickens before lunchtime and after lunchtime? • Let$x,\ y,\ z$be the respective numbers of chickens the three sold before lunch at price$p$. Then$10-x,\ 16-y,\ 26-z$are the after-lunch numbers sold at price$q. Then \begin{align} px + q(10-x) & = 35 \\ py + q(16-y) & = 35 \\ pz + q(26-z) & = 35 \end{align} Dec 29, 2014 at 1:41 • 3 equations, 4 unknowns - what am I missing? – Shai Dec 29, 2014 at 1:42 • @Shai Integers, they sell whole chickens. Dec 29, 2014 at 1:43 • 5 unknowns infact, but there are several conditions, thatx,y,z,10-x,16-y,26-z\in\mathbb{Z}^+\cup \{0\}$, and that$p>q>0$Dec 29, 2014 at 1:44 • What was the price of the chickens before lunchtime and after lunchtime? You do realize none of you have answered the question. Dec 29, 2014 at 1:53 ## 6 Answers If$u>v>w$are the number of chickens that the three farmers sold at the higher price, then, by linearity*,$(26-16)(u-v) = (16-10)(v-w)$, and so$u-v$is divisible by$3$, and$v-w$is divisible by$5$. It follows that$(u,v,w) \in \{(8,5,0),(9,6,1), (10,7,2)\}$. Only the middle solution gives prices that can be measured in USD (or most currencies), namely$\$3.75$ and $\$1.25$. * To elaborate on this point: If a farmer begins with$n$chickens, sells$f(n)$at the higher price point$A$and$n-f(n)$at the lower price point$B$, and earns a profit$P$, then the points$(n,f(n))$are collinear (assuming that$A,B,P$are constant). This is because these points are the solutions to a linear equation in two variables, namely$Af(n) + B(n-f(n)) = P$. A line has constant slope, so the equation in my first paragraph follows. • Nice. But why must$u$,$v$, and$w$be pairwise different? Dec 29, 2014 at 17:02 • @ChristopherCreutzig Since they all started with a different number of chickens, the only way any pair of them could sell the same number at the high price and come out with the same amount of money at the end is if the lower price was$0. I suspect the pairwise different is just intended to eliminate this trivial solution. Dec 29, 2014 at 18:39
• I do not like this kind of mathSE answer. One should not be rewarded for leaving out details, much less if time is spent figuring out which details exactly to leave out, instead of just writing out the details.
– 6005
Feb 8, 2015 at 22:58
• @Goos Then you would have probably liked my original answer even less, since "by linearity" originally read "a little quiet contemplation is enough to see that". But if there are details that you'd like to see filled in, you could try asking politely instead of debating posting ethics (which, correct me if I'm wrong, belongs on meta anyway). Feb 8, 2015 at 23:26

Let $c$ be the morning price and let $d$ be the difference between the morning and afternoon prices. Now we attempt to solve for how many did each seller sell at each of the two prices.

Think of it this way: if the seller sold everything at $c$ after lunchtime, the total sales will be $kc$, where $k$ is the number of chickens. However, when he "switches" a chicken from the "after-lunchtime" price to the "before-lunchtime" price, there will be a price increase of $d$ (which is the difference between the after-lunchtime and before-lunchtime prices). Hence every chicken sold at the before-lunchtime price rather than the after-lunchtime price will incur an increase of sales of $d$. With this, we can know how many chickens were sold at the higher price.

For the one who sold $10$ chickens, if he sold everything at the after-lunchtime price, his sales will be $10c$. The difference is $35-10c$, so the number of chickens sold before lunchtime is $\frac{35-10c}{d}$. Similarly, the number of chickens sold before lunchtime for the other 2 sellers are $\frac{35-16c}{d}$ and $\frac{35-26c}{d}$. It is to note that all of those are integers. $\frac{35-10c}{d} \leq 10$, so the others: $\frac{35-16c}{d}$ and $\frac{35-26c}{d}$ are less than $10$.

Express the 3 quantities, $\frac{35-10c}{d}$, $\frac{35-16c}{d}$, and $\frac{35-26c}{d}$ and $x$, $y$, and $z$, which are integers. Then $x-y:y-z=\frac{6c}{d}:\frac{10c}{d}=3:5$. Since $x$, $y$, and $z$ are integers and $gcd(3,5)=1$, $x-y$ is a multiple of $3$ and $y-z$ is a multiple of $5$. Thus we can write $x-y=3k$, so $y-z=5k$, and $x-z=(x-y)+(y-z)=3k+5k=8k$, where $k$ is an integer. Since $x \leq 10$ and $z \geq 0$, $x-z \leq 10$, so $k=8$. Hence $x=z+5+3=z+8$, $y=z+5$.

$z=x-8$, but $z \geq 0$, so $x \geq 8$. Thus we only need to consider $3$ cases: $x=8$, $x=9$, $x=10$, as $x \leq 10$.

If $x=8$, then $y=5$, $z=0$. Plugging in back, $z=\frac{35-26c}{d}=0$, so $c=\frac{35}{26}$. With $y=5$, we get that $\frac{35-16c}{d}=5$, so $35-16c=5d$. Since $c=\frac{35}{26}$, $35-16(\frac{35}{26})=5d$. Simplifying, $7-16(\frac{7}{26})=d$. Thus $d=\frac{70}{26}=\frac{35}{13}$. The price before lunchtime is then $\frac{35}{26}+\frac{35}{13}=\frac{105}{26}$.

If $x=9$, then $y=6$, $z=1$. Plugging in back, $1=z=\frac{35-26c}{d}$ and $6=y=\frac{35-16c}{d}$. Cross-multiplying, we get $d+26c=35$ and $6d+16c=35$. $d+26c=6d+16c$, so $10c=5d$, $2c=d$. Hence $6d=12c$, so going back to $6d+16c=35$, we get that $12c+16c=35$, $28c=35$, so $c=\frac{5}{4}$, $d=\frac{5}{2}$. Thus the before lunchtime price is $\frac{5}{4}+\frac{5}{2}=\frac{15}{4}$.

If $x=10$, then $y=7$, $z=2$. Plugging in back, we get $2=z=\frac{35-26c}{d}$ and $7=y=\frac{35-16c}{d}$. Cross-multiplying, we get $2d+26c=35$ and $7d+16c=35$. $2d+26c=7d+16c$, so $5d=10c$, $d=2c$. Going back to $2d+26c=35$, we get $4c+26c=35$, so $30c=35$ and $c=\frac{7}{6}$. $d=2c$, so $d=\frac{7}{3}$, and the before-lunchtime price is $\frac{21}{6}\frac{7}{2}$.

We have now 3 cases to possible solutions. Let $e$ be the before-lunchtime price

Case 1: $(x,y,z)=(10,7,2)$, $(10-x,10-y,10-z)=(0,3,8)$. $(p,e)=(\frac{7}{6},\frac{7}{2})$.

There are several problems with this answer - the prices cannot be given in cash (or even in check), since they are not a whole number of dollars/cents: if they round this, the total will not be 35 dollars. - Why should the first farmer still lower his prices if he sold everything?

Case 2: $(x,y,z)=(9,6,1)$, $(10-x,10-y,10-z)=(1,4,9)$. $(p,e)=(\frac{5}{4},\frac{15}{4})$.

I don't see any problem with this answer

Case 3: $(x,y,z)=(8,5,0)$, $(10-x,10-y,10-z)=(2,5,10)$ $(p,e)=(\frac{35}{26},\frac{105}{26})$.

There is a problem with this answer - the prices cannot be given in cash (or even in check), since they are not a whole number of dollars/cents: if they round this, the total will not be 35 dollars.

Wrapping up, there are $3$ possible ordered sets of after-lunchtime and before-lunchtime prices: $\boxed{(\frac{7}{6},\frac{7}{2}),(\frac{5}{4},\frac{15}{4}),(\frac{35}{26},\frac{105}{26})}$. However, only $1$ answer is possible in real life because dollars are subdivided into $100$ cents, and the other answers would yield a fraction number of cents, which is impossible. Hence the only possible answer is $\boxed{(\frac{5}{4},\frac{15}{4})}$

Whew! Took me 30 minutes to type

• Sorry to bother you with another suggested edit--I think you mean $8k = 8$, so $k=1$. Also, a minor comment in the same paragraph: you are using the fact that $z < x$ so $1 \leq x-z \leq 10$ which (combined with the fact that $(x-z)$ is divisible by $8$) implies $x-z = 8$. Feb 9, 2015 at 0:11

There does not seem to be a unique solution to this problem: there are two $5$-tuples $(x,y,z,p,q)$ satisfying the given conditions, namely $$(x,y,z,p,q) \in \left\{\left(8,5,0,\tfrac{105}{26},\tfrac{35}{26}\right), \left(9,6,1,\tfrac{15}{4},\tfrac{5}{4}\right)\right\}.$$ It is not stated that all farmers sold at least one chicken prior to lunchtime, and the difference between the first and second solution (one chicken each) is not, in my opinion, subjectively large enough to justify saying that the farmers were unhappy with the rate of sales for the former but not the latter. The only plausible qualitative difference between the solutions is that the latter corresponds to an exact amount to the penny; the former does not (but why should this matter from a mathematical standpoint?). A full solution is not difficult although it can be a bit tedious to obtain, but one key is to derive the Diophantine condition $$5x - 8y + 3z = 0,$$ in conjunction with the obvious constraint $10 \ge x > y > z \ge 0$.

• Given that the currency is dollars, the second solution gives more plausible prices. Dec 29, 2014 at 2:05
• Why wouldn't the first farmer agree to lower the price, if he's already sold all his chickens at the higher price? It's not like he's losing anything by doing so. The real issue with @sas's solution is that \$7/6 does not work out to a whole number of cents. Dec 29, 2014 at 15:29 Here$x,y$are the prices before and after lunch,$k,l,m$are the number of sold chickens before lunch. And$x>y>0$.$ \left\{ \begin{array}{l} kx+(10-k)y=35 \\ lx+(16-l)y=35 \\ mx+(26-m)y=35 \end{array} \right. $Subtract the second and the third from the first gives$\displaystyle \left\{ \begin{array}{l} (k-l)x-(6+(k-l))y=0 \\ (k-m)x-(16+(k-m))y=0 \end{array} \right. $Multiply to eliminate$x$gives$\displaystyle \left\{ \begin{array}{l} (k-m)(k-l)x=(k-m)(6+(k-l))y \\ (k-l)(k-m)x=(k-l)(16+(k-m))y \end{array} \right. $Which implies$(k-m)(6+(k-l))=(k-l)(16+(k-m))\implies6(k-m)=16(k-l)\implies16l-6m=10k(1)\quad 8l=5k+3m$[Here I can't find out anything better than solving the diophantic equation and test. And I guess that$100x,100y$must be integers.] After some sleep: • the only explanation of the even outcome is that$k>l>m$• (1) says that$5k+3m$must be divisible with$8$, which gives$3$alternatives $$\begin{array}{rrr} k & l & m \\ \hline 10 & 7 & 2 \\ 9 & 6 & 1 \\ 8 & 5 & 0 \end{array}$$ Only$k=9,l=6,m=1$make sense and gives$\displaystyle y=\frac{5}{4}=1.25$and$\displaystyle x=\frac{15}{4}=3.75$ I did it with the above diagram, now of course drawn to scale. The two red rectangles (over)$QH$&$HC$, green rectangles$AH$&$HD$, blue rectangles$BH$&$HE$represent the three farmers' revenue. The horizontal axis represents the number of chicken sold, and the height is the price at which the farmer sold the chicken. Naturally,$H$represents the point at which the farmers decide to lower the price. The rectangle over$QA$has the same area as that over$CD$and same for$AB$and$DE$. Hence$QA:AB=CD:DE=CD-QA:DE-AB=16-10:26-16=3:5$, and$QA+AB\le 10$. So$QA=3,AB=5$. This gives$CD=9,DE=15$, which means that the ratio of the two prices is$3:1$. Since$BC=2$, we test all possible positions of$H$, to obtain the one shown in the figure, because it gives some reasonable prices, as calculated below: If$x$is the starting price, then$9x+\frac{x}{3}=35$, and$x=3.75$. The ending price is$1.25$. • Why does$\mathrm{Area}(QA) = \mathrm{Area}(CD)$? Jan 4, 2015 at 23:06 • When I say rectangle (over)$QA$I mean the one which has bottom side$QA\$. Jan 5, 2015 at 1:52
• Sorry, I too misinterpreted your question then. Let's use your notation :) \begin{align}\operatorname{Area}(QA) &= \operatorname{Area}(QH) +\operatorname{Area}(HC)-(\operatorname{Area}(AH)+\operatorname{Area}(HC))\\ &= \operatorname{Area}(AH)+\operatorname{Area}(HD)-(\operatorname{Area}(AH) +\operatorname{Area}(HC))\\ &= \operatorname{Area}(CD).\end{align} Basically the amount deducted from the left must equal the amount added to the right. (ed ajf) Jan 5, 2015 at 6:03 