This is part IV of a series on the maths behind drop rates.
 Part I: Practical questions
 Part II: Extracting probabilities
 Part III: More than one box
 Part IV: Box inside a box
 Part V: The Asphalt 8 Box Calculator (tba)
 Part VI: All formulas in a nutshell (tba)
This part continues the explanations of part III and will show you how to calculate your chances if a box grants a guaranteed, but variable amount of desired items (for example, the Expert Bundle of the 5th Anniversary event granting 17 Audi R8 etron SE blueprints).
Expectations revisited
In Part II we have examined the expected values of items in a box. Now it's time for the more precise definition that is used in probability theory, because numbers can have expected values, too.
Let $ X $ be a random variable with a finite number of finite outcomes $ x_1 $, $ x_2 $, ..., $ x_k $ occurring with probabilities $ p_1 $, $ p_2 $, ..., $ p_k $, respectively. The expected value or expectation of $ X $ is defined as
 $ \operatorname{E}[X] = \sum_{i=1}^k x_i\, p_i = x_1p_1 + x_2p_2 + \ldots + x_kp_k $.^{[1]}
Since all probabilities $ p_i $ add up to 1 ($ p_1 + p_2 + \ldots + p_k = 1 $), the expected value is the weighted average, with $ p_i $’s being the weights. In the special case of all probabilities being the same ($ p_1 = p_2 = \ldots = p_k $), the weighted average turns into the simple average.
Example: If $ X $ represents the outcome of a roll of a fair sixsided die, the possible values for $ X $ are 1, 2, 3, 4, 5, and 6, all equally likely (each having the probability of $ \tfrac16 $). The expectation of $ X $ is
 $ \operatorname{E}[X] = 1\cdot\frac16 + 2\cdot\frac16 + 3\cdot\frac16 + 4\cdot\frac16 + 5\cdot\frac16 + 6\cdot\frac16 = 3.5 $.
In this case (all outcomes of $ X $ have the same probability $ p $), the general formula becomes
 $ \operatorname{E}[X] = \sum_{i=1}^k x_i\, p = x_1p + x_2p + \ldots + x_kp $.
The box inside the box
The "Elite Supplies" of the McLaren 720S World Tour and the "Expert Bundle" of the 5th Anniversary event have in common that they both contain guaranteed blueprints, but you don't know the exact number you'll get. For example, the Expert Bundle grants between 1 and 7 of them.
As resources are rare and an event usually offers several ways to spend them, it would be cool to know what we can expect before we take a decision. The most important questions are:
 How many blueprints can I expect?
 How probable is it that I get a certain number of blueprints?
How many blueprints can I expect?
In Part II I had introduced the "box inside the box" principle to isolate the random items that we wanted to examine. Now we do the same, but this time, we take the blueprints and think of them as a subbox. If you open it, you have the chance to draw either 1, 2, ..., or 7 blueprints. So the content of this subbox is nothing more than a variable $ D $ (for the desired items drawn) with the finite outcomes 1, 2, ..., 7. Gameloft doesn't say anything about the probabilities of each number, so we have to assume that they are all the same. In this case we can compare it with a fair sevensided die, and the expected number of blueprints we get if we open a very large number of boxes is the simple average:
 $ \operatorname{E}[D] = \sum_{i=1}^7 i\cdot\frac17 = 1\cdot\frac17 + 2\cdot\frac17 + 3\cdot\frac17 + 4\cdot\frac17 + 5\cdot\frac17 + 6\cdot\frac17 + 7\cdot\frac17= 4 $.
