Consider the $m \times n$ matrix $$ \mathbf{A} = \begin{bmatrix} A_{11} & A_{12} & \cdots & A_{1n} \\ A_{21} & A_{22} & \cdots & A_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ A_{m1} & A_{m2} & \cdots & A_{mn} \end{bmatrix} $$ such that $\mathbf{A} \in \mathbb{R}^{m\times n}$. I can define a function $f : \{1,2,\dots,m\} \times \{1,2,\dots,n\} \mapsto \mathbb{R}$ that returns the element in the $i^{\text{th}}$ row and $j^{\text{th}}$ column of $\mathbf{A}$ as $$ f(i,j) = A_{ij} $$ Now suppose that I define the ragged matrix $$ \mathbf{A} = \begin{bmatrix} A_{11} & A_{12} & \cdots & A_{1n_{1}} \\ A_{21} & A_{22} & \cdots & A_{2n_{2}} \\ \vdots & \vdots & \ddots & \vdots \\ A_{m1} & A_{m2} & \cdots & A_{mn_{K}} \end{bmatrix} $$ where $n_1,n_2,\dots,n_K \in \mathbb{N}$ and $n_i \neq n_j \ \forall i \neq j$. Is there a similar way to define a function $f$ to index this ragged matrix?

My initial attempt at this is as follows: first, define a function $M : \{1,2,\dots,m\} \mapsto \mathbb N$ that returns the number of elements in the $i^{\text{th}}$ row. Next, define $g : \{1,2,\dots,m\} \mapsto \mathbb{R}^{M(i)}$ that returns the elements in the $i^{\text{th}}$ row. I am stuck here because I am aware that the notation $g : \{1,2,\dots,m\} \mapsto \mathbb{R}^{M(i)}$ doesn't really make sense. I think the function $f$ will consist of some composition of $g$ with $M$, but I am not sure.


1 Answer 1


The hard part is just defining the set of index pairs. Let

$$ I = \{ (i,j) : i \in \{1,2,\ldots,m\} \land j \in \{1,2,\ldots,n_i\} \}. $$

Then define $f : I \to \mathbb R$ by $f(i,j) = A_{ij}.$

Actually making sense of the definition of the "ragged matrix" may be even harder, and representing the matrix harder still. Note how in the question the elements $A_{1n_1},$ $A_{1n_2},$ and $A_{1n_m}$ all ended up vertically aligned despite the assertion that $n_1 \neq n_2 \neq n_m \neq n_1.$ Can you write out these rows of the "matrix" in such a way that it makes sense both for the case $n_1 < n_2$ and the case $n_1 > n_2$?


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .