Ooooooooooo, good problem! I think I can explain the formal way to solve it and other more general problems like this.
As has been noted by some above, there is no way to write down three equations and solve using algebra.
You can get 2 equations of three variables and reduce them to 1 equation of two variables however.
This one equation of two variable whose solutions are integers is known as the linear diophantine equation, and is a fun thing that you learn about in number theory. There are nifty algorithms for solving in terms of integers, but I wont explain these.
The way I solve is like this lettting #cows = a, #pigs = b, and #chickens = c:
a + b + c = 100 --> c = 100 - a - b
10a + 3b + c/2 = 100 --> 20a + 6b + c = 200
combine to get:
19a + 5b = 100 <-- this is the linear diophantine equation, because we want both a & b to be integers.
A clever trick is to look for a more fundamental solution to
19c + 5d = 1 <-- note that we have reduced the 100 to just 1.
Clearly one solution to this is
c = -1
d = 4
Why does this help us?
because if
19c + 5d = 1 --> 100[19c + 5d] = 100[1]
simplifying tells us that:
19(100c) + 5(100b) = 100
.so a = 100c = -100
and b = 100d = 400
is a solution in the integers! Now we just need the solution to be nonzero which is easy
notice that 19(a+5x) + 5(b-19x) = 100 also, for all values of x, and if x is an integer then our solution is also still an integer.
Then we need:
5x - 100 >= 0 and...
400 - 19x >= 0
solving these inequalities gives:
x >= 20
x <= 400/19 (or 21.05...) and
this means x = 20 or 21 since it must be an integer.
So for x = 20 we get one solution:
a = 0
b = 20
c = 80
and for x = 21 we get the second solution
a = 5
b = 1
c = 94
That is all.
I look back and see that you want positive solutions as opposed to nonegative solutions so you can throw out the x = 20 answer and stick with the second one.
The nice thing about using this method is that it can generate the general form of all solutions a,b,c in the integers without the positive constraint and there is no guesswork needed. Also, it works for arbitrarily large and unwieldy initial parameters.
As has been noted by some above, there is no way to write down three equations and solve using algebra.
You can get 2 equations of three variables and reduce them to 1 equation of two variables however.
This one equation of two variable whose solutions are integers is known as the linear diophantine equation, and is a fun thing that you learn about in number theory. There are nifty algorithms for solving in terms of integers, but I wont explain these.
The way I solve is like this lettting #cows = a, #pigs = b, and #chickens = c:
a + b + c = 100 --> c = 100 - a - b
10a + 3b + c/2 = 100 --> 20a + 6b + c = 200
combine to get:
19a + 5b = 100 <-- this is the linear diophantine equation, because we want both a & b to be integers.
A clever trick is to look for a more fundamental solution to
19c + 5d = 1 <-- note that we have reduced the 100 to just 1.
Clearly one solution to this is
c = -1
d = 4
Why does this help us?
because if
19c + 5d = 1 --> 100[19c + 5d] = 100[1]
simplifying tells us that:
19(100c) + 5(100b) = 100
.so a = 100c = -100
and b = 100d = 400
is a solution in the integers! Now we just need the solution to be nonzero which is easy
notice that 19(a+5x) + 5(b-19x) = 100 also, for all values of x, and if x is an integer then our solution is also still an integer.
Then we need:
5x - 100 >= 0 and...
400 - 19x >= 0
solving these inequalities gives:
x >= 20
x <= 400/19 (or 21.05...) and
this means x = 20 or 21 since it must be an integer.
So for x = 20 we get one solution:
a = 0
b = 20
c = 80
and for x = 21 we get the second solution
a = 5
b = 1
c = 94
That is all.
I look back and see that you want positive solutions as opposed to nonegative solutions so you can throw out the x = 20 answer and stick with the second one.
The nice thing about using this method is that it can generate the general form of all solutions a,b,c in the integers without the positive constraint and there is no guesswork needed. Also, it works for arbitrarily large and unwieldy initial parameters.