If the sevensided die wasn't fair, there would be different probabilities assigned to each of the outcomes of $ D $, and we would get a weighted average. This is the way Gameloft could adjust the number of blueprints you get from a box, even if the description "17 blueprints" was still true. To verify this, a very large number of boxes would have to be opened in order to get a valid statistical base for a calculation. I'm talking of 1,000 or more boxes, which is impossible, so we have to live with a certain rest of uncertainty.
How probable is it that I get a certain number of blueprints?
Let's assume you have 1,050. With these coins you can buy 3 Expert Bundles for 350 each. As we know that the expected value $ \operatorname{E}[D] $ for one box is 4, it's tempting to simply multiply this with the number of boxes, so we should get 12 blueprints. But remember that an expected value needs a very large number of draws to become a good approximation of reality. How reliable is this prediction if we only open 3 boxes?
There are $ 7^3 $ permutations,^{[2]} and 4 + 4 + 4 is one of them. It has a probability of $ \tfrac1{7^3} $ = 0.29 %. But there are other combinations that also grant 12 blueprints: 4 + 5 + 3, for example, or 2 + 3 + 7, each having a probability of $ \tfrac1{7^3} $.
So if we want to know the probability of getting at least 12 blueprints, we first have to find the number $ c_{12} $ of combinations whose sum equals 12. As we can also get more than 12 blueprints (and we won't complain), we then have do the same for $ c_{13} $, $ c_{14} $, ... up to the maximum number of blueprints we can get, which is the number of boxes multiplied with the maximum number of blueprints per box ($ 3 \cdot 7 = 21 $). The sum of the combinations $ c_{12} $, $ c_{13} $, ... $ c_{21} $ is the final number of combinations with at least 12 blueprints from 3 boxes. As each of these combinations has a probability of $ \tfrac1{7^3} $, the probability $ P(D \ge 12) $ of getting at least 12 blueprints is
 $ P(D \ge 12 ) = \frac{c_{12}}{7^3} + \frac{c_{13}}{7^3} + \ldots + \frac{c_{21}}{7^3} $.
Generally, the probability of getting at least $ d $ desired items from boxes containing a variable number of guaranteed items is
 $ P(D \ge d) = \frac1{m^n} \cdot \sum_{i=d}^{nm} c_i $.
 $ d $: number of desired items
$ m $: maximum number of items per box
$ n $: number of boxes
$ c_i $: number of combinations with a sum of exactly $ i $ items
$ D $: event of desired items drawn
$ P(D \ge d) $: probability of $ D $ being equal to or greater than $ d $
But we still have to find out the values for $ c_i $. The general formula to calculate them is
 $ c_i = \sum_{k=0}^{\left \lfloor \frac{in}{m} \right \rfloor} (1)^k \cdot \binom nk \cdot \binom{i  mk  1}{n  1} $.
For those interested in how to derive the $ c_i $ formula, there's a good explanation of an analogous example with nsided dice at StackExchange.^{[3]}
Now we have everything we need to calculate the probability of getting at least 12 blueprints from 3 Expert Bundles. It is
 $ \begin{align} P(D \ge 12) & = \frac1{7^3} \cdot \sum_{i=12}^{3 \cdot 7} c_i, \quad c_i := \sum_{k=0}^{\left \lfloor \frac{i3}{7} \right \rfloor} (1)^k \cdot \binom 3k \cdot \binom{i  7k  1}{3  1}\\ \\ \\ & = 55.39 %. \end{align} $
So you've got a 55.39 % chance of getting at least the expected number of 12 blueprints. You think that's not much for something called an expected value?
To get an orientation, one should also calculate the probabilities for the other numbers of blueprints. I did this in Table 1; the row with 12 blueprints is highlighted. At the bottom you can find the value of 0.29 % for 21 blueprints which sounds somewhat familiar. It's the $ \tfrac1{7^3} $ we've calculated before. As there is only one of $ 7^3 $ combinations that delivers a sum of 21 blueprints (7+7+7), its probability is $ \tfrac1{7^3} $.
Table 2 shows the probabilities of getting exactly (not at least) the number of desired blueprints for several numbers of boxes. I've cut the rows at $ d = 21 $ because this is the maximum number of blueprints you can get in our example of 3 boxes.
I've also added the expectations in the top row so you can see that the expected value has indeed the highest probability—but it's perhaps lower than one might have expected. It even decreases when you open more boxes. That's no contradiction because the more boxes you have, the more possibilities there are to place the desired items in a sequence with an exponentially increasing length of $ 7^n $.


There's another link between the two tables: If you choose a value in the $ n = 3 $ column of Table 2 and add all following values, you get the corresponding value in Table 1. That's what we did in a more abstract way in the $ \frac1{7^3} \cdot \sum_{i=12}^{21} c_i $ part of the formula above.
The diagram to the right illustrates the symmetry of the values surrounding the expected value and also shows its decreasing probability when the number of boxes increases. Technically, this is called a discrete probability distribution,^{[4]} and the formula we have found to produce this distribution is a probability mass function.^{[5]}By the way, you can use our probability mass function for dice games, too! Just replace the maximum number of items per box $ m $ with 6 (sides of a die) and the number of boxes $ n $ with the number of dice you use (or the number of rolls with one die, it's the same). The number of desired items $ d $ is the sum of pips you want to get.
Of course, it would take ages to calculate this manually. You can do it by using the functions shared at the end of this series.
The next post will answer the remaining question how many boxes must be opened to have at least a defined chance (for instance 90 %) of obtaining a desired item.
If you have questions or find mistakes: Feel free to comment!
References
 ↑ See Wikipedia: Expected value.
 ↑ See Part III: Permutation.
 ↑ "Probability that the sum of k dice is n". StackExchange. 20170521. Retrieved 20180919.
 ↑ See Wikipedia: Probability distribution.
 ↑ See Wikipedia: Probability mass function.