Math Problem: You have 2 pipes...

Page 4 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

chuckywang

Lifer
Jan 12, 2004
20,133
1
0
I cannot believe this thread has over 60 responses. IT'S A FREAKIN' TWO VARIABLE EQUATION!!!!

You have one equation and two variables. You know the two variables must be positive integers, so you don't have an infinite number of answers. Now, from these two pieces of information, you have to determine which set of integers works for the given equation. Hard? Don't think so.
 

DrPizza

Administrator Elite Member Goat Whisperer
Mar 5, 2001
49,601
167
111
www.slatebrookfarm.com
Originally posted by: VanillaH
The problem assumes you WILL get 212 meters by combining 3.9m pipes and 5.9 pipes. 212 meters can be factored out to be 212*4. To remove the decimal part, you need a multiple of ten for the combined number of two types of pipes (i.e., the answer is 12+28=40=4*10). For the problem to be solvable, you are guaranteed to come up with a combination of 3.9A and 5.9B that equals 53. the ratio comes out to be 3:7. multiply both by 4 and you get 12 and 28.

edit : 666 views on the thread :eek:

All fine and dandy, but explain where you came up with the ratio 3:7?
Sure, 3A + 7B = 53. But, how did you go about getting this?

Here's another solvable one with those same two lengths 3.9 meters and 5.9 meters.
Come up with 311 meters. Try to do it without brute force. :)
 

JustAnAverageGuy

Diamond Member
Aug 1, 2003
9,057
0
76
Originally posted by: chuckywang
I cannot believe this thread has over 60 responses. IT'S A FREAKIN' TWO VARIABLE EQUATION!!!!

You have one equation and two variables. You know the two variables must be positive integers, so you don't have an infinite number of answers. Now, from these two pieces of information, you have to determine which set of integers works for the given equation. Hard? Don't think so.

Ok solve this one if you're soooo good at it.

You need to make a pipe of a length of 140 meters.

You are given pipes of lenths 2.8m and 1.3m. Assume is takes no length to put the pipes together.

How many pipes of each type do you need?

Solve.

















Tired yet?

37(2.8) * 28(1.3) = 140

Other solutions may exist because I just made this one up off the top of my head
 

Philippine Mango

Diamond Member
Oct 29, 2004
5,594
0
0
OMG guys this is seriously algebra..... Since I keep all my school papers from the years I will look it up... I remember this type of problem vaguely and remember that I had trouble learning it! Which could explain why all you guys are having the same problem! I'll check back with a mathimatical way of doing it!
 

konakona

Diamond Member
May 6, 2004
6,285
1
0
well i guess without the use of 1st order Diophantine equations you speak of, it might be impossible without some degree of brute force.
edit : nevermind, 311 is a valid number.
 
Jan 31, 2002
40,819
2
0
Originally posted by: DrPizza
Originally posted by: VanillaH
The problem assumes you WILL get 212 meters by combining 3.9m pipes and 5.9 pipes. 212 meters can be factored out to be 212*4. To remove the decimal part, you need a multiple of ten for the combined number of two types of pipes (i.e., the answer is 12+28=40=4*10). For the problem to be solvable, you are guaranteed to come up with a combination of 3.9A and 5.9B that equals 53. the ratio comes out to be 3:7. multiply both by 4 and you get 12 and 28.

edit : 666 views on the thread :eek:

All fine and dandy, but explain where you came up with the ratio 3:7?
Sure, 3A + 7B = 53. But, how did you go about getting this?

Here's another solvable one with those same two lengths 3.9 meters and 5.9 meters.
Come up with 311 meters. Try to do it without brute force. :)

51 and 19.

- M4H
 
Jan 31, 2002
40,819
2
0
Originally posted by: JustAnAverageGuy
Originally posted by: chuckywang
I cannot believe this thread has over 60 responses. IT'S A FREAKIN' TWO VARIABLE EQUATION!!!!

You have one equation and two variables. You know the two variables must be positive integers, so you don't have an infinite number of answers. Now, from these two pieces of information, you have to determine which set of integers works for the given equation. Hard? Don't think so.

Ok solve this one if you're soooo good at it.

You need to make a pipe of a length of 140 meters.

You are given pipes of lenths 2.8m and 1.3m. Assume is takes no length to put the pipes together.

How many pipes of each type do you need?

Solve.

50 of the 2.8m pipes. :p

- M4H
 

Philippine Mango

Diamond Member
Oct 29, 2004
5,594
0
0
This is off the top of my head but try making one of the variables =0, do the problem and when you figure out 1 variable you then plug it in and try to find the answer. I dont have papier so im SOL!
 
Jan 31, 2002
40,819
2
0
Originally posted by: Philippine Mango
This is off the top of my head but try making one of the variables =0, do the problem and when you figure out 1 variable you then plug it in and try to find the answer. I dont have papier so im SOL!

