# Time complexity of matrix subtraction

If I have (I-Z) where I is a 3x3 identity matrix while Z is a 3x3 lower triangular matrix, how many subtractions that I should count from this process? Is it costs K subtractions or (K^2+K)/2 subtractions?

Thank you.

Huda

Since you are subtracting $$Z$$ from $$I$$, you must compute the lower part of the matrix. If it was reversed, you only had to compute the new diagonal. The total number of subtractions is therefore $$(k^2 + k)/2$$.
• I don't understand what do you mean by 'note the −k, as you are counting elements twice'. Lets me show you how I got $(K^2+K)/2$. I found that the number of subtractions is 1 in the first row, 2 subtractions in the second row, and 3 subtractions in the third row. Using mathematical induction, I got $1 + 2 + 3 = \sum_{i=1}^K i = \frac{K(K+1)}{2}$ – Nurulhuda B Ismail Oct 3 at 15:16
• Sorry my bad, it's indeed $+k$. In any case, it's definitely not $k$ subtractions. – STanja Oct 3 at 21:12