This is the way you can get the solution.

Let us Consider the number of times a specific student contributes to the sum on the RHS.

If a student has i friends, then he will contribute one to the total in C1, again in C2, again in C3, up until again in Ci. I.e. it will contribute a total of i to the overall sum (broken up over multiple parts of the summation).

Let

We have then the total sum is equal to:

Now, Notice that Ai is equal to the sum of the ith row whereas Cj is equal to the sum of the jth column. Stopping at 99 for the sum for Cj is fine since C100=0 since no one can possibly be friends with 100 people (there are only 99 people for each person to be friends with).

So, the LHS summation is adding everything row by row whereas the RHS summation is adding everything column by column.