Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
matrix derivative

Subject: matrix derivative

From: leo nidas

Date: 19 Mar, 2010 10:04:06

Message: 1 of 2


I am confused with something rather simple which is embarrassing..

Let G=A(Y-μ).

G is p by 1 matrix depending on β=[β0 β1 β(p-1)]'. (β is p by 1)
Α is p by n matrix depending on β
μ is n by 1 matrix depending on β
Υ is n by 1 matrix independent of β

I thought the derivative of G with respect to β (let dG) would be

dG=(dA)*(Y-μ)-Α*dμ.

which is obviously wrong because the dG should be a p by p matrix.

Α*dμ is p by p (which is encouraging!)
but (Y-μ) is n by 1 and the dimensions would not agree.

I checked the following:

http://en.wikipedia.org/wiki/Matrix_calculus

but did't get it..

I checked my calculus book of Ross and Finley and doesn't have anything.
I checked my algebra book of Gilbert Strang and doesn't have anything.
I searched the net with no luck
and I decided to make an example in matlab, so just see how can I get the derivative of a matrix with respect to a vector I typed

>> syms b0 b1 real
>> b=[b0 b1]';
>> A=[b0*b1 b0*b1];
>> diff(A,'b')
 
ans =
 
[ 0, 0]

which is not what I want. diff just fount=d the difference of the elements right? I would like the 2 by 2 derivative matrix of A with respect to b.

My final goal is to get right the derivative of G=A(Y-μ) right.

Thanx in advance for any answers.

Subject: matrix derivative

From: Sadik

Date: 19 Mar, 2010 11:14:04

Message: 2 of 2

Hi Leo,

Please take a look at the following:

http://books.google.com/books?id=PDjIV0iWa2cC&pg=PA152&lpg=PA152&dq=%22derivative+of+a+matrix+with+respect+to+a+vector%22&source=bl&ots=kh6gIGOXy1&sig=qZEjAv7Yq9ac61p1aPxt2T-TeUc&hl=en&ei=A1ujS_yBAdKztgeRz5ydCg&sa=X&oi=book_result&ct=result&resnum=4&ved=0CBYQ6AEwAw#v=onepage&q=%22derivative%20of%20a%20matrix%20with%20respect%20to%20a%20vector%22&f=false

It basically says that it will be a three-dimensional matrix. Each 2D "page" of this 3D matrix will be the derivative of the matrix with respect to an element of the vector. So, if you have an nxn matrix A and an mx1 vector x, the result of the derivative of A with respect to x, dA/dx, would be an nxnxm matrix where

dA/dx(:,:,1) is dA/dx1
dA/dx(:,:,2) is dA/dx2

and so on.

Best.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us