## 3 Balancing Chemical Equations Using Iterations
### Balancing Chemical Equations Using Iterative Methods
We also apply the following initial matrix \(X_{0}=\frac{1}{\sigma_{1}^{2}}A^{\star}\). **Example 2**. : _Consider a specific skeletal chemical equation from [10]:_

\[x_{1}\mathrm{KNO}_{3}+x_{2}\mathrm{C}\to x_{3}\mathrm{K}_{2}\mathrm{CO}_{3}+x _{4}\mathrm{CO}+x_{5}\mathrm{N}_{2} \tag{24}\]

_where the left-hand side of the arrow consists of compounds/elements called reactants, while the right-hand side comprises compounds/elements called the products. Hence, Equation (24) is formulated as the homogeneous equation \(Ax=0\), wherein \(0\) denotes the null column vector and:_

\[A=\left( \begin{array}{cccc}1&0&-2&0&0\\ 1&0&0&0&-2\\ 3&0&-3&-1&0\\ 0&1&-1&-1&0\end{array} \right) \tag{25}\]

_The results generated after the comparison of numerical results derived in Example 2 are given in Table 4, using 300 precision digits, being large enough to minimize round-off errors, as well as to clearly observe the computed asymptotic error constants in the convergence phase. Although in all practical problems, the machine precision (double precision) is enough (just like Example (1)), here, our focus is to find very accurate coefficients for the chemical equation, since a very accurate tolerance, such as \(\|X_{k}-A^{\dagger}\|_{\infty}\leq 10^{-150}\), must be incorporated._

The final exact coefficients are defined as \((x_{1},x_{2},x_{3},x_{4},x_{5})^{\mathrm{T}}=(2,4,1,3,1)^{\mathrm{T}}\). Thus,

\[2\mathrm{KNO}_{3}+4\mathrm{C}\rightarrow\mathrm{K}_{2}\mathrm{CO}_{3}+3 \mathrm{CO}+\mathrm{N}_{2} \tag{26}\]Experimental results clearly show that PM is the most efficient method for this purpose. In addition, we remark that since we use iterative methods in floating point arithmetic to obtain the coefficient, we must use the command \(\mathtt{Round}[]\) in the last lines of our written _Mathematica_ code, so as to attain the coefficients in exact arithmetic. In order to support the improvement described in Section 3, it is worth mentioning that (using Mathematica notations):

\[\mathtt{A.(Id-X.A).ConstantArray[1,n]}=\{-3.9*10^{-293},-5.0*10^{-294},2.0*10^{- 293},-0.0*10^{-295}\}\]

and \(\mathtt{A.(Id-X.A)((Id-X.A).ConstantArray[1,n])}=\{0.*10^{-295},0.*10^{-295},0. *10^{- 295},0.*10^{-295}\}\). **Example 3**. : _Now, we solve the following skeletal chemical equation from [10]:_

\[ \begin{split} x_{1}\mathrm{H}_{3}\mathrm{PO}_{4}+x_{2}\mathrm{MgSiO }_{3}+x_{3}\mathrm{CF}_{2}\mathrm{Cl}_{2}+x_{4}\mathrm{NaAlF}_{4}+x_{5}\mathrm{ KI}+x_{6}\mathrm{PbCrO}_{4}+x_{7}\mathrm{FeSO}_{4}\\ +x_{8}\mathrm{BrCl}+x_{9}\mathrm{Ca(CN)}_{2}+x_{10}\mathrm{SO}_{ 2}+x_{11}\mathrm{H}_{2},\\ \to x_{12}\mathrm{PI}_{3}+x_{13}\mathrm{MgO}_{3}+x_{14} \mathrm{Na}_{2}\mathrm{SiO}_{3}+x_{15}\mathrm{PbBr}_{2}\\ +x_{16}\mathrm{CrCl}_{3}+x_{17}\mathrm{KAl(OH)}_{4}+x_{18} \mathrm{Fe(SCN)}_{3}+x_{19}\mathrm{CaF}_{2}+x_{20}\mathrm{H}_{2}\mathrm{O} \end{split}  \tag{27}\]

_Equation (27) is formulated as a homogeneous system of linear equations with the following coefficient matrix:_

\[A_{19\times 20}=\left( \begin{array}{cccccccccccccccccccc}3&0&0&0&0&0&0&0&0&0& 0&2&0&0&0&0&-4&0&0&0&0&-2\\ 1&0&0&0&0&0&0&0&0&0&-1&0&0&0&0&0&0&0&0&0\\ 4&3&0&0&0&4&4&0&0&2&0&0&-3&-3&0&0&-4&0&0&-1\\ 0&1&0&0&0&0&0&0&0&0&0&0&-1&0&0&0&0&0&0&0\\ 0&1&0&0&0&0&0&0&0&0&0&0&-1&0&0&0&0&0&0&0\\ 0&0&1&0&0&0&0&0&2&0&0&0&-1&0&0&0&0&-3&0&0\\ 0&0&2&4&0&0&0&0&0&0&0&0&0&0&0&0&0&-2&0\\ 0&0&0&2&0&0&0&1&0&0&0&0&0&0&-3&0&0&0&0\\ 0&0&0&1&0&0&0&0&0&0&0&0&-2&0&0&0&0&0&0\\ 0&0&0&1&0&0&0&0&0&0&0&0&0&0&-1&0&0&0\\ 0&0&0&0&1&0&0&0&0&0&0&0&0&0&-1&0&0&0\\ 0&0&0&0&1&0&0&0&0&0&0&0&0&-1&0&0&0&0\\ 0&0&0&0&0&1&0&0&0&0&0&0&0&0&-1&0&0&0\\ 0&0&0&0&0&1&0&0&0&0&0&0&0&0&0&-1&0&0\\ 0&0&0&0&0&0&1&0&0&0&0&0&0&0&0&-3&0&0\\ \end{array} \right)\]

_The results of this experiment generated by using the ordinary double precision arithmetic and the stopping termination \(\|X_{k}-A^{\dagger}\|_{\infty}\leq 10^{-10}\) are illustrated in Figure 1. Note that the final coefficients obtained in exact arithmetic are equal to \((x_{1},\ldots,x_{20})^{\mathrm{T}}=\)