-1
$\begingroup$

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

$\endgroup$
1
$\begingroup$

It’s a 3x3 matrix, so it can be done in constant time O(1). I can’t see where a “k” comes into this problem.

$\endgroup$
0
$\begingroup$

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$.

$\endgroup$
  • $\begingroup$ 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}$ $\endgroup$ – Nurulhuda B Ismail Oct 3 at 15:16
  • $\begingroup$ Sorry my bad, it's indeed $+k$. In any case, it's definitely not $k$ subtractions. $\endgroup$ – STanja Oct 3 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.