possible pizza orders

You are correct if the order you get your pizzas matters. The stuff inside the outer square brackets (which equals $4 \cdot 2^8=1024$) is the number of single pizzas. It seems more likely that getting pizza A and then B is the same as getting B and then A. In that case you have to divide the cases of disparate pizzas by $2$, so there would be $1024$ (ways to get two the same) + $\frac 12\cdot 1024 \cdot 1023$ (ways to get two different).

You can save yourself computing all the $8 \choose n$'s by noticing that you have eight binary choices to make, one for each topping. You can make them in $2^8$ ways, so that gives the sum of all the $8 \choose n$'s


Let $i$ be the number of toppings you wish to include on your pizza, where $0 \leq i \leq 8$.

Choosing one pizza could be calculated as follows, $$4\sum\limits_{i=0}^8 {8\choose i} = 4\cdot2^8$$

To calculate the number of possibilities, I will count the number of ways in which you can have the same pizza plus the number of ways in which you can have two different pizzas:

Possibilities for choosing the same pizza is equal to the number of different possibilities for one pizza, that is $$4\sum\limits_{i=0}^8 {8\choose i} = 4\cdot2^8$$

Counting the possibilities for two different pizzas as follows, $$\frac{\Bigg[4\sum\limits_{i=0}^8 {8\choose i}\Bigg]\cdot \Bigg[\Bigg(4\sum\limits_{i=0}^8 {8\choose i}\Bigg)-1\Bigg]}{2}$$

$$= \frac{(4\cdot 2^8)\cdot(4\cdot 2^8 -1)}{2}$$

You're dividing by two since the order in which you pick the pizzas are not relevant.

In total, that gives you $$(4\cdot 2^8) + \frac{(4\cdot 2^8)\cdot(4\cdot 2^8 -1)}{2} = 524800$$ possibilities for two pizzas.


Note that this is problem 14 in chapter 1 of Introduction to Probability by Blitzstein and Hwang.

The problem amounts to sampling with replacement where the order doesn't matter, which is similar to problem 13 in and the hint there (use Bose Einstein) applies here too. This is also known as the "stars and bars" method.

Imagine an order form with $4 \times 2^8$ = 1024 columns for each distinct kind of pizza. With 2 pizzas there are $\binom{1024+2-1}{2}$ = $\binom{1025}{2}$ unique orders.