# Using FindRoot on a system of equations with a singular Jacobian

I have a system of $$n$$ ODEs $$\frac{dx_i}{dt} = f_i(x_1.\ldots,x_n)$$, which I would like to solve at steady state.

However, $$\sum_{i} x_i = 1$$, and so it's actually only an $$n-1$$-dimensional system. As a result, the jacobian for my system is singular everywhere (which FindRoot tells me when I try to use it). Is there anyway I can get Find Root to work with this, without rewriting the equations in terms of the $$n-1$$ variables?

For example, what I would like to do is the following:

eqn1 = y-2x*y;
eqn2 = 2x*y-y;
FindRoot[{eqn1==0,eqn2==0,x+y==1},{{x,0.2},{y,0.2}}].


I know I can use NSolve instead in this scenario, but for the system I'm actually working with, NSolve doesn't compute it in a reasonable time.

This system doesn't actually throw the Jacobian error, but it is a similar system, so I imagine if I can do it for this system, my system of interest will work with the same method.

• Please provide code (InputForm) for a concrete example that demonstrates the issue. – Bob Hanlon May 26 at 14:04
• Have a look at the Affine Covariant Newton solver and it's options. – user21 May 26 at 14:28
• {min, arg} = Minimize[{eqn1^2 + eqn2^2, x + y == 1}, {x, y}] – Bob Hanlon May 26 at 15:38
• "Minimize finds the global minimum of f subject to the constraints given" and "NMinimize always attempts to find a global minimum of f subject to the constraints given"; whereas, FindMinimum "searches for a local minimum". I would only use FindMinimum if neither Minimize nor NMinimize were successful. – Bob Hanlon May 26 at 15:56
• Maybe obvious, but have you tried Solve[{eqn1 == 0, eqn2 == 0, x + y == 1}, {x, y}]? – Roman May 26 at 16:37

Introduce an additional variable (here a) that you use nowhere in the equations. (It's just to provide three variables for three equations.)

eqn1 = y - 2 x*y;
eqn2 = 2 x*y - y;
FindRoot[{eqn1 == 0, eqn2 == 0, (x + y - 1) == 0},
{{x, 0.2}, {y, 2}, {a, 2}}]

(*   {x -> 0.5, y -> 0.5, a -> 2.}   *)

eqn1 = y - 2 x*y;
eqn2 = 2 x*y - y;
FindRoot[{eqn1 == 0, eqn2 == 0, (x + y - 1) == 0},
{{x, 1.2}, {y, 2}, {a, 1}}]

(*   {x -> 1., y -> -7.38374*10^-28, a -> 1.}   *)