Q:

Mixing hot and cold taps to a desired temperature

I have a hot and cold tap which produce water at fixed temperatures $T_C$ and $T_H$ respectively. I'm want to mix the water from the taps to create a volume $V$ of water with a desired temperature $T_D$.
How do I calculate the ratio of hot to cold water needed? What's the theory behind it?

A:

Energy conservation is the thing. All starting from 1st law of thermodynamics.
No external heat $Q$ or work $W$:
$$\Delta U=Q-W=0$$
causes internal energy $U$ to remain unchanged:
$$\begin{align}
U_{after}&=U_{before}\\
U&=U_{c}+U_{h}\\
mc T&=m_{c}c T_{c}+m_{h}cT_{h}\qquad \leftarrow U=mcT\\
mT&=^*m_{c}T_{c}+m_{h}T_{h}\\
T&=\frac{m_{c}T_{c}+m_{h}T_{h}}{m}\\
T&=\frac{V_c\rho T_{c}+V_h\rho T_{h}}{V\rho}\qquad\leftarrow m=\rho V\\
T&=^{**}\frac{V_c}VT_{c}+\frac{V_h}VT_{h}\\
T&=\frac{V-V_h}VT_{c}+\frac{V_h}VT_{h}\qquad\leftarrow V=^{***}V_c+V_h\\
T&=\left(1-\frac{V_h}V\right)T_{c}+\frac{V_h}VT_{h}\\
\end{align}$$
where $_c$ is cold and $_h$ hot water.

At $^*$ we assumed specific heat capacities $c$ constant.
At $^{**}$ we assumed densities $\rho$ constant.
At $^{***}$ we assumed volumes $V$ constant (incompressible liquid).

For water at normal pressures and house-hold temperatures and small temperature differences all these assumption are good and differ only negligibly. 
The final expression gives you $V_h$, which you can put into $V=V_c+V_h$ to find the other one.

