How to Use Gaussian Elimination to Solve for Vitamin Pills

In summary: A, you get 8 units of vitamin B, and for every 0 unit of vitamin A, you get 1 unit of vitamin C. However, because there are no pills in brand 3, the coefficient for that brand is 0.
  • #1
sdoug041
26
0

Homework Statement



Your doctor has asked you to take 5 units of vitamin A, 13 units of Vitamin B, and 23 units of vitamin C every day. There are three brands available in your local pharmacy which contain the following units of vitamins:-------- vitamin A vitamin B vitamin C
Brand 1 --- 1 ------ 2 ------ 4
Brand 2 --- 1 ------ 1 ------ 3
Brand 3 --- 0 ------ 1 ------ 1

Find all combinations of pills that provide you with the exact daily requirement (no partial pills!).

Homework Equations



Gaussian algorithm / elimination

The Attempt at a Solution



I transposed to create an augmented matrix in which the required amount of each pills could be implemented in the matrix.

ie

---------------Brand 1--------Brand 2-------Brand 3 ------Total
Vitamin A --------1 --------------1 -----------0 -----------5
Vitamin B --------2 --------------1 -----------1 ---------- 13
Vitamin C ------- 4 --------------3 -----------1 ----------23

I tried to use Gaussian Algorithm to solve for each variable but I keep eliminating all the values in row 3 (ie 0 0 0 0). I do believe this implies infinite solutions, but obviously this cannot be true. Please help!

Thanks,

Steve
 
Physics news on Phys.org
  • #2
Before jumping in and creating an augmented matrix, write the equations that the augmented matrix is supposed to represent. Your equations will involve variables that you need to define.
 
  • #3
You are right! There are an infinite number of solutions to your equations. But only a finite number of those solutions are nonnegative whole numbers.
 
  • #4
Thank you for the replies,

I defined the values as x, y, and z. Is this what you meant Mark44?

Dick, I'm not entirely sure how to manipulate the matrix to solve for the whole number, positive solutions. Could you possibly shed some light on this?

Thanks guys.
 
  • #5
sdoug041 said:
Thank you for the replies,

I defined the values as x, y, and z. Is this what you meant Mark44?

Dick, I'm not entirely sure how to manipulate the matrix to solve for the whole number, positive solutions. Could you possibly shed some light on this?

Thanks guys.

You need to actually solve the equations rather than just row reducing the matrix, as Mark44 suggested. Call b1,b2,b3 the number of pills in each brand and write three equation, solve for say b1 and b2 in terms of b3. Then think about what kind of numbers you can put in for b3.
 
  • #6
Thanks :). I think I got it now.
 
  • #7
Hi, i do not understand this question, can somebody help me start this question please?
 
  • #8
I need to understand this question too.. Can someone please solve it! Cause I tried doing the matrices and I get a negative number for y! Which is not possible!
 
  • #9
askmenow said:
I need to understand this question too.. Can someone please solve it! Cause I tried doing the matrices and I get a negative number for y! Which is not possible!

Show us what you did and how you got a negative number.
 
  • #10
ok.. I did this:

---------------Brand 1--------Brand 2-------Brand 3 ------Total
Vitamin A --------1 --------------1 -----------0 -----------5
Vitamin B --------2 --------------1 -----------1 ---------- 13
Vitamin C ------- 4 --------------3 -----------1 ----------23

and i solved the matrix and ended up getting:

1 0 1 8
0 1 -1 -3
0 0 0 0

which doesn't make since!
 
  • #11
How do you know it doesn't make sense? Call b1, b2, and b3 the number of pills of each brand. What does your matrix tell you about the relation between them?
 
  • #12
do u see the -ive number in b2?
 
  • #13
Ok i did get the solution: B1=8 and b1-b2=-3 and no solutions for b3 because brand three does not exist due to the fact that there are 0 vitamin A in that brand, and therefore not a solution because the doctor recommended brand 5 units of vitamin A.

I was wondering though what does b1-b2=-3 mean, because it is not possible to have a negative solution.
 
  • #14
Oh wait, B1=8 so B2 is 5 if i did substitution for the 2 equations. Please tell me if I am on the right track.
 
  • #15
askmenow said:
do u see the -ive number in b2?

The numbers in your matrix aren't numbers of pills. They are the coefficients of the number of pills. E.g. the 1 0 1 8 line tells you 1*b1+0*b2+1*b3=8. How about the second line? The coefficients can be negative even though the b's can't.
 
  • #16
