# Resolution of the linear system of the correcting equations

Three unknown variables are attached to each reach n°*i*:

- in terms of water elevation: $\Delta Z^i_1$ at the upstream node
- in terms of water elevation: $\Delta Z^i_n$ at the downstream node
- in terms of discharge: $\Delta Q^i$ anywhere in the reach

Let *N* be the number of reaches in the loop. It is possible to solve the linear system composed of the 3*N* equations. But an entire backwater curve computation will be necessary, after correction of the discharges, in order to get the water elevation in each cross section of the reaches.

Therefore, the directly interesting unknowns are the $\Delta Q^i$ variables.

If the equations are written in a judicious order, some (*N*.*N*) blocs appear:

$\pmatrix{A&B&0\cr D&I&F\cr G&H&I\cr}.\pmatrix{\Delta Q\cr \Delta Z_1\cr \Delta Z_n\cr} = \pmatrix{C1\cr C2\cr C3\cr}$

Matrix . Vector = Constant

That can be written: $M.V = K$ **[8]**

*D*, *F* are diagonal matrices

*I* is the unity matrix

*H* is an upper triangular matrix with a nil principal diagonal

The discharge continuity equations at the nodes which are not downstream nodes of a loop, are placed in the first block line of the linear system (filling the *A* block). We then complete the block line with the equality relations between the water elevations at the distributory nodes (filling the *B* and *C1* blocks).

The condensation equations are placed in the second block line.

The downstream boundary conditions at the downstream reaches of the loop, and the equality relations between the upstream and the downstream water elevations of the reaches at the nodes that are not downstream nodes of a loop, are placed in the third block line.

By multiplying **[8]** with a proper transition matrix *P*:

$(P.M).V = P.K$

we get a *N* equations system in the $\Delta Q$ variable:

$A_0.\Delta Q = C_0$ **[9]**

with:

$\left\{ {\matrix{A_0 = A - B.D + \chi_0.(H.D - G)\cr
C_0 = C_1 - \chi_0.C_3\cr
\chi_0 = B.F.{\chi_1}^{-1}\cr
\chi_1 = H.F - I\cr
I = \mbox{ Unity matrix}\cr}}$

This method can only be applied if the $\chi_1$ matrix can be inverted. Fortunately this matrix can always be transformed into a triangular superior matrix with the diagonal only composed of 1. Therefore $\chi_1$ can easily be inverted through the Gauss - Jordan method. The system **[9]** is solved through the Gauss method with a partial Gauss elimination.