Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Question on the derivate /calculus of a 2-norm matrix . Thanks a lot
Date: Mon, 26 Jul 2010 02:19:04 +0000 (UTC)
Organization: Xoran Technologies
Lines: 19
Message-ID: <i2iran$deb$1@fred.mathworks.com>
References: <i2he90$21a$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1280110744 13771 172.30.248.35 (26 Jul 2010 02:19:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 26 Jul 2010 02:19:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:656050

"Antony " <mutang.bing@gmail.com> wrote in message <i2he90$21a$1@fred.mathworks.com>...
> Hi, all, I wonder how to solve the following problem:
>     Assuming g(x)=||KX-B||^2 where both K and X are matrices and B is a vector, please compute \partial{g}/\partial{x} .
> 
>    I don't know what the exact answer is. Checking some related stuffs, I think the answer might be 2K^{T}(KX-B). Could you please show me how to compute \partial{g}/\partial{x} in this problem? Or is there some website discussing such a problem? Thanks a lot.
============

You could also just use the multivariable chain rule, which says that for vector-valued functions g() and h() and the composition f(X)=g(h(X)), then

gradient(f)= gradient(h)*gradient(g)

Now just apply this with h(X)=K*X-B and g(z)=||z||^2

gradient(h)=K'
gradient(g)=2*z

and substituting z=K*X-B gives

gradient(f)= 2*K.'*(K*X-B)