[Math] How to calculate average of something based on a range of another thing

average

How do I calculate the following example:

Range of prices in whatever currency like: (0, 10), (10, 20), (20, 30)

There are numbers of products underneath each range: So I have something like 100 of some kind of product under price range of (0, 10). 150 of some other product under the price range of (10, 20). and 80 of another product in the price range of (20, 30).

Important thing is that the product under each price range can be any price within that range. How do I calculate the average price of all the products within the given ranges without knowing all the prices?

What can help me solve this? I search all of google but I do not know what I am looking for? Please, I am not good with math. If this is not good question for this site, tell me what to look for and what knowledge I need to search google for.

Best Answer

Suppose there are $n$ products.

For each product, there is a minimum price $p_i$ and a maximum price $q_i$ and the number of that product $f_i$.

Then the mean price of all products lies between a lower bound $\bar p$ and an upper bound $\bar q$, where

$$\bar p=\frac{\Sigma p_if_i}{\Sigma f_i}$$

and $$\bar q=\frac{\Sigma q_if_i}{\Sigma f_i}$$

You have:

$f_1=100$, $p_1=0$, $q_1=10$.

$f_2=150$, $p_2=10$, $q_2=20$.

$f_3=80$, $p_3=20$, $q_3=30$.

$$\bar p=\frac{0 \times 100+ 10 \times 150 + 20 \times 80}{100+150+80}=\frac{3100}{330} \approx 9.39$$

$$\bar q=\frac{10 \times 100+ 20 \times 150 + 30 \times 80}{100+150+80}=\frac{6400}{330} \approx 19.39$$

Related Question