I want to know how to figure out the calories of each item in the quiz. How would you math it? What equations could you use and how do you figure out the best way to, well, figure it out? The first thing I did was run one quiz, find out the total cals and then do the same quiz with one item changed. This only gave me the caloric difference between the two swapped items and I realized I am dumb at math. Can someone smarter talk me through this?
You need to set up a system of equations. There are, by my count, 26 unknowns, which means you need 26 equations. Each one would look something like:
EggMM + BSupr + FnY + GrandePink + Tilapia = 1440
You need to cover each food item at least once, and can’t have any duplicate combos, but beyond that the choices don’t matter.
After that, use your method of choice to solve the system. The usual way is to put them in a matrix. Here, you would have a 26x26 matrix, with each column having a 1 if you chose that item and 0 otherwise. If there were only two meals and two items per meal, the matrix might look like:
[1 0 1 0]
[1 0 0 1]
[0 1 1 0]
[0 1 0 1]
We multiply this by the unknown vector of per-item calorie counts to get the vector of known calorie totals (S is selection matrix, c is per-item calorie vector, and t is the total calorie vector):
Sc = t
Invert S to solve for c:
S[sup]-1[/sup]Sc = S[sup]-1[/sup]t
c = S[sup]-1[/sup]t
Inverting the matrix is beyond the scope of this post, but it is a very basic linear algebra operation and could even be done by hand, though it would be tedious and error-prone. I would use Wolfram Alpha.
True enough, this linear algebra calculates the caloric content of each food item, but the quiz actually asks you to pick exactly one food item from each category such that you get as close to 2000 calories as possible without going over. So figuring out the content of each item is not a complete answer.
With a small number of items you (or your computer) could just try all the possibilities; that obviously works. Some dynamic programming would be a more sophisticated way to go about it.
You can’t completely solve the problem. You can get as many equations as you need, but they won’t all be independent. For a simplified example, if I’m given x + 2y = 3, and 2x + 4y = 6, I still can’t solve for x and y, even though I have two equations, because one equation is derived from the other.
ThisIsTheEnd is right that you’d need to know a few of the items to begin with. Specifically, you need to know at least one item from all but one of the categories (that is to say, you can’t have two categories without known items). Because suppose you did have two categories with unknown items: There’s some item in Category A that has the least number of Calories. Now take any number less than that number, and subtract it from everything in that category, and add the same number to everything in Category B. You’ve now got a different set of Calorie counts, but one which will give you exactly the same total results, for every combination.
On the other hand, suppose that you do have at least one item from all but one categories. Now it’s easy to figure out: First, you take a menu consisting of all of the known items plus any one item in the last category. Look at the total, and you can find that last item, and so now you have an item in every category. Now, to find any individual item, just pair it up with all the known items in the other categories.
Oh, and to the quiz itself, it’s much easier than the quiz makes it out to be. Just skip the snack and the Starbucks drink and you’ll save a ton of Calories, but the quiz doesn’t give you that option.
There are 26 unknowns - so you’d need 26 equations.
Basically, you’d go through it 26 times (making sure you picked every item at least once and never picked the same group of items twice) and write down the answer each time, for example :
It seems really odd to me that you’re required to get a full sugar Starbuck’s drink as part of the exercise. Looks to me like it’s actually easy t stay under 2000 calories if you’re actually just eating and not having what’s really a big dessert item.
Sure, but shouldn’t it normally work out when the equation is not a multiple of the first one? For example, if the second equation is 2x+7y=9, they only intersect at [1,1] (in other words x=1, y=1 is the only solution.) or if the second equation is 2x+7y=10, then [1/3 , 4/3] is the solution.
As OP seems herself to have guessed, this will not work. The matrix you construct — indeed your own example — is singular. Stated differently: there will be infinitely many solutions until you have at least 4 known values.
I might approach such a problem by searching the scripts on the webpage itself. For those agile with, e.g., Chrome’s Developer tools this might be easy. But for me it would be like being a mouse in a tedious maze, with too little cheese at the end.
From what I’ve been able to figure out, the caloric range on this quiz seems to be 1370-3710. The single most penalizing item there is the guac and dip, adding 620 calories over the least caloric choice (the fruit parfait) in that category.
I’m not 100% positive my chart is correct, as I did find a couple errors where I clicked on the wrong item without noticing it until I double checked it.