# A man bought several liters of wine

Diophantus of Alexandria was a Greek mathematician who lived in the third century (AD). Diophantus wrote a series of books called "Arithmetica", most of which are lost. Among many other problems, the Arithmetica contained the following mathematical puzzle:

A man bought several liters of two kinds of wines. He paid 8 drachmas per liter of fine wine and 5 drachmas per liter of ordinary wine. The total sum of money he paid is equal to the square of the total quantity of the bought wine expressed in liters. The task is to find the quantities of each kind of wine.

In solving this puzzle, assume that the man bought (non-negative) integer numbers of liters of both types of wine. The puzzle allows more than one solution, and your task is to determine all solutions.

-
Strictly as a note on history, Diophantus died long before the "liter" was defined, so the original puzzle surely used some other measure of volume. – Paul Sinclair Mar 18 at 17:46
Indeed, but since the liter is only about 200 years old, I suspect one could find versions available that use other units. It is curious that the volume was updated, but coinage apparently was not. Hazarding a guess, Diophantus might have used "amphora" - the name of the jug in which wine was commonly transported. – Paul Sinclair Mar 18 at 17:57
@Paul: The coinage drachma is very old, and has already been used in ancient Greece. – Gamow Mar 18 at 18:07
Yes - that is why I said it apparently has not been updated, even though the volume has. – Paul Sinclair Mar 18 at 18:08
Aaah. The wikipedia (en.wiktionary.org/wiki/litre) tells me that our word "liter" comes from the Ancient Greek word "λίτρα" ‎(lítra, “a Sicilian coin, a measure of weight”). Perhaps wine was measured according to weight, and not to volume? – Gamow Mar 18 at 18:09

Shkeil got all of the nontrivial answers, but he forgot the simplest, so I'll add it here:

0 liters of each wine also satisfies the conditions.

For completeness, I'll add the rest of my thought process.

Let $f$ and $r$ be the number of liters of fine and ordinary wine, respectively. Then the problem statement says that \begin{align}8f + 5r = (f+r)^2\end{align} Simple algebra allows us to convert this into a quadratic equation in $f$, \begin{align}f^2 + (2r - 8)f + (r^2 - 5r) = 0\end{align} Applying the quadratic formula and simplifying gives \begin{align}f = 4 - r \pm \sqrt{16 - 3r}\end{align} Starting at $r=0$ and testing each successive integer until the expression under the radical becomes negative, we find the four integer solutions \begin{align} r = 0 &\Rightarrow f = 0 \text{ or } f= 8\\ r = 4 &\Rightarrow f = 2 \\ r = 5 &\Rightarrow f = 0 \end{align}

-
I don't think 0 liters of wine counts. The man bought several after all – Bishop Mar 18 at 17:29
@Bishop That's fair, but it also says several of two kinds of wine, suggesting any solutions with only one kind of wine would also be invalid, which would leave just one solution. I think the trivial solution is just as valid as the $x$ of one, $0$ of another solutions. – Scott M Mar 18 at 17:35
A man bought **several liters**. – user1717828 Mar 18 at 23:23
**of two kinds** – Rolazaro Azeveires Mar 19 at 0:42
No what if he couldn't afford the fine wine and thus bought an imaginary amount of it? – Cephalopod Mar 19 at 13:14

There is

3 solutions and only 3
5 liters of ordinary wine and 0 of fine for 25 drachmas (5²)
4 liters of ordinary wine and 2 of fine for 36 drachmas (6²)
0 liters of ordinary wine and 8 of fine for 64 drachmas (8²)

Reasonning.

First of all, we quickly see obvious limits: only normal wine and only fine wine, for respectively 5 liters and 8 liters.
We have to find about 6 liters and 7 liters. We can use bruteforce, but there is an other way.
Between the price of normal wine and the price of fine wine, we have 3 drachmas. So changing a liter of normal wine to a liter of fine wine cost 3 drachmas.
Lets see for 6 liters for 36 drachmas.
6 liters of normal wine cost 30 drachmas. There is a difference of 6 drachmas, so we will change 2 liters of normal to fine wine. Checking: 4 liters of normal and 2 of fine cost 4*5+2*8 = 20 + 16 = 36

7 liters now, for 49 drachmas.
7 liters of normal wine cost 35 drachmas. There is a difference of 14 drachmas. 14 isn't divisible by 3, so there is no solution for 7 liters.

-
Too add, see wolframalpha.com/input/?i=plot+(x%2By)%5E2+-+8x+-+5y+%3D+0, which shows the graph of all possible solutions. – Aggie Kidd Mar 18 at 16:43
@AggieKidd: The one thing there is that it's non-obvious where the integer solutions are. With gridlines it's more obvious that 2 and 4 are a solution (e.g. paste (x+y)^2-8x-5y=0 into desmos.com/calculator). – Mark Peters Mar 18 at 21:02

Same answer as Shkeil shown in a different way.

Let $x$ be the number of litres of fine wine purchased and $y$ the number of litres of ordinary wine. The problem asks that we find all solutions to
$8x + 5y = (x+y)^2$
$\Rightarrow x^2 + y^2 +2xy - 8x - 5y = 0$
$\Rightarrow (x+y-4)^2 = 16-3y$
The left hand side of this equation is non-negative so for the right hand side to be non-negative, we require $y<6$. Then there are three solutions such that the right hand side is a square $y=0, y=4, y=5$
$y=0 \Rightarrow x-4 = \pm 4 \Rightarrow x = 0$ or $8$
$y=4 \Rightarrow x = 2$
$y=5 \Rightarrow x = 0$.
It depends on your definition of several as to whether solutions with two zeroes are allowed.

-

$(x+y)^2=8x+5y$

is the equation of our problem and we just need to find positive integer for $x$ and $y$.

Let's plot implicitly this equation as below by using Wolfram Alpha;

So $x$ and $y$ should be in the region where $x$ and $y$ are positive and since it is given;

A man bought several liters of two kinds of wines...

$x$ and $y$ are supposed to be greater than $0$.

We know that from the parabola graph above $x$ and $y$ values should be inbetween as below;

$0<x<8$ and $0<y<5$

So $x$ values can be $1$,$2$,$3$,$4$,$5$,$6$,$7$ and $y$ values can be $1,2,3,4$ and since the amount of y values are less, I will use y in the calculation below;

$y=1$ then $x=3+ \sqrt13$

$y=2$ then $x=2+ \sqrt10$

$y=3$ then $x=1+ \sqrt7$

$y=4$ then $x=2$

As a result; there is only one solution for this problem which is;

2 liters of fine wine and 4 liters of ordinary wine!

-

$x=0, y=5$ or $x=8, y=0$ ($x$ being the volume of the fine wine and $y$ that of the ordinary one)

The remaining one:

$8x+5y=(x+y)^2 -> 3x=(x+y)(x+y-5)$, so $x+y$ can equal either $3x/2$ or $3x$ itself. The former is impossible because then $x+y=7$, which isn't divisible by 3. For the latter to be true, $x+y=6$, which means $x=2, y=4$.

-
Is not x=0,y=0 also another trivial answer? – chux Mar 19 at 22:20

## protected by Community♦Mar 18 at 18:43

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?