# There are 3 foods with the following Protein/Fat/Carbs (grams/ounce): 2,3,4; 3,3,1; 3,3,2. We want a meal using the 3 foods that results in 24g of protein, 27g of fat, 20g of carbs. How much of each food is needed?

$\left(A , B , C\right) = \left(3 , 4 , 2\right)$ ounces of food

#### Explanation:

I'm going to use the Food letters - A, B, C - to be the number of ounces of that food that should be used.

I'm going to put the chart here (numbers in grams/ounce):

$\text{Food"color(white)(0)"Protein"color(white)(0)"Fat"color(white)(0)"Carbs}$

$\textcolor{w h i t e}{00} \text{A"color(white)(00000)"2"color(white)(00000)"3"color(white)(000)"4}$

$\textcolor{w h i t e}{00} \text{B"color(white)(00000)"3"color(white)(00000)"3"color(white)(000)"1}$

$\textcolor{w h i t e}{00} \text{C"color(white)(00000)"3"color(white)(00000)"3"color(white)(000)"2}$

And we need 24g of Protein, 27g of Fat, 20g Carbs, so:

(P)rotein: $2 A + 3 B + 3 C = 24$
(F)at: $\textcolor{w h i t e}{000} 3 A + 3 B + 3 C = 27$
(C)arbs: $\textcolor{w h i t e}{0} 4 A + 1 B + 2 C = 20$

I'm first going to work on expressing the B values in terms of A and C. I'll do that by subtracting $3 \times C$ and first P and then F:

3C: $\textcolor{w h i t e}{0000} 12 A + 3 B + 6 C = 60$
P: $\textcolor{w h i t e}{000000} 2 A + 3 B + 3 C = 24$

$3 C - P$: $10 A + \textcolor{w h i t e}{00000} 3 C = 36$

3C: $\textcolor{w h i t e}{0000} 12 A + 3 B + 6 C = 60$
F: $\textcolor{w h i t e}{000000} 3 A + 3 B + 3 C = 27$

$3 C - F$: $9 A + \textcolor{w h i t e}{000000} 3 C = 33$

And I can now subtract $3 C - F$ from $3 C - P$ to get rid of C and solve for A:

$3 C - P$: $10 A + \textcolor{w h i t e}{00000} 3 C = 36$
$3 C - F$: $9 A + \textcolor{w h i t e}{000000} 3 C = 33$

$\left(3 C - P\right) - \left(3 C - F\right)$: $A = 3$

And now we can substitute this back in to one of our equations (I'll do both to double check our answer this far - I'll use colours to help highlight what we're doing):

color(blue)(3C-P: $10 A + 3 C = 36$

$3 C - P$: $10 \left(3\right) + 3 C = 36$

$3 C - P$: $30 + 3 C = 36$

$3 C - P$: $3 C = 6$

color(blue)(3C-P: color(red)(C=2

color(green)(3C-F: $9 A + 3 C = 33$

$3 C - F$: $9 \left(3\right) + 3 C = 33$

$3 C - F$: $27 + 3 C = 33$

$3 C - F$: $3 C = 6$

color(green)(3C-F: color(red)(C=2

Ok - C checks out as equaling 2. Now let's substitute into one of the originals (and I'll do all 3 to show it works in all the original equations):

(P)rotein: $2 A + 3 B + 3 C = 24$

(P)rotein: $2 \left(3\right) + 3 B + 3 \left(2\right) = 24$

(P)rotein: $6 + 3 B + 6 = 24$

(P)rotein: $3 B = 12$

(P)rotein: $B = 4$

(F)at: $3 A + 3 B + 3 C = 27$

(F)at: $3 \left(3\right) + 3 B + 3 \left(2\right) = 27$

(F)at: $9 + 3 B + 6 = 27$

(F)at: $3 B = 12$

(F)at: $B = 4$

(C)arbs: $4 A + 1 B + 2 C = 20$

(C)arbs: $4 \left(3\right) + 1 B + 2 \left(2\right) = 20$

(C)arbs: $12 + 1 B + 4 = 20$

(C)arbs: $B = 4$

Everything checks out!

$\left(A , B , C\right) = \left(3 , 4 , 2\right)$ ounces of food