Heh. You're a little late to the party no0b - it's been solved multiple times through various methods. ;)

- M4H
 

Philippine Mango

Diamond Member
Oct 29, 2004
5,594
0
0
yes but they were all brute force methods which I don't believe are correct. Technically all problems can be solved by brute force.
 

jman19

Lifer
Nov 3, 2000
11,225
664
126
Originally posted by: Philippine Mango
yes but they were all brute force methods which I don't believe are correct. Technically all problems can be solved by brute force.

Agreed. If a problem doesn't have to be brute forced, then it shouldn't be. Unless, of course, time is a factor and it can be solved a lot faster than through a BF method...
 

konakona

Diamond Member
May 6, 2004
6,285
1
0
Originally posted by: DrPizza
Originally posted by: VanillaH
The problem assumes you WILL get 212 meters by combining 3.9m pipes and 5.9 pipes. 212 meters can be factored out to be 212*4. To remove the decimal part, you need a multiple of ten for the combined number of two types of pipes (i.e., the answer is 12+28=40=4*10). For the problem to be solvable, you are guaranteed to come up with a combination of 3.9A and 5.9B that equals 53. the ratio comes out to be 3:7. multiply both by 4 and you get 12 and 28.

edit : 666 views on the thread :eek:

All fine and dandy, but explain where you came up with the ratio 3:7?
Sure, 3A + 7B = 53. But, how did you go about getting this?

Here's another solvable one with those same two lengths 3.9 meters and 5.9 meters.
Come up with 311 meters. Try to do it without brute force. :)

i was going to mention what i did above was a narrowed down form of brute force apporach. i honestly dont see how it could be solved without the use of brute force, assuming graphing is also a way of using brute force called calculator.
 

jman19

Lifer
Nov 3, 2000
11,225
664
126
Originally posted by: VanillaH
Originally posted by: DrPizza
Originally posted by: VanillaH
The problem assumes you WILL get 212 meters by combining 3.9m pipes and 5.9 pipes. 212 meters can be factored out to be 212*4. To remove the decimal part, you need a multiple of ten for the combined number of two types of pipes (i.e., the answer is 12+28=40=4*10). For the problem to be solvable, you are guaranteed to come up with a combination of 3.9A and 5.9B that equals 53. the ratio comes out to be 3:7. multiply both by 4 and you get 12 and 28.

edit : 666 views on the thread :eek:

All fine and dandy, but explain where you came up with the ratio 3:7?
Sure, 3A + 7B = 53. But, how did you go about getting this?

Here's another solvable one with those same two lengths 3.9 meters and 5.9 meters.
Come up with 311 meters. Try to do it without brute force. :)

i was going to mention what i did above was a narrowed down form of brute force apporach. i honestly dont see how it could be solved without the use of brute force, assuming graphing is also a way of using brute force called calculator.

Yes, I'd consider graphing to be a form of brute force; it's just an enumeration of all of the points that solve the equation.

Anyway, it is possible to solve this without using brute force... if you look upwards, you'll see that one or two people realized that the equation is a diophantine equation, for which there is an algorithm to solve. I personally am not a big fan of brute forcing it... then again, I did take a lot of math theory courses in college, which might be why :p

Oh, and to everyone who found this question to be very easy, well, the principal behind it really isn't that simple, even though it can be solved through inspection with ease.
 

Daishiki

Golden Member
Nov 9, 2001
1,943
36
91
Originally posted by: Toastedlightly
make one equation:

let pipe a = X

pipe b = (212-x)

3.9x + 5.9(212-x) = 212

people tried that earlier up there. saying that b = (212-x) is saying that x + b = 212, or that there are 212 pipes. x and b != length. if you want the relationship between a and b in terms of length, it's the last equation you wrote.
 

Daishiki

Golden Member
Nov 9, 2001
1,943
36
91
Originally posted by: Chaotic42
Originally posted by: Toastedlightly
make one equation:

let pipe a = X

pipe b = (212-x)

3.9x + 5.9(212-x) = 212


If a=x then b =(212-3.9x)/5.9.

which results in both sides cancelling out because the substitution was derived from the same equation. the point is a second equation involving a and b are needed to solve a 2-variable equation with system of equations unless you decide to go with the algorithm. since the second equation is explicitly given, it has to be derived another way.
 

piroroadkill

Senior member
Sep 27, 2004
731
0
0
M4H's solution may be fairly elegant, but there's a better solution to this class of problem.

3.9A + 5.9B = 212
---------------------

The first thing to do is write down the other implied equations.

A >= 0
B >= 0

Then you need to find a simple linear combination of the pipe lengths that gives a whole number (preferably one that is a factor of 212). In this case the person setting the question is kind, there's an easy linear combination:

5.9 - 3.9 = 2 (1)

