Suppose we have to square upper triangular matrices that we want to multiply using the following code:
The question is to find the total number of multiplications. I noticed that every time the number of multiplications get decreased by 1 in each run. So the total number of multiplication is as follows:
$$[1+2+\cdots+n] + [1+2+\cdots+(n-1)] + \cdots + [1]$$
Question: In a solution, they say the total number of multiplications is $n(n + l)(n + 2)/6$, can you please explain how they got this number?
