# Methods for computing partial-costs of product bundles?

1. Aug 30, 2011

### KingNothing

This might go into stats, I'm not sure. But I'll throw it out there. You are at the grocery store and they have two product bundles:

Four bananas and three limes for $10. Two grapefruits and five limes for$12.

You want to come up with a way to compute the average cost of a lime, the average cost of a grapefruit, and the average cost of a banana in order to do comparison shopping. Assume that you have no personal preference on what you eat, and only care about cost and value.

I've simplified a much bigger problem I'm facing at work with a dataset in the 1000's. I really don't have any idea where to start. Are there any known methods for doing this?

2. Aug 30, 2011

### Staff: Mentor

In general, yes, but not for this problem, since you have only two equations with three variables. This system is underdetermined, so a unique solution does not exist.

Mathematically, your system of equations looks like this:
4B + 0G + 3L = 10
0B + 2G + 5L = 12

Graphically, this system represents two planes in 3D space. Since the planes are obviously (to me) not parallel, they have to intersect, and do so in a line. Every point on the line is a solution to the system of equations.

BTW, that's some pretty expensive fruit...

3. Aug 30, 2011

### KingNothing

Thanks for the help. I am afraid I don't completely follow, though I believe I do partially.

So for example, if the equations were:
2B + 1G + 3L = 10
4B + 2G + 6L = 20

These would be parallel planes, correct? And in this case, there would be infinitely many solutions?

If there were three bundles of fruit that were not multiples of each other, we would get an exact solution, correct? Here's the thing - I actually have many more bundles than I have types of fruit. So I want to find the best solution although it can't be exact.

The "perfect" result would be finding values for each fruit such that the bundle prices are predicted 100% accurately. However, I understand this is not a likely situation - what I'm really looking for is a way to find fruit values such that the inaccuracies in predicting bundle prices are minimized.

By the way, I don't mean "predicting" as in looking ahead in time and predicting events, I mean in the sense of using a per-fruit price to most accurately reconstruct the bundle prices as a linear combination of the fruit prices.

Last edited: Aug 30, 2011
4. Aug 30, 2011

### KingNothing

Thank you for reminding me that I'm actually expressing a system of equations. Let's start with a new example. Say the store is offering three bundles now:

4B+0G+3L=10
0B+2G+5L=16
6B+9G+2L=37

If you solve this, you get B=2, G=3, L=1. Now let's say the store offers another bundle: 6B+0G+3L=11

This is very similar to bundle #1 - you get two more bananas, but for only \$1 more. Logic would tell you this wouldn't throw the price of each fruit too far off, and this is my rationale for believing there may be some best-fit algorithm.

It seems what I am searching for is a regression that models a function F(x,y,z...) that has many independent variables.

Last edited: Aug 30, 2011
5. Aug 30, 2011

### KingNothing

It seems what I am looking for is actually just a linear regression with multiple independent variables. Case closed (for now).

By the way, HallsofIvy, I saw that ;).

6. Aug 30, 2011

### HallsofIvy

What, perhaps, is being overlooked is that the number of bananas, grapefruits, and limes must be a positive integer (I suppose it is possible to buy half a grapefruit, but I can't imagine a store including half a grapefruit in a bundle of fruit!). That is, we really have Diophantine equations.

The equations are 4B+ 3L= 10 and 2G+ 5L= 12. Notice that 4- 3= 1 so, multiplying by 10, 4(10)+ 3(-10)= 10. So one solution to the first equation is B= 10, L= -10. Of course, L must be positive but it is easy to see that B= 10- 3k, L= -10+ 4k is also a solution for any value of k (4(10- 3k)+ 3(-10+ 4k)= 40- 30- 12k+ 12k= 10).

Find a value of k so that both B and L are positive integers, then use 2G+ 5L= 12 to find G.

7. Aug 30, 2011

### Staff: Mentor

8. Aug 30, 2011

### KingNothing

Yes, I do remember from LA that no equation can be a linear combination of the others in order to get a unique solution. I believe what I am looking for is a linear regression.

HoI - Good to know! I had never heard of Diophantine equations before. In my situation I actually have about ~1000 equations with ~500 independent variables, which can actually take any positive value. I don't imagine I will run into any issues with having negative values, so I'm not really concerned about that part.