Question about null space balancing method
Fortunately this issue was just caused by a small oversight. In the midst of so many coefficients, you accidentally skipped the second nitrogen atom in $\ce{NH4NO3}$, which changes the fifth element in the fourth row from 1 to 2. The correct composition matrix is then:
$$\begin{bmatrix}
3 &amp; 8 &amp; 1 &amp; 12 &amp; 4 &amp; 2 \\ 
1 &amp; 0 &amp; 0 &amp; 1 &amp; 0 &amp; 0 \\ 
4 &amp; 4 &amp; 3 &amp; 40 &amp; 3 &amp; 1 \\ 
0 &amp; 2 &amp; 1 &amp; 3 &amp; \color{red}{\textbf{2}} &amp; 0 \\ 
0 &amp; 1 &amp; 0 &amp; 12 &amp; 0 &amp; 0
\end{bmatrix}$$
After complementing with the bottom row $\begin{bmatrix} 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 1 \end{bmatrix}$ and inverting the matrix, we obtain:
$$\frac{1}{96}\begin{bmatrix}
3 &amp; 79 &amp; 2 &amp; -9 &amp; -14 &amp; -8 \\ 
36 &amp; -204 &amp; 24 &amp; -108 &amp; -72 &amp; -96 \\ 
39 &amp; -477 &amp; 90 &amp; -213 &amp; -246 &amp; -168 \\ 
-3 &amp; 17 &amp; -2 &amp; 9 &amp; 14 &amp; 8 \\ 
-51 &amp; 417 &amp; -66 &amp; 249 &amp; 174 &amp; 168 \\ 
0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 96
\end{bmatrix}$$
Finally, transposing the rightmost column and dividing its coefficients by 8, the result is  $\begin{bmatrix} -1 &amp; -12 &amp; -21 &amp; 1 &amp; 21 &amp; 12 \end{bmatrix}$, exactly as expected.
Thank you for the linked article! Hopefully others may find it useful. If you're into linear algebra applied to chemistry, I recommend you take a peek into chemical reaction network theory!