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$>
References: <i2he90$21a$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1280110744 13771 (26 Jul 2010 02:19:04 GMT)
NNTP-Posting-Date: Mon, 26 Jul 2010 02:19:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: comp.soft-sys.matlab:656050

"Antony " <> wrote in message <i2he90$21a$>...
> 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


and substituting z=K*X-B gives

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