Generals 1998 7

From PlasmaWiki

Jump to: navigation, search

[edit] Computational Quickie

We can solve working backwards from the bottom. The last row of the matrix only multiplies one element:

annxn = yn


This can be inverted by division:

xn = yn / ann


The next line up only involves this and one other element:

an − 1,n − 1xn − 1 + an − 1,nxn = yn − 1


Solving for xn − 1, the only unknown:

x_{n-1}=\left(y_{n-1}-a_{n-1,n}x_{n}\right)/a_{n-1,n-1}


We can see that this process can be repeated for every element:

x_{i}=\left(y_{i}-a_{i,i+1}x_{i+1}\right)/a_{ii}


So using this and xn = yn / ann, we have a solution for all x. This requires N divisions, N − 1 multiplications, and N − 1 subtractions, for a total of 3N − 2 operations.

Personal tools