How many ways to order 0, 1, 1, 2? How many ways are there to order $0,1,1,2$?
I know the answer is $12$, but I can't figure out the way to solve it.
It is:
$$2110, 2101, 2011, 1210, 1201, 1120, 1102, 1021, 1012, 0211, 0121, 0112$$
But what is the mathematical way to do it? It's not a combination, and not a permutation either, right?
 A: There are four slots you can place the $0$, and three remaining slots for the $2$.  The $1$s are then forced.  $3 \times 4 = 12$.
A: I think you are looking for a general formula.
OK, so suppose we have $k$ different numbers (or other kinds of objects), and suppose we have $n_k$ of each. Also, let 
$$n = \sum_{i=1}^{k}{n_i}$$
Then we get the following number of permutations:
$$\frac{n!}{n_1!\cdot n_2! \cdot ... \cdot n_k!}$$
Because the $n!$ is the number of permutations if we were to treat all those $n$ objects as different objects, but since all $n_k$ objects of 'type' $k$ are in fact treated the same, we should divide by the number of ways we permutated them.
So, in your case, we get:
$$\frac{4!}{1!\cdot 2! \cdot 1!}=\frac{24}{2}=12$$
permutations.
A: Answer is 12. you can calculate it as $\dfrac{4!}{2!}=12$ 
Here, $4$ is the number of digits and $2$ is the number of repeating $1$s 
A: Lets brake it into smaller problems:
1)suppose you have number 01,total arrangements = 2,how?take first digit say 0,0 has two options i.e. at first and second place(so for now arrangements=2),put it at first place 0_ (_ represent blank) now you have only one place to place 1.Hence arrangements=1.Total arrangements=2*1=2.
2)suppose you have 3 digit number 012,total arrangements=3*2*1,how?
lets pick 1 digit randomly say 2,now we have 3 blank places _ _ _ .So 2 have 3 options to be placed(arrangements=3)now suppose you placed 2 at 3rd place _ _ 2.
Now pick another digit say 1,it has only 2 options to be placed(since 2 is fixed at 3rd place).So arrangements=3*2.Now place 1 at 2nd place,now you can place 0 only at 1st place so arrangements=3*2*1=6.
General formula can be made as follows:-
   n!/r!
where n=total number of digits(4 in your case),r=total number of repeated digits(2 in your case,since 1 is repeated twice).
