# Finding the Jacobian matrix & eigenvalues of a matrix

Suppose I have a 2D dynamical system with

$$\frac{dx}{dt} = f(x, v), \hspace{5mm} \frac{dv}{dt} = g(x, v)$$

My Jacobian is then given by $$\begin{pmatrix} f_x & f_v \\ g_x & g_v\end{pmatrix}$$.

I could then calculate the eigenvalues of this to get my stability.

However, what I could have labelled the equations the other way around and my stability matrix would become $$\begin{pmatrix} g_x & g_v \\ f_x & f_v\end{pmatrix}$$. In fact, there are many arrangements of this Jacobian I can have: $$\begin{pmatrix} g_v & g_x \\ f_x & f_v\end{pmatrix}$$, $$\begin{pmatrix} g_x & f_x \\g_v & f_x\end{pmatrix}$$ and so on...

So how do I know how to arrange my Jacobian?

For some of the above arrangements, we are talking about an interchanging of two rows of the matrix, and that does not leave the eigenvalues unchanged. Hence so stability of my system will change.

Of course, just calling them $$f$$ and $$g$$ is arbitrary and from what I can see at the moment, if I switch the labels, the dynamics change which should obvious not be the case.

• For all of the rearrangements, even switching which function you call "f" and which "g", you are just interchanging rows or columns and that leaves the eigenvalues unchanged. – user247327 Apr 12 '19 at 23:01
• @user247327 Does it? If I have the matrix $\begin{pmatrix} 3 & -5 \\ 7 & - 4 \end{pmatrix}$, this has complex eigenvalues according to WolframAlpha, while if I interchange the rows, I get $\begin{pmatrix} 7 & -4 \\ 3 & - 5 \end{pmatrix}$, but this has real eigenvalues! Very different stability – PhysicsMathsLove Apr 12 '19 at 23:08
• If you have a fixed structure of a system, i.e. $\dot{x}_i = f_i(x_1, \dots, x_n)$, the Jacobi matrix is always defined as $(J_{ij}) = \left ( \frac{\partial f_i}{\partial x_j} \right )$. If you rearrange equations, you'll get a matrix with rearranged rows and columns. Because you have to rearrange both, you'll have a matrix with the same spectrum. – Evgeny Apr 13 '19 at 6:45

The system is given by

$$\dot{x}=f(x,v)$$ $$\dot{v}=g(x,v).$$

The idea behind the Jacobian is that we use the Taylor expansion of the functions $$f$$ and $$g$$ evaluated at the point $$x_0$$ and $$y_0$$. The expansions are given by

$$f(x,v)\approx f(x_0,v_0)+\left.\dfrac{\partial f}{\partial x}\right|_{x=x_0,v=v_0}(x-x_0)+\left.\dfrac{\partial f}{\partial v}\right|_{x=x_0,v=v_0}(v-v_0)$$ $$g(x,v)\approx g(x_0,v_0)+\left.\dfrac{\partial g}{\partial x}\right|_{x=x_0,v=v_0}(x-x_0)+\left.\dfrac{\partial g}{\partial v}\right|_{x=x_0,v=v_0}(v-v_0).$$

If $$x_0,v_0$$ is an equilibrium point we know that $$f(x_0,v_0)=g(x_0,v_0)=0$$. If we introduce the new state variables $$z_1=x-x_0$$ and $$z_2=v-v_0$$ we can rewrite an approximate version of the initial equation as

$$\dot{z}_1=\left.\dfrac{\partial f}{\partial x}\right|_{x=x_0,v=v_0}z_1+\left.\dfrac{\partial f}{\partial v}\right|_{x=x_0,v=v_0}z_2$$ $$\dot{z}_2=\left.\dfrac{\partial g}{\partial x}\right|_{x=x_0,v=v_0}z_1+\left.\dfrac{\partial g}{\partial v}\right|_{x=x_0,v=v_0}z_2.$$

This is a linear system with the system matrix (which is the Jacobian of the nonlinear system) evaluated at $$x_0,v_0$$.

$$J=\begin{bmatrix} \dfrac{\partial f}{\partial x} & \dfrac{\partial f}{\partial v}\\ \dfrac{\partial g}{\partial x} & \dfrac{\partial g}{\partial v}\\ \end{bmatrix}_{x=x_0,v=v_0}$$

If you permute the columns or the rows nothing will change algebraically, but the correspondence with the variables $$z_1$$ and $$z_2$$ will change.