How to mathematically write: last matrix position that equals one?

47 Views Asked by At

Consider the following (4 x 5) 2D matrix:

0 0 0 0 0
0 1 1 0 0
0 0 1 1 0
0 0 0 0 0

I need to write in a mathematical language "The last column at row 3 that equals one", in this example said column is 4 (as you might imagine, the expression should work for any 2D matrix).

Is there any mathematical way to write such an expression?

Context: I'm in the unfortunate position of trying to impress a professor that forces us to write everything mathematically for his own reasons.

3

There are 3 best solutions below

0
On BEST ANSWER

Given an $m\times n$ matrix $A$ and a row number $1\le i\le m$ one could define an integer

$$ L_i=\max\{j\,\vert\,a_{ij}=1\}$$

which would represent the column number of the last entry on row $i$ which is equal to $1$.

Addendum: If no entry on row $i$ equals $1$ one could define $L_i=0$ for that row.

0
On

Usually for a matrix A we identify the elements by the symbol $$A_{ij}\quad \text{or}\quad a_{ij}$$

where $i$ is the row index and $j$ is the column index.

In your matrix for example $a_{34}=1$.

0
On

If I understand your question correctly, you're asking for some function/expression which gives the column for the last non-zero entry on a certain row of a given matrix.

I can't think of such a thing, and I don't think there is one.