Matrix differentiation involving exponential function

123 Views Asked by At

The function of interest is $\textbf{X}'\exp[\textbf{X} \boldsymbol{\beta}]$. $\textbf{X}$ is a $n \times K$ matrix. The columns of $\textbf{X}$ contain $K$ variables each with $n$ observations. That is, $\textbf{x}_{k} = [x_{ik}, \ldots, x_{nk}]'$ is a column in $\textbf{X}$. $\boldsymbol{\beta}$ is a $K \times 1$ parameter vector such that $\boldsymbol{\beta} = [\beta_{1}, \ldots, \beta_{K}]'$. I need to differentiate this function with respect to $\boldsymbol{\beta}$. Since the function $\textbf{X}'\exp[\textbf{X} \boldsymbol{\beta}]$ is $K \times 1$ and parameter vector $\boldsymbol{\beta}$ is $K \times 1$, the resulting derivative in matrix form will be $K \times K$. I propose that the derivative uses the denominator layout. I happen to end up using the Hadamard product but struggle to get the final result.

1

There are 1 best solutions below

0
On

Define some new variables $$\eqalign{ y &= X\beta &\implies dy = X\,d\beta \cr e &= \exp(y) &\implies de = e\odot dy \cr E &= {\rm Diag}(e) &\implies de = E\,dy \cr }$$ Write the function of interest in terms of these variables.
Then find its differential and gradient. $$\eqalign{ f &= X^Te \cr df &= X^Tde = X^TE\,dy = X^TEX\,d\beta \cr \frac{\partial f}{\partial\beta} &= X^TEX \cr }$$ The trick is to use a Diag operation to eliminate the Hadamard product.