# Alligation

Alligation is an old and practical method of solving arithmetic problems related to mixtures of ingredients. There are two types of alligation: alligation medial, used to find the quantity of a mixture given the quantities of its ingredients, and alligation alternate, used to find the amount of each ingredient needed to make a mixture of a given quantity. Alligation medial is merely a matter of finding a weighted mean. Alligation alternate is more complicated and involves organizing the ingredients into high and low pairs which are then traded off. Alligation alternate provides answers when an algebraic solution (e.g., using simultaneous equations) is not possible (e.g., you have three variables but only two equations). Note that in this class of problem, there may be multiple feasible answers.
Two further variations on Alligation occur : Alligation Partial and Alligation Total (see John King's Arithmetic Book 1795 which includes worked examples.) The technique is not used in schools although it is used still in pharmacies for quick calculation of quantities.

## Examples
### Alligation medial

Suppose you make a cocktail drink combination out of 1/2 Coke, 1/4 Sprite, and 1/4 orange soda. The Coke has 120 grams of sugar per liter, the Sprite has 100 grams of sugar per liter, and the orange soda has 150 grams of sugar per liter. How much sugar does the drink have? This is an example of alligation medial because you want to find the amount of sugar in the mixture given the amounts of sugar in its ingredients. The solution is just to find the weighted average by composition:
    ${1 \over 2}\times 120+{1 \over 4}\times 100+{1 \over 4}\times 150=122.5$ grams per liter

### Alligation alternate

Suppose you like 1% milk, but you have only 3% whole milk and ½% low fat milk. How much of each should you mix to make an 8-ounce cup of 1% milk? This is an example of alligation alternate because you want to find the amount of two ingredients to mix to form a mixture with a given amount of fat. Since there are only two ingredients, there is only one possible way to form a pair. The difference of 3% from the desired 1%, is assigned to the low fat milk, and the difference of ½% from the desired 1%, is assigned alternately to the whole milk. The total amount, 8 ounces, is then divided by the sum $2+{1 \over 2}={5 \over 2}$ to yield $16 \over 5$, and the amounts of the two ingredients are
    ${16 \over 5}\times {1 \over 2}={8 \over 5}$ ounces whole milk and ${16 \over 5}\times 2={32 \over 5}$ ounces low fat milk.
This article incorporates text from a publication now in the public domain: Chambers, Ephraim, ed. (1728). "Alligation". Cyclopædia, or an Universal Dictionary of Arts and Sciences (1st ed.). James and John Knapton, et al.
A general formula that works for both alligation "alternate" and alligation "medial" is the following: Aa + Bb = Cc.
In this formula, A is the volume of ingredient A and a is its mixture coefficient (i.e. a= 3%); B is volume of ingredient B and b is its mixture coefficient; and C is the desired volume C, and c is its mixture coefficient. So in the above example we get: A(0.03) + B(0.005) = 8oz(0.01). We know B = (8oz-A), and so can easily solve for A and B to get 1.6 and 6.4oz, respectively. Using this formula you can solve for any of the 6 variables A,a,B,b,C,c, regardless of whether you're dealing with medial, alternate, etc.

### Three-Variable Alligation Alternate

Suppose you were given $100 to buy 100 pieces of candy, with lolly-pops at 50 cents each, candy bars at $3 each, and large chocolate bars at $10 each. How many would you buy of each?
In the sequence of steps below, refer to this table:
Alligation Alternate with Three Variables :
| Simple | A | B | C | D | E | F | Quantity |
| 0.50 | 2.00 | 9.00 | 4 | 18 | 4 | 90 | 94 |
| 3.00 | 0.50 | | 1 | | 1 | | 1 |
| 10.00 | | 0.50 | | 1 | | 5 | 5 |
* Determine the average price of the candies, $1
* Identify one of the types of candy that costs less than the average (called a "Simple") and pair it with one of the Simples that is higher than the average (in this case, there is only one of the lower-cost Simples, but you choose among the two higher-cost Simples).
* Subtract the lower Simple from the average (in this case, $1.00-0.50). Assign the 0.50 difference to the higher Simple in column A.
* Subtract the average from the higher Simple (in this case, $3.00-$1.00). Assign the 2.00 difference to the lower Simple in column A.
* Choose the other higher Simple (in this case, $10) and subtract the average from it. Assign the 9.00 difference to the lower Simple in column B.
* Repeat step 3, assigning the 0.50 difference to the higher Simple in column B.
* Reduce the ratio of the values in column A to their lowest common denominator, and assign that alligation ratio to the cells in column C.
* Reduce the ratio of the values in column B to their lowest common denominator, assigning that alligation ratio to the cells in column D.
* Add the values of column C together (in this case, 5); this is the total number of "parts of the whole"
* Copy the values of column C to column E
* Multiply the values of column D by the "parts of the whole" (in this case, 5)
* Add the values of column E and F for each row to determine the answer for the quantity of each Simple to purchase.

### Repeated Dilutions

8 liters are drawn from a cask full of pure wine and is then filled with water. This operation is performed three more times. The ratio of the quantity of wine now left in cask to that of water is 16: 65. How much wine did the cask hold originally? This is an example of a problem that involves repeated dilutions of a given solution.
* Let Vw be the volume of wine in the cask originally.
* Let Vt be the total volume of liquid in the cask.
* Let X be the percentage of wine in the cask originally.
X = original volume of wine/ total volume of liquid in the cask = Vw / Vt
When 8 liters are drawn out, the volume of wine is reduced by 8 X liters while the total volume of liquid remains unchanged as it is re-filled with water.
Let X’ be the new percentage of wine in the cask after this operation
X’ = (original volume of wine – 8 X) / total volume of liquid in the cask
X’ = [Vw – 8 (Vw/ Vt)] / Vt
X’ = X (Vt – 8) / Vt
After 4 such replacement operations, X’’’’ = X [(Vt – 8)/ Vt] ^ 4
From the problem, X’’’’ = 16/ (16 + 65) = 16/ 81
Also, since originally the cask was full of pure wine, X = 1
[(Vt – 8)/ Vt] ^ 4 = 16/ 81
=> Vt = 24 liters