let and where are constants w.r.t. all then thus:

similarly if is a constant vector, then:

also, with a little bit more effort, you can show that for any constant matrix we have:

now solving the problem is very easy:

now in (4): the derivative of is clearly 0. by (1) the derivative of is by (2) the derivative of is finally by (3) the derivative

of is thus:

recall that if where are scalar functions of then where is a defined by using this youare you sure it's notinstead ?

can very easily show that if is a constant matrix, then

thus by (5) and (6):