# Dilution calculator

Here is a small tool for diluting liquids to get a result having a desired strength.

NB! Keep in mind that by definition 1L of water = 1kg of water, and that when cooking on a home scale this can be assumed to hold true for many other liquids that are mostly water, such as milk.

## Examples

### Diluting vinegar

Say that you want to use 150 ml of vinegar that has a strength of 10% (acid) for a recipe. But you only have vinegar that is 30% strong, and need to dilute it using water (which has a strength of 0%). Then in the form above you can fill inn

- Desired total amount: 150
- Final concentration: 10
- First thing you want to mix - Concentration: 30
- Other thing you want to mix - Concentration: 0

After pressing the Figure out amounts needed

button, the form will be updated, and in the Amount

field for the 30% vinegar you will see that you need 50 ml of it, while you have to add 100ml of the 0% water.

### Using butter and milk to get liquid with same fat percentage as cream

Another example could be that you are short on cream for a recipe, but you have butter. You know that you need 250 grams of cream, and that it should be 20% fat. Say that the butter you have is 82% fat, and you also have some 3.5% fat milk. Then, in the calculator above you can fill in

- Desired total amount: 250
- Final concentration: 20
- First thing you want to mix - Concentration: 3.5
- Other thing you want to mix - Concentration: 82

After pressing the Figure out amounts needed

button, the form will be updated, and in the Amount

field for the 3.5% milk you will see that you need 197.45 grams of it, while you have to add 52.55 grams of the 82% butter.

## Notes

Important things to note about the utility:

- The units used for amount and concentration can be anything, it still works out the same. That is, it doesn't matter if the concentration is in grams per liter or percent, or if the amount is in grams, liters, etc.
- The amounts have to be of a consistent type. If your total desired amount is in milliliters, the suplied amounts have to be milliliters.
- The concentrations have to be of a consistent type. If you are using percent for the concentration, all the concentration fields have to be in percent.
- The tool rounds off the amounts, to two decimal places.

## The math behind it

Heres is an overview of the assumptions behind the tool and how it works. It is based on the following assumption:

Amount 1 * Concentration 1 + Amount 2 * Concentration 2 = Target Amount * Final Concentration

Or, for short

a1 * c1 + a2 * c2 = at * cf

Using the property that we expect the amounts to add up, that is a1 + a2 = at

, we can find the amounts we need to add together to get the final result. We must known the concentrations, and when we do we can figure out the amounts like this:

- a1 * c1 + a2 * c2 = at * cf
- a1 * c1 + (at - a1) * c2 = at * cf
- a1 * c1 - a1 * c2 + at * c2 = at * cf
- a1 * (c1 - c2) = at * (cf - c2)
- a1 = at * (cf - c2) / (c1 - c2)

Upon closer inspection, we can see that the last expression only relies on the final amount we want to be left with, and the concentrations. Therefore, for the cases where we rely on order, or if we want to compute the amounts simultaneously, we can similairly express the other amount as a2 = at * (cf - c1) / (c2 - c1)

.