Help a chemist do some Linear algebra, hydropnics nutrient solution concentration problem.

89 Views Asked by At

So I am a chemist, and a hydroponics hobbyist. I am using off the shelf nutrient solutions that come in a three part kit, lets call them M, G, and B. Each bottle has some percent of Nitrogen (N), Phosphorous (P), and Potassium (K). I am trying to create the formula that will tell me what amounts of each concentrate to use if I want some final concentrations of N, P, and K. All I need are the ratios, i.e. (M:G:B), as I will be scaling the formula as needed.

The concentrated solutions are thus: M = 5%N, 0%P, and 1%K; G = 2%N, 1% P, 6%K; B = 0%N, 5%P, 4%K.

Let each of M, G, and B represent the volume in mL of each solution needed then the formulas for the individual concentrations (in percents) of N, P, and K are: $$5M+2G=N(M+G)$$ $$G+5B=P(G+B)$$ $$M+6G+4B=K(M+G+B)$$

What I am looking for is M, G, and B in terms of N, P, and K.

So this seems pretty obviously ripe for some linear algebra, however every time I try to make the augmented matrix and use a matrix calculator online it gives me no solution. I tried doing the old fashioned solve and plug method, but the G keeps cancelling, and I don't know what that means... help! also thanks!

1

There are 1 best solutions below

1
On

So this problem actually does not have a solution for most values of $N, P,$ and $K$. One reason is that, given the set up of the problem, we must always have $22N + 16P + 10K = 120$. Indeed, $$\begin{split} 22N + 16P + 10K & = 22\left(\frac{5M+2G}{M+G+B}\right) + 16\left(\frac{G + 5B}{M+G+B}\right) + 10\left(\frac{M+6G+4B}{M+G+B}\right) \\ & = \frac{110M+44G}{M+G+B}+\frac{16G+80B}{M+G+B} + \frac{10M+60G + 40B}{M+G+B}\\ & = \frac{120M+120G + 120B}{M+G+B} \\ & = 120\cdot\frac{M+G + B}{M+G+B} \\ & = 120. \end{split}$$ Furthermore, the final concentration of the mixture can never be less than the smallest concentration of the three solutions or more than the largest concentration, and so we must have $0 \leq N \leq 5$, $0 \leq P \leq 5$, and $1 \leq K \leq 6$.

Now, with this being said: you can always choose two values, say $N$ and $P$, then solve for the third using $22N + 16P + 10K = 120 \iff K = \frac{120 - 22N - 16P}{10}$; if these three values then satisfy the above inequalities, there exists a solution to your problem by finding an eigenvector of the matrix $$\left(\begin{matrix} 5-N & 2-N & -N \\ - P & 1-P & 5-P \\ 1-K & 6 - K & 4 - K \end{matrix}\right) = \left(\begin{matrix} 5 & 2 & 0 \\ 0 & 1 & 5 \\ 1 & 6 & 4 \end{matrix}\right) - \left(\begin{matrix} N \\ P \\ K \end{matrix}\right)\left(\begin{matrix} 1 & 1 & 1 \end{matrix}\right)$$ corresponding to the eigenvector $0$.

As an example, plotting the inequalities $0 \leq N,P \leq 5$ and $1 \leq \frac{120 - 22N - 16P}{10} \leq 6$ yields the region

enter image description here

of $(N,P)$ values with solutions, so we can choose say $N = 2, P = 3$. Then $K = 28/10$, and Wolfram Alpha tells us that the third eigenvalue is $0$ with corresponding eigenvector $(M,G,B) = \left(\frac{2}{3},0,1\right)$, which gives the whole number ratio $2:0:3$.

Edit: Going a little further, we can actually have Wolfram Alpha give us a general formula in terms of $N$ and $P$ by having it find a zero eigenvector of $$\left(\begin{matrix} 5 & 2 & 0 \\ 0 & 1 & 5 \\ 1 & 6 & 4 \end{matrix}\right) - \left(\begin{matrix} N \\ P \\ \frac{120 - 22N - 16P}{10} \end{matrix}\right)\left(\begin{matrix} 1 & 1 & 1 \end{matrix}\right),$$ which yields the general solution $$M:G:B = -10 + 4N + 2P : 25 - 5N - 5P : -5 + N + 3P$$ in terms of $N$ and $P$ (this is just the first listed eigenvector scaled to remove denominators). Similarly, if we had chosen $N$ and $K$ the general solution is given by $$M:G:B = 8 + 2N - 2K : -20 + 3N + 5K : 28 - 5N - 3K$$ and if $P$ and $K$ are chosen the general solution is $$M:G:B = 26 - 2P - 4K : -5 - 3P + 5K : 1 + 5P - K.$$ Again, these give physically realistic solutions provided the above inequalities hold with $22N + 16P + 10K = 120$.