Record matrix of M x N, where m - the number of rows and n - the number of columns of the object.In the simplest case, find the sum of all elements of the matrix, perform sequential addition of its value.The first line of the first element of the second fold to get the results, add a third, the last row value.Further, the sum of elements of the first row in the same manner adds the value of the second and all subsequent rows of the matrix.And by adding the numbers take into account their character.Thus, the values ​​of 4 and 5 give the amount of 1, -5 and + -11 = -6.
Determine the amount of elements on the main diagonal of the matrix.The main diagonal of the matrix it extends from upper left to lower right.All elements stand on this "direct" fold together.After determining the sum of all the numbers on the main diagonal, write down the final result.
Similarly, calculate the sum of the elements on the secondary diagonal of the matrix.Secondary diagonal is called "direct" extending from the upper left corner of the matrix in the lower right.All values ​​of the object lying on a given diagonal, fold together and record the result.
Find the sum of elements, standing below the main diagonal.To do this, perform on the main diagonal line, cut-off values ​​of the diagonal and the top of the object.Find the sum of the elements located below the line.To this end, it is desirable to add the value line.From the first row below the main diagonal take only element standing there, fold it with the first element of the next row, and then to add the resulting sum value of the second element.Next go to the elements in the third row and so on until the last addition made, uncrossed matrix element below the main diagonal.
To calculate the sum of the matrix elements, standing above the main diagonal, follow the same steps, only consider the terms as members standing above the crossed-out diagonally.