How to differentiate a matrix?

143 Views Asked by At

The problem I am working on is as such: $q$ is a matrix with $q_{ij}$ corresponding to the delivery by vendor $i$ at location $j$. I wish to get a cost optimization using Lagrangian multipliers. So all my elements in q are variables, but their sum across the row is constant, i.e. the ith vendor delivers a fixed number of deliveries. This is in fact another equation in my optimization problem that I had written as Aq = c. A is a matrix of ones and c is a constant vector.

I am trying to get the Lagrangian in a convex optimization problem. One of the inequalities I have is $g(q) = q - \mu \geq 0$.

$q$ here is an m x n matrix of variables and $\mu$ is a constant m x n matrix.

How would I find $\nabla{g(q)}$?

My initial method was that since $\mu$ is a constant matrix, it would vanish when I differentiate the expression. But it seems like that's wrong? Can anyone please help me out?

Edit 1: I want the differentiation of g(q) with respect to q.

Edit 2: Problem context added.