Solve for three variables with only two variables?

  • Thread starter Shay10825
  • Start date
  • Tags
Solve for three variables with only two variables??In summary, you can solve for three variables with only two equations if you use Euclid's algorithm.
  • #1
Solve for three variables with only two variables??

Hi everyone :smile: .
There are 100 people and 100 bushels of grain. Men get 3 bushels, women get 2 bushels, and children get .5 bushels. How many men, women, and children are there and how many bushels do they each get. Find all possible solutions.

I found 2 solutions:

74 children 37 bushels
15 women 30 bushels
11 men 33 bushels


80 children 40 bushels
0 women 30 bushels
20 men 60 bushels

How can I find other solutions? I came up with two equations:

3m + 2w + .5c = 100
m + w + c = 100

but how do I solve for three variables with only two equations? Any help would be appreciated.

Physics news on
  • #2
How did you find your two solutions? Theres a typo in your second one.

You won't be able to solve for all 3 variables with only 2 equations.
  • #3
Well, a linear system, rank of the reduced associated matrix is 2 and so is that of the complete one.

2 eq. 3 variables, rank1 = rank2, then [tex]\exists \infty^1[/tex] solutions

bring the terms in c (or one of the other, it's the same) to the second member and solve the system in m and w.


Of course you have still to select those among the solutions, which let people integer, but it is not difficult.
Last edited:
  • #4
Substitute for c from the 2nd eqn into the 1st eqn. You will end up with,

5m + 3w = 100

The solution to this eqn is in integers, since you can't have fractions of people!

This type of eqn is known as a linear diphantine eqn and can be solved in a staightforward fashion for integer solutions.

see attachment.


  • Linear diophantine eqns.doc
    12.5 KB · Views: 263
Last edited:
  • #5
I have no clue how to do anything you all are talking about. Is there some way you can do it with a system of equations and guessing?
  • #6
I think there are algorithmes to solve these kind of Dioph. Eq. but they're probably not that easy.

I'd start off as if all solutions was allowed, and solve it as a typical system of 2 eq in 3 variables. This is your system:

[tex]\left\{ \begin{array}{l}
m + w + c = 100 \\
3m + 2w + 0.5c = 100 \\
\end{array} \right.[/tex]

Now, as said before, 2 lineairly independant eq with 3 unknowns has infinite solutions. You can choose one variable and solve the system for the other two in function of the last. I'd choose children, you'll see later why. Solving then gives, I assume you know how:

[tex]m = \frac{{3c - 200}}{2} \wedge w = \frac{{5\left( {80 - c} \right)}}{2}[/tex]

Now, you can easily find boundaries for c. In order for the m to stay positive, the numerator has to be positive. This means that c (because it has to be a natural number) has to be: [itex]c \ge 200/3 \Rightarrow c > 66[/itex].
In order for w to stay positive, we have that [itex]c \le 80[/itex].
Together we have: [itex]66 < c \le 80[/itex]

Finally, because for both m and w we divide by 2 (which is why I choose variable c) so both numerators have to be even in order to get integer solutions. We're lucky here, in this case that means that c has to be even. Now you only have to go down the row, every c starting from 68 until 80, only the even values, give a solution :smile:
  • #7
Oh my gosh! Thank you so much! I have been trying to figure this problem out for 2 days and I have asked a billion people and they have all given me a really big complex answer. Thanks :smile:
  • #8
Well perhaps there are methods of doing this algebraically but for rather 'simple problems', this is a lot faster. Of course, it doesn't always work but it turned out pretty easy here. Glad it's a help!
  • #9
Yes, this can be done reasonably simply by just taking starting with small values of m or w and seeing what c must be. Here, however, is a specific method for solving Diophantine equations mentioned.

Your two equations are:
[tex]\left\{ \begin{array}{l} m + w + c = 100 \\ 3m + 2w + 0.5c = 100 \\ \end{array} \right.[/tex]

From the first equation c= 100- m- w so the second equation is the equivalent to
3m+ 2w+ 0.5(100- m- w)= 2.5m+ 1.5w+ 50= 100 or 2.5m+ 1.5w= 50. We can keep this in integers by multiplying by 2: 5m+ 3w= 100. That's the equation Fermat gave.

Now we use Euclid's algorithm to find integer values of m and w such that 5m+ 3w= 1. 3 divides into 5 once with remainder 2: 5(1)- 3(1)= 2. 2 divides into 3 once with remainder 1: 3(1)- 2(1)= 1 so 3(1)- (5(1)-3(1))(1)= 1 or 3(2)+ 5(-1)= 1 (that's kind of obvious isn't it!).
Now multiply that equation by 100: 3(200)+ 5(-100)= 100. One possible solution to the equation 5m+ 3w= 100 is m= -100, w= 200. Of course, there are an infinite number of solutions even restricting to integers. If we take m= -100+ 3k, w= 200- 5k (the "3" and "5" are, of course, from the equation) then 5m+ 3w= -500+ 15k+ 600- 15k= 100 since the terms involving k cancel so m= -100+3k, w= 200-5k are integer solutions for all integer k (in fact, it can be shown that you get all integer solutions this way).

Here, not only do m, w, and c have to be integers, they have to be non-negative integers. In order that m be positive k must be at least 34 (100/3= 3.333... and 34 is the first integer larger than that). In order that w be non-negative, k can't be larger than 40. All non-negative integer solutions are:

k m= -100+ 3k w= 200- 5k c= 100- m- w
34 m= 2 w= 30 c= 68
35 m= 5 w= 25 c= 70
36 m= 8 w= 20 c= 72
37 m= 11 w= 15 c= 74
38 m= 14 w= 10 c= 76
39 m= 17 w= 5 c= 78
40 m= 20 w= 0 c= 80

Those are all positive integer solutions.
Last edited by a moderator:

Suggested for: Solve for three variables with only two variables?