How to solve problems on alligation and mixture when three types are given? Suppose there are three qualities of rice, A(1 dollar per Kg), b(2 dollar per Kg) and C(3 dollar per Kg). The salesmen want to mix these in a certain ratio a:b:c so as to make the price 2.5 dollar per kg. 

How can we find the ratio by using methods of alligation and mixture?

A reference to the proof(or the proof itself if possible) of the method would also be helpful. 
P.S: The formula for two types is $$ \dfrac{\text{Amount of A}}{\text{Amount of B}}=\dfrac{P_M-P_B}{P_A-P_M} $$ Where $P_M=$mean price, $P_A=$ Price of $A$ and $P_B=$ price of $B$.
 A: I am not familiar with the process of alligation, but here is how I would solve this problem. From what I can tell, this method is, according to Wikipedia, "A general formula that works for both alligation 'alternate' and alligation 'medial'". 
Let $a$ be the number of kilograms of quality A rice at USD $1$ per kg, $b$ be the number of kilograms of quality B rice at USD $2$ per kg, and $c$ be the number of kilograms of quality C rice at USD $3$ per kg. Then
$$\text{Total Cost}=1a+2b+3c$$
$$\text{Total Mass}=a+b+c$$
We want
$$\text{Price}=\frac{\text{Total Cost}}{\text{Total Mass}}=2.50$$
$$\frac{a+2b+3c}{a+b+c}=\frac 52$$
$$2a+4b+6c=5a+5b+5c$$
$$c=3a+b$$
Since you want a ratio, not actual amounts, we'll just set $a=1$. This still does not decide the value of $b$, so we'll also set $b=r$ where $r$ is any arbitrary non-negative real number. Then the ratio of rice qualities A:B:C that gets us a price of USD $2.50$ is

$$1:r:(r+3)$$

This is easily checked. With those values,
$$\text{Total Cost}=1a+2b+3c=1\cdot 1+2\cdot r+3\cdot(r+3)=5r+10=5(r+2)$$
$$\text{Total Mass}=a+b+c=1+r+(r+3)=2r+4=2(r+2)$$
$$\text{Price}=\frac{5(r+2)}{2(r+2)}=\frac 52=2.50$$
You can see that there are infinitely many ratios of the three kinds of rice that will give you the desired price. This will be true in general for a mixture of three kinds of goods, as long as the final price is somewhere between the maximum and the minimum price of the three kinds of goods. (If the desired price is out of that range, we will get a negative number for at least one of the kinds of goods, which is unrealistic.)
