Obtain the indexing formula for **lower-right **and** upper-left **triangular matrices using **row-major** order and **column-major **order. Consider the cases of :

- square matrix of order
*n x n.*
- non-square matrix of order
*m x n*, *m ≠ n.*

I need a solution with explanation thanks in advance.