Jacobian matrix and determinant

On this post you will find what the Jacobian matrix is and how to calculate it. In addition, you have several solved Jacobian matrix exercises to practice. You will also see why the determinant of the Jacobian matrix, the Jacobian, is so important. Finally, we explain the applications that this type of matrix has.

What is the Jacobian matrix?

The definition of the Jacobian matrix is as follows:

The Jacobian matrix is a matrix composed of the first-order partial derivatives of a multivariable function.

The formula for the Jacobian matrix is the following:

Jacobian matrix formula

Therefore, Jacobian matrices will always have as many rows as vector components (f_1,f_2,\ldots,f_m), and the number of columns will match the number of variables (x_1,x_2,\ldots,x_n) of the function.

As a curiosity, the Jacobian matrix was named after Carl Gustav Jacobi, an important 19th century mathematician and professor who made important contributions to mathematics, in particular to the field of linear algebra.

Example of Jacobian matrix

Having seen the meaning of the Jacobian matrix, we are going to see step by step how to compute the Jacobian matrix of a multivariable function.

  • Find the Jacobian matrix at the point (1,2) of the following function:

\displaystyle f(x,y)=(x^4 +3y^2x \ , \ 5y^2-2xy+1)

First of all, we calculate all the first-order partial derivatives of the function:

\displaystyle \cfrac{\partial f_1}{\partial x} = 4x^3+3y^2

\displaystyle \cfrac{\partial f_1}{\partial y} = 6yx

\displaystyle \cfrac{\partial f_2}{\partial x} = -2y

\displaystyle \cfrac{\partial f_2}{\partial y} = 10y-2x

Now we apply the formula of the Jacobian matrix. In this case the function has two variables and two vector components, so the Jacobian matrix will be a 2×2 square matrix:

2x2 jacobian matrix

Once we have found the expression of the Jacobian matrix, we evaluate it at the point (1,2):

\displaystyle J_f(1,2)=\begin{pmatrix} 4\cdot 1^3+3\cdot 2^2 & 6\cdot 2 \cdot 1 \\[3ex] -2\cdot 2 & 10\cdot 2-2 \cdot 1 \end{pmatrix}

And finally, we perform the operations:

\displaystyle J_f(1,2)=\begin{pmatrix}16&12\\[3ex]-4&18\end{pmatrix}

Once you have seen how to find the Jacobian matrix of a function, you can practice with several exercises solved step by step.

Practice problems on finding the Jacobian matrix

Problem 1

Compute the Jacobian matrix at the point (0, -2) of the following vector-valued function with 2 variables:

\displaystyle f(x,y)= (e^{xy}+y \ , \ y^2x)

The function has two variables and two vector components, so the Jacobian matrix will be a square matrix of order 2:

solved example of jacobian matrix

Once we have calculated the expression of the Jacobian matrix, we evaluate it at the point (0, -2):

\displaystyle J_f(0,-2)=\begin{pmatrix}e^{0\cdot (-2)}\cdot (-2)\phantom{5} & \phantom{5}e^{0\cdot (-2)} \cdot 0 +1 \\[4ex](-2)^2 & 2\cdot (-2) \cdot 0 \end{pmatrix}

And finally, we perform all the calculations:

\displaystyle \bm{J_f(0,-2)}=\begin{pmatrix} \bm{-2} & \bm{1} \\[1.5ex] \bm{4} & \bm{0} \end{pmatrix}

 

Problem 2

Calculate the Jacobian matrix of the following 2-variable function at the point (2, -1):

\displaystyle f(x,y)= (x^3y^2 - 5x^2y^2 \ , \ y^6-3y^3x+7)

First, we apply the formula of the Jacobian matrix:

\displaystyle J_f(x,y)=\begin{pmatrix}\cfrac{\phantom{5}\partial f_1}{\partial x}\phantom{5} & \phantom{5}\cfrac{\partial f_1}{\partial y}\phantom{5} \\[3ex] \cfrac{\partial f_2}{\partial x} & \cfrac{\partial f_2}{\partial y}\end{pmatrix} = \begin{pmatrix} \vphantom{\cfrac{\partial f_2}{\partial x}}3x^2y^2-10xy^2& 2x^3y-10x^2y \\[3ex] \vphantom{\cfrac{\partial f_2}{\partial x}} -3y^3 & 6y^5-9y^2x \end{pmatrix}

