owen made 100 sandwiches which she sold for exactly $100. She sold caviar sandwiches for $5.00 each, the bologna sandwiches for $2.00, and the liverwurst sandwiches for 10 cents. How many of each type of sandwich did she make?
owen made 100 sandwiches which she sold for exactly $100.
She sold caviar sandwiches for $5.00
each,
the bologna sandwiches for $2.00, and the liverwurst sandwiches for 10 cents.
How many of each type of sandwich did she make?
5C+2B+0.10L=100 => 50C+20B+L=1000 (1)
C+B+L=100 (2)
These are simultaneous equations and nomally they could not be done because there are 3 unknows so you need 3 equations. This is a little different because C, B and L must be whole numbers.
This means that this is a LINEAR DIOPHANTINE EQUATION.
(1)-(2) = 49C+19B=900
Maybe you can solve this with trial and error???
To solve it properly I will have to do some serious homework. (Which given enough time I will do)
I did find this site http://www.math.uwaterloo.ca/~snburris/htdocs/linear.html
Trouble is at a glance I couldn't interpret the output. It does give a worked solution of sorts though.
I wonder if the site calc can solve this??
No doubt one of our very clever answerers will do it before i get a chance.
Note that L must be a multiple of 10 to avoid having a fraction of a sandwich! (Hint: try L = 70).
Thanks Alan,
Yes L has to be a multiple of 10 but I don't know about his part of a sandwich bit.
--------------------------------
The reason Liverworst has to be a multiple of 10 is this.
cavier sandwiches are $5 and Bolgna sandwiches are $2. No matter how many of the these sandwiches you buy it is going ot cost a whole number of dollars.
Altogether the sandwiches cost $100 therefore the liverworst sandwiches must cost a whole number of dollars as well. Since they are 10cents each there must be a multiple of 10 of them.
--------------------------------
Now, there are 100 sandwiches costing $100 altogether so it stands to reason there will be a lot more of the cheap liverworst ones.
I'm going to do it by emimination.
-------------------------------------------
##Say there are 90 liverworst costing $9 then there can be only 10 more sandwiches. the maximum cost of 10 sandwiches is 10*$5=$50 and that is not enough - they need to cost $100-9=$91
##Say there are 80 liverworst costing $8 then there can be only 20 more sandwiches. the maximum cost of 20 sandwiches is 20*$5=$100 umm lets look more.
Can C+B=20 ==> 2C+2B=40 (1) and 5C+2B=92? (2)
(2)-(1) 3C=52 52 is not a multiple of 3 so this doesn't work - C must be a whole number.
----------------------------------------
##Say there are 70 liverworst costing $7 then there can be only 30 more sandwiches. Lets look at the equations.
Can C+B=30 ==> 2C+2B=60 (1) and 5C+2B=93? (2)
(2)-(1) 3C=33 33 is a multiple of 3 so this looks promising 33/3=11cavier sandwiches.
If this is right then there are 70liverworst, 11 cavier, and 19 bologna sandwiches.
70+11+19=100 so far so good!
5C+2B+0.1L=55+38+7=100 great.
There is the answer! 70liverworst, 11 cavier, and 19 bologna sandwiches.
I didn't check if it is the only answer but I expect that it is. It is an answer that fits the data anyway!
I just read reinout's note. I did Bertie's money problem. Now i am slightly more impressed.
Even though i did just use trial and error!.
All right, so here's my solution to the problem.
We apply the euclidean algorithm (I'll show you later why)
First we see how many times 19 fits into 49 and we add the remainder
Then we check how many times the remainder fits into 19 and write down a new remainder
Now we check how many times the new remainder fits into the old remainder and we keep on doing this until we have no remainder left.
49 = 19*2+11
19 = 11*1+8
11 = 8*1 + 3
8 = 3*2 + 2
3 = 2*1 + 1
2 = 1*2 + 0
Now we write the one-but-last equation into 1 = 3-2*1
Given the equation above this we can also write 1 = 3-1*(8-3*2).
This gives 1 = 3*3-8
Then again since we know 3 = 11-8*1 from the above equation
This can be rewritten as 1 = 3*(11-8*1)-8 = 3*11-4*8
Basically we keep writing the smallest number as the difference between two larger numbers following the upper equation until we have a difference of a*49-b*19 = 1
Let me put all the steps underneath each other to make it easier to see
1 = 3-1*2
1 = 3-1*(8-3*2)
1 = 3*3-8
1 = 3*(11-8)-8
1 = 3*11-8*4
1 = 3*11-(19-11*1)*4
1 = 3*11+4*11-19*4
1 = 7*11-19*4
1 = 7*(49-19*2)-19*4
1 = 7*49-19*14-19*4
1 = 7*49-18*19
if
1 = 7*49-18*19
then
900 = 900*7*49-900*18*19
so
900 = 6300*49-16200*19
Now if we substact 19 from 6300 and 49 from 16200 the equation stays the same.
For example
900 = (6300-19)*49-(16200-49)*19
900 = 6281*49-16151*19
We want to substract 49 just 'enough' times to make it negative (so that the equation becomes an addition)
16200/49 = 330.6
So we are going to do it 331 times
then we have
900 = (6300-19*331)-(16200-49*331)*19
900 = 11*49--19*19
900 = 11*49+19*19
Now if we get back to the equation
11+19+L = 100
L = 70
Let's check that in the first equation
50*11+20*19+70 = 1000
So, she sold 11 caviar sandwiches, 19 bologna sandwiches and 70 liverwurst sandwiches
((C,B,L) = (11,19,70))
Reinout
p.s. it is the only answer
the closest integer answers are
C = 11-19 = -8, B = 19+49 = 68 and L = 100-68+8 = 40
50*-8+20*68+40 = 1000 but C<0
and
C = 11+19 = 30, B = 19-49 = -30 and L = 100-30+30 = 100
50*30+20*-30+100 = 1000 but B<0
The answer is C=11, B=19 and L=70
(1)−(2):19B+49C=900
19B+49C=900
49C=900 mod 19
49C-2*19C=(900-47*19) mod 19
49C-38C=11C=7 mod 19
11C+19z=7
19z=7 mod 11
19z-1*11z=(7-0*11) mod 11
8z=7 mod 11
8z+11u=7
11u=7 mod 8
11u - 1*8u=(7-0*8) mod 8
3u=7 mod 8
3u+8v=7
8v=7 mod 3
8v-2*3v=(7-2*3) mod 3
2v=1 mod 3
2v+3w=1
3w=1 mod 2
3w - 1*2w=(1-0*2) mod 2
w=1mod2
back:
w=1-2g g is a integer
v:
2v+3w=1
2v+3(1-2g)=1
-> v=-1+3g
u:
3u+8v=7
3u+8(-1+3g)=7
-> u=5-8g
z:
8z+11u=7
8z+11(5-8g)=7
-> z=-6+11g
C:
11C+19z=7
11C+19(-6+11g)=7
-> C=11-19g
B:
19B+49C=900
19B+49(11-19g)=900
-> B=19+49g
L:
C+B+L=100
L=100-C-B
L=100-(11-19g)-(19+49g)
L=100-11+19g-19-49g
L=70-30g
The result is:
C=11−19gB=19+49gL=70−30g
C can't be negative so g must be 0:
g=0
C=11-19*0=11
B=19+49*0 =19
L=70-30*0 =70
C=11B=19L=70
11*$5.00 + 19*$2.00 + 70*$0.10 = $55+$38+$7=$100
11+19+70=100