How would you math the shit out of this?

Buzzfeed has a quiz to see if you can keep your fast food cals under 2000. There are 6 choices for breakfast, lunch, afternoon snack, a Starbucks drink and dinner you pick one of each and at the end it tells you how many calories you have consumed.

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?

1800 calories. Tried once. Tip: bread has a shitload of calories. Listen to Ramona, eh.


Don’t the companies’ websites have that info?

Mediterranean Egg White on Ciabatta Bread - Panera Bread = 420

Egg White Delight McMuffin - McDonalds = 260

Turkey Sausage Flatbread - Dunkin’ Donuts = 480

Spinach, Feta, and Cage-Free Egg White Breakfast Wrap - Starbucks = Not on the menu

Sausage, Egg, Cheese and Hash Brown Burrito - Burger King = 370

Acai Primo Bowl - Jamba Juice = 490

Yes. But that’s not my question. I’d like to know how to work out this problem.

Again, I don’t want to know the caloric content of these foods. I want to know how to work out this problem and the steps smart people take to understand how to work out this problem.

Now I’m wondering if I also need help with English along with math as no one understands what my original question is. I’m such a dummy!

I think you would have to know the actual number for at least one item, or one item in each category.

I thought you just wanted to win, lol.

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.


Mathing weirds arithmetic.

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 :

McMuffin + Burrito + Cookie + Macchiato + Tilapia = 2500 (or whatever)

Once you have the equations, you solve for each food item. I don’t see how you would get dependent equations from this quiz, it’s a worry sometimes, but not here.

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.

That’s a reference to Scott Pilgrim, both the graphic novels and the movie: “Bread makes you fat.” :wink: