# Linear algebra in Lewis structures?

In general, I have come across a phenomenon in chemistry where solutions to certain types of problems can often seem frustrating when trying to work out by hand, as they seem to depend on each other far too much, but are actually easily representable formally using a linear relation.

In general, I have noticed that when I am trying combinations of things to see if it works that these relations appear.

For example, balancing an equation: $$\ce{C3H8 + O2 -> CO2 + H2O}$$

$$\left[ \begin{array}{c|ccc|c} & \ce{C3H8} & \ce{O2} & \ce{CO2} & \ce{H2O}\\ \hline \ce{C} & 3 & 0 & -1 & 0 \\ \ce{H} & 8 & 0 & 0 & -2 \\ \ce{O} & 0 & 2 & -2 & -1 \\ \end{array} \right]$$

Row reducing the matrix gives a solution vector of $$\left[ \begin{array}{c|c} \ce{C3H8} & -1/4\\ \ce{O2} & -5/4\\ \ce{CO2} & -3/4 \\ \end{array} \right]$$

$$\ce{H2O}$$ has an implied coefficient of $$-1$$, so in order to make the coefficients integers, we will multiply everything by $$-4$$, and get $$\ce{1C3H8 + 5O2 -> 3CO2 + 4H2O}$$ which is correctly balanced. There is no guesswork in doing this.

Similarly, problems involving Hess's law can be solved using linear combinations: $$\begin{array}{cccc} \ce{CH4_{(g)} + 2O2_{(g)} -> CO2_{(g)} + 2H2O_{(l)}} & {\Delta}\ce{H} = & \pu{-890 kJ mol^{-1}} & (1)\\ \ce{2CO_{(g)} + O2_{(g)} -> 2CO_{(g)}} & {\Delta}\ce{H} = & \pu{-566 kJ mol^{-1}} & (2) \\ \ce{2CH4_{(g)} + 3O2_{(g)} -> 2CO_{(g)} + 4H2O_{(l)}} & {\Delta}\ce{H} = & x\; \pu{kJ mol^{-1}} & (3) \end{array}$$

$$\left[ \begin{array}{c|cc|c} & \pu{1} & \pu{2} & \pu{3} \\ \hline \ce{CH4_{(g)}} & -1 & 0 & -2\\ \ce{O2_{(g)}} & -2 & -1 & -3\\ \ce{CO2_{(g)}} & +1 & +2 & 0\\ \ce{H2O_{(l)}} & +2 & 0 & +4\\ \ce{CO_{(g)}} & 0 & -2 & +2 \end{array} \right]$$ Row reducing the matrix gives a solution vector of $$\left[ \begin{array}{c|c} \pu{1} & +2\\ \pu{2} & -1\\ \end{array} \right]$$ The dot product with the original enthalpy vector then becomes the desired enthalpy of change, $$x$$: $$x = \left[ \begin{array}{c} +2 \\ -1 \end{array} \right] \left[ \begin{array}{cc} -890 & -566 \end{array} \right] = \pu{-1214 kJ mol^{-1}}.$$ Again, there is no guesswork. A computer could do this.

Is there a similar linear relation possible for expressing the possible number(s) of bonding electrons for each atom in a Lewis structure? (By possible number, I mean that it follows the octet rule if applicable, or in the case of hydrogen only forms a single bond.)

If so, how could it be set up?

• This is a good question, but I think it would be better suited to post this on math.stackexchange.com, and explain the rules of lewis structures in your question. – Abhigyan Chattopadhyay Nov 9 '18 at 15:58
• @AbhigyanC Will do, though Math.SE doesn't have chem support :( – Liam White McShane Nov 9 '18 at 16:41
• To give a concrete example is your question about: from the structure N-N-O how many ways can I make bonds (here 2: N-triple-N-single-O vs N=N=O) or: I have C3H6 and how many octet rule obeying isomers (a ring vs propene)? – user213305 Nov 9 '18 at 16:54
• @AbhigyanC Crossposting is discouraged - if post is closed here it may be migrated. I think it has nothing to do with matrices and whatnots. Thing is, there are molecules that don't follow any rules. – Mithoron Nov 9 '18 at 17:47
• In agreement with @AbhigyanC I'd say this in essence a graph theoretical problem that will have a known mathematical solution. However I disagree with AbhigyanC that it will be feasible to explain the "rules of Lewis structures" on MSE. I expect that this will be a medium sized project of months rather weeks and there will be continuous requests to go back to CSE. At the same time I suggest to try to check the literature, there is a huge body of graph theoretical works in chemistry. Ivan Gutman might be an expert to name at this stage. – Raphael J.F. Berger Nov 10 '18 at 12:14