Then we evaluate the Jacobian matrix at the point (2, -1):

\displaystyle J_f(2,-1)=\begin{pmatrix} 3\cdot 2^2\cdot (-1)^2-10\cdot 2 \cdot (-1)^2\phantom{5} & \phantom{5}2\cdot 2^3\cdot (-1)-10\cdot 2^2\cdot (-1) \\[4ex] -3(-1)^3 & 6\cdot (-1)^5-9\cdot (-1)^2\cdot 2 \end{pmatrix}

So the solution of the problem is:

\displaystyle \bm{J_f(1,2)}=\begin{pmatrix} \bm{-8} & \bm{24} \\[1.5ex] \bm{3} & \bm{-24} \end{pmatrix}

 

Problem 3

Determine the Jacobian matrix at the point (2, -2,2) of the following function with 3 variables:

\displaystyle f(x,y,z)= \left(z\tan (x^2-y^2) \ , \ xy\ln \left( \frac{z}{2} \right)\right)

In this case the function has three variables and two scalar functions, therefore, the Jacobian matrix will be a rectangular 2×3 dimension matrix:

\displaystyle J_f(x,y,z)= \begin{pmatrix}\cfrac{\phantom{5}\partial f_1}{\partial x}\phantom{5} & \phantom{5}\cfrac{\partial f_1}{\partial y}\phantom{5} & \phantom{5}\cfrac{\partial f_1}{\partial z}\phantom{5} \\[3ex] \cfrac{\partial f_2}{\partial x} & \cfrac{\partial f_2}{\partial y} &\cfrac{\partial f_2}{\partial z}\end{pmatrix}

solved exercise jacobian matrix

Once we have the Jacobian matrix of the multivariable function, we evaluate it at the point (2, -2,2):

\displaystyle J_f(2,-2,2)= \begin{pmatrix} \vphantom{\cfrac{\partial f_2}{\partial x}}2\bigl(1+\tan^2 (2^2-(-2)^2)\bigr) \cdot 2\cdot 2 & 2\bigl(1+\tan^2 (2^2-(-2)^2)\bigr) \cdot (-2\cdot (-2)) & \tan (2^2-(-2)^2)\\[3ex] \vphantom{\cfrac{\partial f_2}{\partial x}} \displaystyle -2\ln \left( \frac{2}{2} \right) & \displaystyle 2\ln \left( \frac{2}{2} \right) &\displaystyle \frac{2\cdot (-2)}{2} \right)\end{pmatrix}

We perform all the calculations:

\displaystyle J_f(2,-2,2)= \begin{pmatrix} \vphantom{\cfrac{\partial f_2}{\partial x}}2\bigl(1+\tan^2 (0)\bigr) \cdot 4 \phantom{5} & 2\bigl(1+\tan^2 (0)\bigr) \cdot 4 & \phantom{5}\tan (0)\\[3ex] \vphantom{\cfrac{\partial f_2}{\partial x}} -2\cdot 0 & 2\cdot 0 &-2 \right)\end{pmatrix}

\displaystyle \bm{J_f(2,-2,2)=} \begin{pmatrix}\bm{8} & \bm{8} & \bm{0} \\[2ex] \bm{0} & \bm{0} &\bm{-2} \right)\end{pmatrix}

 

Problem 4

Find the Jacobian matrix of the following multivariable function at the point (π, π):

\displaystyle f(x,y)= \left( \frac{\cos (x-y)}{x} \ , \ e^{x^2-y^2} \ , \ x^3\sin (2y) \right)

In this case the function has two variables and vector components, therefore, the Jacobian matrix will be a rectangular matrix of size 3×2:

size of jacobian matrix

Secondly, we evaluate the Jacobian matrix at the point (π, π):

