MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: matrix differentiation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43797] Re: [mg43792] matrix differentiation
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Mon, 6 Oct 2003 02:07:50 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On Saturday, October 4, 2003, at 03:05 PM, Bp Sudheer wrote:

> Hi
>
>    I want to differentiate an expression like
>
> f(y) = X'{(w'*X)(X'*w')}X with respect X where each of these elements  
> are
> matrices.
>
> X is of the order N X 1 matrix
> w is of the order N X N matrix
> f(y) is of the order of 1 X 1 matrix
>
> X' is the transpose of X and w' is the transpose of w
>
> if X = [x0 x1] ( for eg ) and say N = 2
>
> Can any one help me how do i get the gradient of f(y) with respect to X
>
> Regds
> Sudheer
>
>
>


One can try brute force:


X=Array[x,{2,1}];


W=Array[w,{2,2}];


Z=(Transpose[X].(Transpose[W].X).(Transpose[X].Transpose[W]).X)// 
Simplify


{{(w[1, 1]*x[1, 1]^2 + x[2, 1]*(w[1, 2]*x[1, 1] + w[2, 1]*x[1, 1] +  
w[2, 2]*x[2, 1]))^2}}


Map[D[Z,#]&,Flatten[X]]//Simplify


{{{2*(2*w[1, 1]*x[1, 1] + (w[1, 2] + w[2, 1])*x[2, 1])*(w[1, 1]*x[1,  
1]^2 +
       x[2, 1]*(w[1, 2]*x[1, 1] + w[2, 1]*x[1, 1] + w[2, 2]*x[2, 1]))}},
   {{2*(w[1, 2]*x[1, 1] + w[2, 1]*x[1, 1] + 2*w[2, 2]*x[2, 1])*(w[1,  
1]*x[1, 1]^2 +
       x[2, 1]*(w[1, 2]*x[1, 1] + w[2, 1]*x[1, 1] + w[2, 2]*x[2, 1]))}}}

Andrzej Kozlowski
Yokohama, Japan
http://www.mimuw.edu.pl/~akoz/
http://platon.c.u-tokyo.ac.jp/andrzej/


  • Prev by Date: Re: Re: negative pattern matching anyone?
  • Next by Date: Re: Signal Processing Help please..
  • Previous by thread: matrix differentiation
  • Next by thread: Re: matrix differentiation