I have come across a $N \times N$ square matrix of the following structure
\begin{bmatrix} m_1 & m_2 & m_3 & \ldots & m_{N-1} & m_N \\ 1 & -1 & 0 & \ldots & 0 & 0 \\ 0 & 1 & -1 & \ldots & 0 & 0 \\ \vdots & \vdots & \vdots & \ddots & \vdots & \vdots \\ 0 & 0 & 0 & \dots & 1 & -1 \end{bmatrix}
where the $m_i \neq 0$s are real constants. Is there an analytic expression for the inverse of this matrix?
Assuming the matrix is invertible, its inverse can be expressed as follows. Define $$ A = \begin{bmatrix} m_1 & m_2 & m_3 &.....& m_{N-1} & m_N \\ 1 & -1 & 0 &.....& 0 & 0 \\ 0 & 1 & -1 &.....& 0 & 0 \\ . & . & . &.....& . & . \\ . & . & . &.....& . & . \\ . & . & . &.....& . & . \\ 0 & 0 & 0 &.....& 1 & -1 \end{bmatrix}. $$ We can write $A = M - I + xy^T$, where $I$ is an identity matrix, $$ M = \pmatrix{0\\1&0\\&\ddots&\ddots\\&&1&0}, \quad x = (1,0\dots,0)^T, \quad y = (m_1 + 1,m_2,\dots,m_N). $$ Using the Sherman Morrison formula, we have $$ A^{-1} = (M - I)^{-1} - \frac{(M - I)^{-1}xy^T(M - I)^{-1}}{y^T(M - I)^{-1}x}. $$ $(M-I)^{-1}$ is easy to compute: since $M$ is nilpotent of order $N$, we have $$ (M - I)^{-1} = -I - M - \cdots - M^{N-1} = \pmatrix{-1&0\\ \vdots & \ddots \\ -1&\cdots &-1}. $$