\displaystyle J_f(\pi,\pi)= \begin{pmatrix} \displaystyle \vphantom{\cfrac{\partial f_3}{\partial y}}\frac{-\sin(\pi-\pi)\pi-\cos(\pi-\pi)}{\pi^2} & \displaystyle\frac{\sin (\pi- \pi)}{\pi} \\[3ex] \vphantom{\cfrac{\partial f_3}{\partial y}}2\pi e^{\pi^2-\pi^2} & -2\pi e^{\pi^2-\pi^2} \\[3ex] \vphantom{\cfrac{\partial f_3}{\partial y}} 3\pi^2\sin(2\pi) & \pi^3 \cos(2\pi)\cdot 2 \end{pmatrix}

We compute all the operations:

\displaystyle J_f(\pi,\pi)= \begin{pmatrix} \displaystyle \vphantom{\cfrac{\partial f_3}{\partial y}}\displaystyle\frac{-0-1}{\pi^2} & \displaystyle\frac{0}{\pi} \\[3ex] \vphantom{\cfrac{\partial f_3}{\partial y}}2\pi e^{0} & -2\pi e^{0} \\[3ex] \vphantom{\cfrac{\partial f_3}{\partial y}} 3\pi^2\cdot 0 & \pi^3 \cdot 1 \cdot 2 \end{pmatrix}

So the Jacobian matrix of the vector-valued function at this point is:

\displaystyle \bm{J_f(\pi,\pi)=} \begin{pmatrix}\displaystyle -\frac{\bm{1}}{\bm{\pi^2}} & \bm{0} \\[3ex] \bm{2\pi} & \bm{-2\pi}\\[3ex]\bm{0} & \bm{2\pi^3} \right)\end{pmatrix}

 

Problem 5

Calculate the Jacobian matrix at the point (3,0,π) of the following function with 3 variables:

\displaystyle f(x,y,z)= \left(xe^{2y}\cos(-z) \ , \ (y-2)^3\cdot \sin\left(\frac{z}{2}\right) \ , \ e^{2y}\cdot \ln\left(\frac{x}{3}\right) \right)

In this case, the function has three variables and three vector components, therefore, the Jacobian matrix will be a 3×3 square matrix:

\displaystyle J_f(x,y,z)=\begin{pmatrix}\phantom{5}\cfrac{\partial f_1}{\partial x}\phantom{5} & \phantom{5}\cfrac{\partial f_1}{\partial y}\phantom{5} & \phantom{5}\cfrac{\partial f_1}{\partial z}\phantom{5} \\[3ex] \cfrac{\partial f_2}{\partial x} & \cfrac{\partial f_2}{\partial y} & \cfrac{\partial f_2}{\partial z} \\[3ex] \cfrac{\partial f_3}{\partial x} & \cfrac{\partial f_3}{\partial y} & \cfrac{\partial f_3}{\partial z}\end{pmatrix}

jacobian matrix example problems

Once we have found the Jacobian matrix, we evaluate it at the point (3,0,π):

\displaystyle J_f(3,0,\pi)= \begin{pmatrix} \vphantom{\cfrac{\partial f_2}{\partial x}} e^{2\cdot 0}\cos(-\pi) & 2\cdot 3e^{2\cdot 0}\cos(-\pi) & 3e^{2\cdot 0}\sin(-\pi) \\[3ex] \vphantom{\cfrac{\partial f_2}{\partial x}} 0 & \displaystyle 3(0-2)^2\cdot \sin\left(\frac{\pi}{2}\right) & \displaystyle\frac{1}{2}(0-2)^3\cdot \cos\left(\frac{\pi}{2}\right)\\[3ex] \vphantom{\cfrac{\partial f_2}{\partial x}}\displaystyle\frac{e^{2\cdot 0}}{3} &\displaystyle 2e^{2\cdot 0}\cdot \ln\left(\frac{3}{3}\right) & 0\end{pmatrix}

We calculate all the operations:

\displaystyle J_f(3,0,\pi)= \begin{pmatrix} \vphantom{\cfrac{\partial f_2}{\partial x}} 1\cdot (-1) & 6\cdot 1\cdot (-1) & 3\cdot 1 \cdot 0 \\[3ex] \vphantom{\cfrac{\partial f_2}{\partial x}} 0 & \displaystyle 3\cdot 4 \cdot 1 & \displaystyle\frac{1}{2}\cdot (-8)\cdot 0\\[3ex] \vphantom{\cfrac{\partial f_2}{\partial x}}\displaystyle\frac{1}{3} &\displaystyle 2\cdot 1\cdot 0 & 0\end{pmatrix}

