Let's say I have two types of chocolate. Chocolate A contains 70% cocoa and 30% sugar. Chocolate B contains 100% cocoa and no sugar.
How can I figure out the exact mixing ratio I need to use to combine these two chocolates into a new product that contains 90% cocoa and 10% sugar?
As one of our constraints we could use the fact that $x$ parts of chocolate $A$ plus $y$ parts of chocolate $B$ should add up to a whole. Furthermore, if a certain amount of chocolate $A$ contains $70\%$ cocoa, then exactly the same amount of chocolate $B$ will contain $100\%$ cocoa. Therefore, $70\%$ of the $x$ parts plus $100\%$ of the $y$ parts should give us $90\%$ of the entire whole. With these constrains in place, we get the following system of two equations with two unknowns:
$$\begin{cases} x+y=1\\ 0.7x+y=0.9. \end{cases} $$
Solving this system of equations, we get:
$$ 0.7x+(1-x)=0.9\implies x=\frac{1}{3},\\ y=1-x\implies y=\frac{2}{3}. $$
So, the sought ratio then will be (multiply the whole thing through by $3$ to get rid of those fractions):
$$ \frac{1}{3}:\frac{2}{3}\implies 3\cdot\frac{1}{3}:3\cdot\frac{2}{3}\implies 1:2. $$
Thus, the mixing ratio you need to use to combine these two chocolates into a new product that contains $90\%$ cocoa and $10\%$ sugar is one part of chocolate $A$ and two parts of chocolate $B$.