Now we should really use some discrete maths, or a modified version of Pascal's theorem, or something like that to solve it. But I can't be bothered with that for such a simple question and I want a proof that people can understand. We use a bastardised induction theorem and invariants.

Look at the equation marked (1). If we take any combination of pipes that gives an even number, and add or subtract the left-hand side (LHS) of (1) enough times, we *have* to be able to get 212. We could generate any number of answers now, but we'll need to be clever to avoid negative values of A or B.

What we will do is take one of the lengths of pipe, and find a number to multiply it with that gives an *even* number that's close to 212.

I happen to want one that's higher than 212, so I'll need to use 5.9 length pipes to do it. Why? Because if I am above 212, I need to subtract the LHS of (1), and that will give me a negative number of 5.9 length pipes straight away if I had started with a number of 3.9 pipes and 0 of the 5.9 pipes. If I start with 5.9 pipes and a starting total above 212, the only way I can get a negative number of pipes after repeated subtractions of the LHS of (1) is if there are no solutions to the problem at all.

212 / 5.9 = 35.9322033898......
The nearest number above this that will give a whole answer is obviously 40. So:

40 * 5.9 = 236

And how far above are we?

236 - 212 = 24

So we need to apply equation (1) 12 times to get the right answer. But we won't bother doing this, since we now have the answer. Applying the equation twelve times will give 12 pipes of length 3.9 and 28 (40 minus 12) pipes of length 5.9, which is the answer. Yay.

The technique really works; try it with other values that aren't 212 (but keep the values above 78 if you want there to be a (guaranteed I think?) solution :)

Also try different pipe length values if you dare, as long as you can reliably find a simple-ish linear combination of the two pipe lengths similar to equation (1), the technique should work.


EDIT: This post is by ferret, on piro's computer.
 
Jan 31, 2002
40,819
2
0
Originally posted by: piroroadkill
M4H's solution may be fairly elegant, but there's a better solution to this class of problem.

3.9A + 5.9B = 212
---------------------

The first thing to do is write down the other implied equations.

A >= 0
B >= 0

Then you need to find a simple linear combination of the pipe lengths that gives a whole number (preferably one that is a factor of 212). In this case the person setting the question is kind, there's an easy linear combination:

5.9 - 3.9 = 2 (1)

Now we should really use some discrete maths, or a modified version of Pascal's theorem, or something like that to solve it. But I can't be bothered with that for such a simple question and I want a proof that people can understand. We use a bastardised induction theorem and invariants.

Look at the equation marked (1). If we take any combination of pipes that gives an even number, and add or subtract the left-hand side (LHS) of (1) enough times, we *have* to be able to get 212. We could generate any number of answers now, but we'll need to be clever to avoid negative values of A or B.

What we will do is take one of the lengths of pipe, and find a number to multiply it with that gives an *even* number that's close to 212.

I happen to want one that's higher than 212, so I'll need to use 5.9 length pipes to do it. Why? Because if I am above 212, I need to subtract the LHS of (1), and that will give me a negative number of 5.9 length pipes straight away if I had started with a number of 3.9 pipes and 0 of the 5.9 pipes. If I start with 5.9 pipes and a starting total above 212, the only way I can get a negative number of pipes after repeated subtractions of the LHS of (1) is if there are no solutions to the problem at all.

212 / 5.9 = 35.9322033898......
The nearest number above this that will give a whole answer is obviously 40. So:

40 * 5.9 = 236

And how far above are we?

236 - 212 = 24

So we need to apply equation (1) 12 times to get the right answer. But we won't bother doing this, since we now have the answer. Applying the equation twelve times will give 12 pipes of length 3.9 and 28 (40 minus 12) pipes of length 5.9, which is the answer. Yay.

The technique really works; try it with other values that aren't 212 (but keep the values above 78 if you want there to be a (guaranteed I think?) solution :)

Also try different pipe length values if you dare, as long as you can reliably find a simple-ish linear combination of the two pipe lengths similar to equation (1), the technique should work.

Um ... that's exactly what I did, dude. :p

- M4H
 

cchen

Diamond Member
Oct 12, 1999
6,062
0
76
looking at this problem now another way to solve it could be linear programming, specifically integer programming (something easy like branch and bound)

thought i don't think this kind of problem is meant to be solved using linear programming
 

piroroadkill

Senior member
Sep 27, 2004
731
0
0
It's similar, but more elegant and hopefully more robust as a proof, and hopefully easier to transfer to other problems of the same class.

Anyhow, your invariant/variant equations were silly, since there's the obvious one that works better :p
 

jman19

Lifer
Nov 3, 2000
11,225
664
126
Originally posted by: Howard
We need MadRat to come in here and wax philosophical on the meaning of a pipe. :)

OMG, please, GOD, do not let MadRat come into another math related thread. He crapped all over the .999 = 1 thread with his "belief" about what infinity is :roll: