If exactly $245 is to be spent on ordering Pony 11-inch softballs, costing $2.75 each, and Junior 12-inch softballs, costing $3.25 each, how many softballs in total are to be ordered to minimize the difference between the numbers of each type of softball? (Note: the answer is NOT 80 softballs!)
Let P be the number of Pony 11-inch softballs @ $2.75 each
Let J be the number of Junior 12-inch softballs @ $3.25 each
Then our single Diophantine equation is:
2.75P + 3.25J = 245, i.e.
275P + 325J = 24500, which simplifies to
11P + 13J = 980
Now,
13 = 1x11 + 2
11 = 5x2 + 1
Rearranging the above equations, in reverse,
1 = 1x11 – 5x2
1 = 1x11 – 5(13 – 1x11)
1 = 6x11 – 5x13 now multiply by 980, giving
980 = 5880x11 – 4900x13
Equating the above to 980 = 11P + 13J gives us one solution, viz.
P = 5880
J = -4900
The general solution is,
P = 5880 – 13t
J = -4900 + 11t,
where the 13t and 11t use the coefficients of J and P, respectively, from the original Diophantine equation.
Both P and J must be positive values. Setting t = 446 gives us,
P = 82 – 13t
J = 6 + 11t,
and 0 <= t <= 6.
Let Δ = |P – J|
Δ = |82 – 13t – 6 – 11t|
Δ = |76 – 24t|
By observation we see that Δ is a minimum for t = 3. (Δ = |76 – 72| = 4)
At t = 3
P = 82 – 39 = 43
J = 6 + 33 = 39
P + J = 82
Answer: 82 softballs in total were ordered. 43 @ Pony 11-inch, and 39 @ Junior 12-inch softballs