Solving $a_1x_1 + \cdots +a_nx_n = b$

105 Views Asked by At

I'm glad to ask my first question on the maths site! So here we go. I'm trying to set up prices right now and here is my problem :

I know that my customer has a certain amount of money available. This amount is known and fixed. So I would like to sell him my products to a certain price depending on their popularity. I have found that a good idea would be to use this popularity as a coefficient. (The popularity is also fixed and known, it is a percentage).

My goal is that the total price of all the products I'm selling doesn't exceed the amount of money my customer has. Therefore I ended up with this easy to find equation but I don't see how to solve it. $$a_1x_1 + \cdots +a_nx_n = b$$

For example, if my customer has $10$ dollars and if I have $20$ products to sell him, I would have this equation : $$a_1x_1 + \cdots + a_{20}x_{20} = 10$$

Where the $a_i$ are the popularity of each product. My goal is to find a repartition of the $x_i$ which is correlated with the $a_i$.

Thanks a lot

PS : I don't have a Phd so please... But I do have a MSc in Engineering. What I want to say is that I can understand advanced mathematics but start from the beginning of the story please ; )

Edit

My only criteria is that the repartition of the xi should reflect the repartition of the ai. For example if $a_2$ is the highest popularity, $x_2$ should be the highest price.

2

There are 2 best solutions below

3
On BEST ANSWER

I think we can represent the desired criteria with the following system of equations $$ x_1 + x_2 + \cdots + x_n = b $$ and to enforce "reflection of the $a_i$" (assuming all $a_i$ are non-zero), we have $$ x_1/a_1 = x_2/a_2 = \cdots = x_n/a_n $$ Which gives us a system of $n$ equations on $n$ variables, which will have a unique solution.

We can find the solution as follows: define $t$ to be the common ratio $x_i/a_i$. We have $x_i = a_i t$, so that $$ a_1 t + a_2 t + \cdots + a_n t = b $$ Which is to say $$ (a_1 + \cdots + a_n)t = b \implies t = b/(a_1 + \cdots + a_n) $$ Once we have $t$, substitute back to find $x_1 = a_1 t$, $x_2 = a_2 t$, and so on.

All together, we have $$ x_i = \frac{a_i}{a_1 + a_2 + \cdots + a_n} \cdot b $$

4
On

There will surely be more than one solution, since it is highly unlikely that you have as many products as you have equations (i.e. 1 product).

Therefore it is not a problem of solving this equation rather than finding an optimal set of prices $\left(x_1,\cdots,x_n\right)$.

  • Solution 1

The "optimality" of this set will be defined by what is called an objective function (or cost function) that you will have to determine.

This cost function can, for instance, be the sum of all prices, or the average price, or even the standard variation of your price distribution. Anything you can think of and that would make the solution better suit your needs. You can also have multiple cost functions.

Then the goal would be minimising or maximising this/these cost function(s).

This is called an optimisation problem and there are several algorithms that work quite well on these.

  • Solution 2

Just set the coefficient as the total price times the popularity weighted over the total popularity. I.e:

$$\forall i\in[1,n], x_i = b\times\frac{a_i}{\sum_{k=1}^n a_k}$$

And you can check that if you sum all prices you get $b$:

$$\sum_{i=1}^n x_i = \sum_{i=1}^n b\times\frac{a_i}{\sum_{k=1}^n a_i} = b \times \sum_{i=1}^n \frac{a_i}{\sum_{k=1}^n a_k} = \frac{b}{\sum_{k=1}^n a_k} \times \sum_{i=1}^n a_i = b \times \frac{\sum_{i=1}^n a_i}{\sum_{k=1}^n a_k} = b$$

For example:

Say $b=10$ and you have 2 products with popularities $a_1=0.6$ and $a_2=0.2$. Then your prices would be:

$$x_1 = 10 \times \frac{0.6}{0.8} = 7.5$$

and

$$x_2 = 10 \times \frac{0.2}{0.8} = 2.5$$