When I checked the solutions I found that there was a formula to be derived for this question . But how one can derive this formula?

s=(n^2(n^2+1)/2)/n

The formula falls out very naturally. Every row has some sum S, so the sum over the matrix is nS. However we also know that the sum over the matrix is 1+2+\ldots+n^2. So we have

\begin{aligned}
nS &= 1+2+\ldots+n^2 \\
nS &= \frac{n^2 (n^2+1)}2
\end{aligned}

solve for S to get

S = \frac{n^2 (n^2+1)}{2n} = \frac{n (n^2+1)}{2}.

1 Like

Thank you…Learnt something new today.

Consider accepting the answer since it answered your question.

2 Likes