[R] Solve non-linear equatuion, grid search... [Was] RE: minimization of a quadratic form with some coef fixed and someconstrained

Yingfu Xie Yingfu.Xie at sekon.slu.se
Thu Aug 10 16:08:15 CEST 2006

Hello, Berwin,

Thanks a lot for answering! I prefer the first method, which seems
easier to carry out. So, what I need now is some method to solve the
non-linear equation
c'(M_11-lam*I)^(-1) (M_11-lam*I)^(-1)c=1
for lam, where c is a vector, M_11 is a symmetric matrix and I is the
identity matrix.
I searched the R archive somehow, but didn't find anything valuable. Is
there any function in R available for this problem? I am grateful of any

When c=0, my problem reduces to the typical minimization of b'M_11b
w.r.t b'b=1. The solution is the normalized eigenvector associated with
the minimum eigenvalue of M_11, right?


PS: There is a type error in the first condition for b: the '+' should
write to '-'.

-----Original Message-----
From: Berwin A Turlach [mailto:berwin at bossiaea.maths.uwa.edu.au] On
Behalf Of Berwin A Turlach
Sent: den 10 augusti 2006 03:57
To: Yingfu Xie
Cc: Rolf Turner; r-help at stat.math.ethz.ch
Subject: Re: [R] minimization a quadratic form with some coef fixed and

>>>>> "YX" == Yingfu Xie <Yingfu.Xie at sekon.slu.se> writes:

    YX> Thanks for reply! But I think that solution is right without
    YX> the constrain b'b=1. With this constrain, the solution is not
    YX> so simple. :(
But simple enough. :)

Write down the Lagrange function for the problem.  Say, 'lam' is the
Lagrange parameter for enforcing the constraint b'b=1.  Then, using
Rolf's notation:
    RT> [...]  Write M as

    RT> | M_11 c |
    RT> | c'   m |

Then the system of equations that b and the Lagrange parameter have to
fulfill is:

        b = (M_11 + lam*I)^{-1} c   (with I being the identity matrix)
and   lam = b' M_11 b - b'c

You can either use the first equation and do a (grid) search for the
value of 'lam' that gives you b'b=1 (could be negative!), or start
with lam=0 and then alternate between the two equations until

At least I think that this will solve your problem. :)  Thinking a bit
about the geometry of the problem, I actually believe that if c=0, you
might have an identifiability problem, i.e. there are at least two 
solutions, or, depending on M_11, infinitely many.

Hope this helps.



========================== Full address ============================
Berwin A Turlach                      Tel.: +61 (8) 6488 3338 (secr)   
School of Mathematics and Statistics        +61 (8) 6488 3383 (self)

The University of Western Australia   FAX : +61 (8) 6488 1028
35 Stirling Highway                   
Crawley WA 6009                e-mail: berwin at maths.uwa.edu.au
Australia                        http://www.maths.uwa.edu.au/~berwin


This message has been scanned by F-Secure Anti-Virus for Mic...{{dropped}}

More information about the R-help mailing list