-2

A farmer purchased $100$ head of livestock for a total cost of $\$4000$. Prices were as follow: calves $\$120$ each, lambs $\$50$ each, piglets $\$25$ each. If the farmer obtained at least one animal of each type, how many did he buy?

total number of livestock$=100$,

number of calves$=x$,

number of lambs$=y$,

number of piglets$=z$,

cost of a calf$-120$,

cost of a lamb$-50$,

cost of a piglet$-25$

equations: 1) $x+y+z=100$
2) $120x+50y+25z=4000$
$24x+10y+5z=800$

$24x+10y+5(100-x-y)=800$
$19x+5y=300$

What do I do from here to find the solution? I don't know mods yet..

Bill Dubuque
  • 282,220
Lil
  • 2,631
  • The correct equations are $c + l + p = 100$ and $120c + 50l + 25p = 4000$. – Jack M Mar 03 '14 at 01:08
  • ok, makes sense. Do I solve them separately or find a way to combine the two equations? Sorry I'm very new to this – Lil Mar 03 '14 at 01:11
  • also how do I solve the equations with 3 variables. Do I still try to find the gcd between 120, 50, 25 and 4000? – Lil Mar 03 '14 at 01:14
  • You'll necessarily have to solve them both simultaneously, otherwise you're dropping critical information from the problem. – Jack M Mar 03 '14 at 01:14
  • ok, how do I combine the two equations to solve them simultaneously? – Lil Mar 03 '14 at 01:15
  • Truth is, the only way you're going to be able to solve this with the information given is guess and check. You're either missing an equation, since 3 variables have to have 3 equations to solve for, or someone really wants you to waste time on this. :p – Josh Tullos Mar 03 '14 at 04:21
  • @JoshTullos 3 variables in 2 equations is indeterminate when you allow all real values, but the restriction to integers allows you to solve the problem uniquely. – Jack M Mar 03 '14 at 09:02

2 Answers2

2

The answer - I believe it's unique, but it's very late and I'm tired - is $15$ cows, $3$ lambs, and $82$ piglets.

This was my approach.

First, you have a system of two linear equations. The usual thing to do is to try to eliminate some of the variables. Multiply the first equation by $120$ to get $120c+120l+120p=12000$, and subtract the other equation from that to eliminate $c$, leaving $70l+95p=8000$. Dividing by the GCD, we get $14l+19p=1600$, and now we can set up a linear relation between $p$ and $l$:

$$p=\frac{1600-14l}{19}$$

I chose to divide by $19$ and not $14$ because $19$ happens to be prime. This is a good thing because we're now going to work modulo $19$ to determine when the right hand side is an integer. We want $1600-14l\equiv0\mod19$, and since $19$ is prime we get to do division, and find that the only possibility is $l\equiv3$. So:

$$l=19k + 3$$

And, applying the previous relation for $p$ and simplifying:

$$p=14k+82$$

Great, we've expressed $l$ and $p$ in terms of one variable $k$ - we now have a system of two equations in two variables. Plug what we've found back into the original two equations and we get:

$$\begin{align} 33k+85+c&=100\\ 1300k+2200+120c&=4000 \end{align}$$

From which we deduce the solution I gave above.

Jack M
  • 28,518
  • 7
  • 71
  • 136
  • 25 cows at 120 = 3000. 3 lambs at 50 = 150. 82 piglets at 25 = 2050. 3000 + 150 + 2050 = 5200. Something wrong with your math there. – Josh Tullos Mar 03 '14 at 02:32
  • Also, can't believe I missed this... but 25+3+82? You're at 110 animals, not 100 animals... You must have been really tired... – Josh Tullos Mar 03 '14 at 07:10
  • @JoshTullos Not quite an error in the math, just made a mistake when typing up my notes. It's actually $15$ cows, not $25$. Thanks! – Jack M Mar 03 '14 at 08:59
  • It's not unique - you missed some solutions - see the other answer. $\ \ $ – Bill Dubuque Mar 17 '25 at 13:40
1

$$x+y+z=100 \tag{1}$$ $$120x + 50y + 25z = 4000 \tag{2}$$

We see that $z$ must be even in order for the sum to be even. We also see that $x<34$, otherwise $120x > 4000$ which is not desirable.

Now substitute $z = 100 - ( x+y)$.

$$120x + 50y + 25(100-x-y) = 4000 $$ $$95x + 25y = 1500$$

Now, divide by 5 $$19x + 5y = 300$$

Then $5 \mid x$ is necessary. We also have $x < 300/19 \implies x \le 15$.

Then $x$ may be $5,10,15$.

If $x=5$, $5y = 205 \implies y = 41$. So $(x,y,z) = (5,41,54)$ is one solution.

If $x=10$, $5y = 110 \implies y=22$. So $(x,y,z) = (10,22,68)$ is another solution.

If $x=15$ $5y = 15 \implies y=3$ So $(x,y,z) = (15,3,82)$ is the last solution.

These are all the solutions possible.

  • 1
    By general linear theory, we obtain all solutions of $19x+5y = 300$ simply by adding to any particular solution the general solution of its homogenous form $,19x+5y=0\iff (x,y) = (5,-19)n.,$ So starting with your particular solution $,(5,41),$ subtracting $(5,-19)$ won't work since then $x\le 0,,$ but adding we get two more solutions: $(5,41)+(5,-19) = (10,22),, $ to which we can add once more to get $(15,3),,$ but adding any further makes $y<0$. See here for a geometric viewpoint. – Bill Dubuque Mar 17 '25 at 14:01