memomator said:
Oh wait, B1=8 so B2 is 5 if i did substitution for the 2 equations. Please tell me if I am on the right track.

If you would show what you are doing I could tell you what you are doing wrong. If you don't, I can't.
 
  • #17
b1=8
b1-b2=-3
i sub b1 into b1-b2=-3
i get b2 to be 5
So 8 and 5 are the coefficent of the pills?
 
  • #18
memomator said:
b1=8
b1-b2=-3
i sub b1 into b1-b2=-3
i get b2 to be 5
So 8 and 5 are the coefficent of the pills?

No, I meant the first three rows of the matrix are coefficients. Neither one of your starting equations is right. How did you get them?
 
  • #19
i reduced it to row-echelon form and got

1 0 0 8
0 1 -1 -3
0 0 0 0

so the first column is b1 second is b2 thrid is b3
 
  • #20
memomator said:
i reduced it to row-echelon form and got

1 0 0 8
0 1 -1 -3
0 0 0 0

so the first column is b1 second is b2 thrid is b3

Now I have to ask you how you got that. askmenow got:

1 0 1 8
0 1 -1 -3
0 0 0 0

and I think that's right.
 
  • #21
Oh sorry you are right i made a mistake. Ok so the row echelon becomes
1 0 1 8
0 1 -1 -3
0 0 0 0

the equations become
b1+b3=8
b2-b3=-3

what do i do after this I am really confused right now.
 
  • #22
memomator said:
Oh sorry you are right i made a mistake. Ok so the row echelon becomes
1 0 1 8
0 1 -1 -3
0 0 0 0

the equations become
b1+b3=8
b2-b3=-3

what do i do after this I am really confused right now.

Now it's easy. b3 is a nonnegative integer (as are the other b's). Start trying them out. Set b3=0 and solve for the other variables. Does it work? Can b3=1? You should figure which values work pretty quickly.
 
  • #23
Dick said:
Now it's easy. b3 is a nonnegative integer. Start trying them out. Can b3=0? Can b3=1? You should figure which values work pretty quickly.

But we have 3 unkowns in 2 equations :s
 
  • #24
Ok i found out that b3 must be greater or equal to 3. does this mean that there are infinite solutions if b3 is greater or equal to 3? If so does this mean that there are infinite combination to the pills.
 
  • #25
sdoug041 said:
But we have 3 unkowns in 2 equations :s

I thought we settled the infinite number of solutions thing. Look, you know b3>=0. b1+b3=8 tells you b3<=8 since b1>=0. That's not an infinite number of possibilities.
 
  • #26
memomator said:
Ok i found out that b3 must be greater or equal to 3. does this mean that there are infinite solutions if b3 is greater or equal to 3? If so does this mean that there are infinite combination to the pills.

Can b3 be 9 or greater?
 
  • #27
Oh ok so b3 is between 3 and 8 but if i plug in 0, 1, and 2 i get a negative number for b2.

also what does the number 3 between 8 represent
 
  • #28
memomator said:
Oh ok so b3 is between 3 and 8 but if i plug in 0, 1, and 2 i get a negative number for b2.

also what does the number 3 between 8 represent

b3 is the number of pills of brand 3, right? I'm a little confused why you are asking...
 
  • #29
Dick said:
I thought we settled the infinite number of solutions thing. Look, you know b3>=0. b1+b3=8 tells you b3<=8 since b1>=0. That's not an infinite number of possibilities.

Ok I see.

If b3 >= 0 , and say b3 was indeed 0, then b2 would have to be -3 to satisfy the equation. Does this mean b3 should be 3<=b3<=8, and 0<=b1<= 5?
 
  • #30
The question states. Find all combination of pills that provide you with the exact daily requirement(no partial pill). How will I find all the combination of pills, knowing only the number of pills in brand 1, 2, and 3.
 
  • #31
sdoug041 said:
Ok I see.

If b3 >= 0 , and say b3 was indeed 0, then b2 would have to be -3 to satisfy the equation. Does this mean b3 should be 3<=b3<=8, and 0<=b1<= 5?

Yes, yes, yes. What about b2? Now how many total solutions are there to your pill taking needs?
 
  • #32
memomator said:
The question states. Find all combination of pills that provide you with the exact daily requirement(no partial pill). How will I find all the combination of pills, knowing only the number of pills in brand 1, 2, and 3.

"the number of pills in brand 1, 2, and 3" is what you need to specify a "combination of pills". For example, from your equations I see 3 pills of brand 3, 5 pills of brand 1 and 0 pills of brand 2 is one solution. How many more are there?
 
  • #33