And the result of the Jacobian matrix is:

\displaystyle \bm{J_f(3,0,\pi)=} \begin{pmatrix} \vphantom{\cfrac{\partial f_2}{\partial x}} \bm{-1} & \bm{-6} & \phantom{-}\bm{0} \\[2ex] \bm{0} & \bm{12} & \displaystyle \bm{0} \\[2ex] \displaystyle \frac{\bm{1}}{\bm{3}} &\bm{0}& \bm{0}\end{pmatrix}

 

Jacobian matrix determinant

The determinant of the Jacobian matrix is called Jacobian determinant, or simply the Jacobian. Note that the Jacobian determinant can only be calculated if the function has the same number of variables as vector components, since then the Jacobian matrix is a square matrix.

Jacobian determinant example

Let’s see an example of how to calculate the Jacobian determinant of a function with two variables:

\displaystyle f(x,y)= (x^2-y^2 \ , \ 2xy)

First we calculate the Jacobian matrix of the function:

\displaystyle J_f(x,y)=\begin{pmatrix}\cfrac{\phantom{5}\partial f_1}{\partial x}\phantom{5} & \phantom{5}\cfrac{\partial f_1}{\partial y}\phantom{5} \\[3ex] \cfrac{\partial f_2}{\partial x} & \cfrac{\partial f_2}{\partial y}\end{pmatrix} = \begin{pmatrix} \vphantom{\cfrac{\partial f_2}{\partial x}}2x \phantom{5}& -2y \\[2ex] \vphantom{\cfrac{\partial f_2}{\partial x}} 2y & 2x \end{pmatrix}

And now we take the determinant of the 2×2 matrix:

\displaystyle \text{det}\bigl(J_f(x,y)\bigr) =\begin{vmatrix} 2x&-2y \\[2ex] 2y & 2x \end{vmatrix} = \bm{4x^2+4y^2}

The Jacobian and the invertibility of a function

Now that you have seen the concept of the determinant of the Jacobian matrix, you may be wondering… what is it for?

Well, the Jacobian is used to determine whether a function can be inverted. The inverse function theorem states that if the Jacobian is nonzero, this function is invertible.

\displaystyle \text{det}\bigl(J_f\bigr) \neq 0 \ \longrightarrow \ \exists \ f^{-1}

Note that this condition is necessary but not sufficient, that is, if the determinant is different from zero we can say that the matrix can be inverted, however, if the determinant is equal to 0 we don’t know whether the function has an inverse or not.

For example, in the example seen before, the determinant Jacobian results in 4x^2+4y^2. In that case we can affirm that the function can always be inverted except at the point (0,0), because this point is the only one in which the Jacobian determinant is equal to zero and, therefore, we do not know whether the inverse function exists in this point.

➤ See also: inverse of a matrix

Applications of the Jacobian matrix

In addition to the utility that we have seen of the Jacobian, which determines whether a function is invertible, the Jacobian matrix has other applications.

The Jacobian matrix is used to calculate the critical points of a multivariate function, which are then classified into maximums, minimums or saddle points using the Hessian matrix. To find the critical points, you have to calculate the Jacobian matrix of the function, set it equal to 0 and solve the resulting equations.

\displaystyle J_f(x)=0

Moreover, another application of the Jacobian matrix is found in the integration of functions with more than one variable, that is, in double, triple integrals, etc. Since the determinant of the Jacobian matrix allows a change of variable in multiple integrals according to the following formula:

\displaystyle x=T(x^*)

\displaystyle \int_\Omega  f(x)dx=\int_{\Omega^*} f\bigl(T(x^*)\bigr)\cdot \begin{vmatrix} \text{det}\bigl(JT(x^*)\bigr)\end{vmatrix} dx^*

Where T is the variable change function that relates the original variables to the new ones.

Finally, the Jacobian matrix can also be used to compute a linear approximation of any function f around a point p:

\displaystyle f(x) \approx f(p) + J_f(p)(x-p)

2 thoughts on “Jacobian matrix and determinant”

Leave a Comment

Your email address will not be published. Required fields are marked *