#### Abstract

The vec operator transforms a matrix to a column vector by stacking each column on top of the next. It is useful to write the vec of a block-structured matrix in terms of the vec operator applied to each of its component blocks. We derive a simple formula for doing so, which applies regardless of whether the blocks are of the same or of different sizes.

#### 1. Introduction

The vec operator, applied to a matrix , produces a column vector, denoted by stacking each column of on top of the following column [1]. Here, we consider the result of applying the vec operator to block-structured matrices, including the case in which the blocks differ in size. Such a matrix is called unbalanced [2]. Previous studies of the vec operator and Kronecker product applied to block-structured matrices [2, 3] have not addressed this problem.

In many applications, block-structured matrices arise because the blocks represent different states or processes. In general, these blocks will be of different sizes and may depend on different parameters. If the vec operator is applied to such a matrix, it may be helpful to write the result in terms of the vec of each of the component blocks. This calculation arises, inter alia, in applications of matrix calculus [4] in demography and ecology, including nonlinear matrix population models [5] and finite-state Markov chains [6, 7]. In such models (we give an example below), the outcome is often a vector-valued function of the same matrix, and the matrix has an inherent block structure.

Our goal is to write the vec of the unbalanced block-structured matrix as a linear combination of the vec operator applied to each of the component blocks. Although the solution is simple, it is widely useful, so we present it here.

#### 2. Results

If the matrixcontainsblocks, we write it as the sum ofmatrices, each containing one of the blocks surrounded by zero matrices, as in where,, and and the corresponding zero matrices may be of different (but compatible) sizes. The vec of is the sum of the vec operator applied to each of the component matrices in (2). A generic member of this set of component matrices can be written as in the following result.

Theorem 1. Let be anblock-structured matrix, with the dimensions of the blocks indicated as subscripts, written where and and ,,,, or any combination, may be zero. Then where

Proof. To convert to requires the addition ofrows of zeros above,rows of zeros below,columns of zeros to the left, andcolumns of zeros to the right of . This is accomplished by multiplying on the left by and on the right by, so that Applying the vec operator to (6), using a well known result of Roth [8], yields (4).

Remark 2. We said it was simple.

#### 3. Applications

Here are several examples of interest, to demonstrate the formulation of the block-structured matrices and the result of applying the vec operator.

(1) The transition matrix for a finite-state absorbing Markov chain withtransient states andabsorbing states can be written as a block-structured matrix. Numbering the states so that the transient states precede the absorbing states yields a canonical form for the (column-stochastic) transition matrix (e.g., [9]),The matrixdescribes transitions among the transient states anddescribes transitions from transient states to absorbing states. Suppose thatis a vector-valued () differentiable function of and thatandare differentiable functions of a vector ()of parameters. In demographic and ecological applications,might describe transitions and survival among life cycle stages of some organism, and might describe transitions to different causes of death (e.g., [7, 10]).

Following [4], the derivative ofwith respect tois thematrix To obtain we must apply the vec operator to the block-structured matrix. Applying the results (5) gives (noting thatandare both zero). Applying the vec operator and the chain rule gives In applications, it is likely that parameters of interest are defined in terms of their effects onand; (10) makes it possible to incorporate that dependence easily into the necessary derivative of the block-structured matrix.

We note that the intensity matrix of a continuous-time absorbing Markov chain also has a block structure (e.g., [9, Chap. 8]); applications of matrix calculus to such models [6] will benefit from the results presented here.

(2) The transition matrix of an absorbing Markov chain is a special case of the canonical form of a reducible nonnegative matrix [11]. Ifis a reducible matrix, it can be written Each of the diagonal blocksis square and irreducible (or azero matrix). The division into diagonal blocks corresponds to a division of the vector space upon whichoperates into invariant subspaces.

(3) A balanced block-structured matrix, in which all blocks are the same size, is a special case of an unbalanced matrix. Theorem 1 provides a simple result for the vec of such a matrix. Consider thematrix where are each of dimension. This case is considered by [3].

From (5)-(6) we have where The vec ofis

#### 4. Conclusions

The vec operator, by transforming a matrix into a vector, is useful in many applications [1]. When the matrix is block structured and the blocks represent various processes involved in the application, it is convenient to be able to express the vec of the matrix as a linear combination of the vec operator applied to the component blocks. We have shown how to do so and described a few examples, but these do not exhaust the potential uses of the result.

#### Competing Interests

The authors declare that they have no competing interests.

#### Acknowledgments

This research was supported by ERC Advanced Grant 322989, NSF Grant DEB-1257545, and NWO-ALW Project ALWOP.2015.100.