Ok so 0<=b2<=5

I've found 6 possible solutions for the equations :D

Thanks alot, Dick.
 
  • #34
Ok i understand that now, is there an easier way to find out how many solutions there are other than plugging into numbers.
 
  • #35
memomator said:
Ok i understand that now, is there an easier way to find out how many solutions there are other than plugging into numbers.

Sure, b1+b3=8 tells you you need b3<=8 to make b1 nonnegative. b2-b3=(-3) tells you you need b3>=3 to make b2 nonnegative. Put them together and you have 3<=b3<=8 with the other values being b1=8-b3 and b2=(-3)+b3. You could also write the answer that way instead of spelling out the explicit values of b1 and b2.
 
<h2>1. What is Gaussian Elimination and how does it work?</h2><p>Gaussian Elimination is a method used to solve systems of linear equations. It involves manipulating the equations through row operations to eliminate variables and eventually solve for the remaining variables. This is done by converting the equations into an augmented matrix and then using elementary row operations to reduce the matrix into its row echelon form.</p><h2>2. Can Gaussian Elimination be used to solve for vitamin pills?</h2><p>Yes, Gaussian Elimination can be used to solve for any set of linear equations, including those related to vitamin pills. The method remains the same, but the equations will involve the amounts of different vitamins in each pill and the recommended daily intake of each vitamin.</p><h2>3. What are the steps involved in using Gaussian Elimination to solve for vitamin pills?</h2><p>The steps involved in using Gaussian Elimination to solve for vitamin pills are:<ol><li>Write out the system of equations representing the vitamin pills.</li><li>Convert the equations into an augmented matrix.</li><li>Use elementary row operations to reduce the matrix into its row echelon form.</li><li>Use back substitution to solve for the remaining variables.</li><li>Check the solution by substituting the values back into the original equations.</li></ol></p><h2>4. Are there any limitations to using Gaussian Elimination to solve for vitamin pills?</h2><p>One limitation of Gaussian Elimination is that it can only be used to solve for linear equations. If the equations representing the vitamin pills are non-linear, then another method, such as substitution or elimination, would need to be used. Additionally, if the system of equations is inconsistent or has infinitely many solutions, then Gaussian Elimination may not provide a unique solution.</p><h2>5. How can Gaussian Elimination be applied to real-life situations involving vitamin pills?</h2><p>Gaussian Elimination can be applied to real-life situations involving vitamin pills by using the system of equations to determine the optimal combination of pills to meet the recommended daily intake of each vitamin. It can also be used to compare different brands of vitamin pills and their compositions to determine which one best meets an individual's vitamin needs.</p>

FAQ: How to Use Gaussian Elimination to Solve for Vitamin Pills

1. What is Gaussian Elimination and how does it work?

Gaussian Elimination is a method used to solve systems of linear equations. It involves manipulating the equations through row operations to eliminate variables and eventually solve for the remaining variables. This is done by converting the equations into an augmented matrix and then using elementary row operations to reduce the matrix into its row echelon form.

2. Can Gaussian Elimination be used to solve for vitamin pills?

Yes, Gaussian Elimination can be used to solve for any set of linear equations, including those related to vitamin pills. The method remains the same, but the equations will involve the amounts of different vitamins in each pill and the recommended daily intake of each vitamin.

3. What are the steps involved in using Gaussian Elimination to solve for vitamin pills?

The steps involved in using Gaussian Elimination to solve for vitamin pills are:

  1. Write out the system of equations representing the vitamin pills.
  2. Convert the equations into an augmented matrix.
  3. Use elementary row operations to reduce the matrix into its row echelon form.
  4. Use back substitution to solve for the remaining variables.
  5. Check the solution by substituting the values back into the original equations.

4. Are there any limitations to using Gaussian Elimination to solve for vitamin pills?

One limitation of Gaussian Elimination is that it can only be used to solve for linear equations. If the equations representing the vitamin pills are non-linear, then another method, such as substitution or elimination, would need to be used. Additionally, if the system of equations is inconsistent or has infinitely many solutions, then Gaussian Elimination may not provide a unique solution.

5. How can Gaussian Elimination be applied to real-life situations involving vitamin pills?

Gaussian Elimination can be applied to real-life situations involving vitamin pills by using the system of equations to determine the optimal combination of pills to meet the recommended daily intake of each vitamin. It can also be used to compare different brands of vitamin pills and their compositions to determine which one best meets an individual's vitamin needs.

Similar threads

Back
Top