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?