# Difference between gradient and Jacobian

Could anyone explain in simple words (and maybe with an example) what the difference between the gradient and the Jacobian is?

The gradient is a vector with the partial derivatives, right?

These are two particular forms of matrix representation of the derivative of a differentiable function $$f,f,$$ used in two cases:
• when $$f:Rn→R,f:\mathbb{R}^n\to\mathbb{R},$$ then for $$xx$$ in $$Rn\mathbb{R}^n$$, $$gradx(f):=[∂f∂x1∂f∂x2…∂f∂xn]|x\mathrm{grad}_x(f):=\left[\frac{\partial f}{\partial x_1}\frac{\partial f}{\partial x_2}\dots\frac{\partial f}{\partial x_n}\right]\!\bigg\rvert_x$$ is the matrix $$1×n1\times n$$ of the linear map $$Df(x)Df(x)$$ exprimed from the canonical base of $$Rn\mathbb{R}^n$$ to the canonical base of $$R\mathbb{R}$$ (=(1)…). Because in this case this matrix would have only one row, you can think about it as the vector
$$∇f(x):=(∂f∂x1,∂f∂x2,…,∂f∂xn)|x∈Rn.\nabla f(x):=\left(\frac{\partial f}{\partial x_1},\frac{\partial f}{\partial x_2},\dots,\frac{\partial f}{\partial x_n}\right)\!\bigg\rvert_x\in\mathbb{R}^n.$$
This vector $$∇f(x)\nabla f(x)$$ is the unique vector of $$Rn\mathbb{R}^n$$ such that $$Df(x)(y)=⟨∇f(x),y⟩Df(x)(y)=\langle\nabla f(x),y\rangle$$ for all $$y∈Rny\in\mathbb{R}^n$$ (see Riesz representation theorem), where $$⟨⋅,⋅⟩\langle\cdot,\cdot\rangle$$ is the usual scalar product
$$⟨(x1,…,xn),(y1,…,yn)⟩=x1y1+⋯+xnyn.\langle(x_1,\dots,x_n),(y_1,\dots,y_n)\rangle=x_1y_1+\dots+x_ny_n.$$
• when $$f:Rn→Rm,f:\mathbb{R}^n\to\mathbb{R}^m,$$ then for $$xx$$ in $$Rn\mathbb{R}^n$$, $$Jacx(f)=[∂f1∂x1∂f1∂x2…∂f1∂xn∂f2∂x1∂f2∂x2…∂f2∂xn⋮⋮⋮∂fm∂x1∂fm∂x2…∂fm∂xn]|x\mathrm{Jac}_x(f)=\left.\begin{bmatrix}\frac{\partial f_1}{\partial x_1}&\frac{\partial f_1}{\partial x_2}&\dots&\frac{\partial f_1}{\partial x_n}\\\frac{\partial f_2}{\partial x_1}&\frac{\partial f_2}{\partial x_2}&\dots&\frac{\partial f_2}{\partial x_n}\\ \vdots&\vdots&&\vdots\\\frac{\partial f_m}{\partial x_1}&\frac{\partial f_m}{\partial x_2}&\dots&\frac{\partial f_m}{\partial x_n}\\\end{bmatrix}\right|_x$$ is the matrix $$m×nm\times n$$ of the linear map $$Df(x)Df(x)$$ exprimed from the canonical base of $$Rn\mathbb{R}^n$$ to the canonical base of $$Rm.\mathbb{R}^m.$$
For example, with $$f:R2→Rf:\mathbb{R}^2\to\mathbb{R}$$ such as $$f(x,y)=x2+yf(x,y)=x^2+y$$ you get $$grad(x,y)(f)=[2x1]\mathrm{grad}_{(x,y)}(f)=[2x \,\,\,1]$$ (or $$∇f(x,y)=(2x,1)\nabla f(x,y)=(2x,1)$$) and for $$f:R2→R2f:\mathbb{R}^2\to\mathbb{R}^2$$ such as $$f(x,y)=(x2+y,y3)f(x,y)=(x^2+y,y^3)$$ you get $$Jac(x,y)(f)=[2x103y2].\mathrm{Jac}_{(x,y)}(f)=\begin{bmatrix}2x&1\\0&3y^2\end{bmatrix}.$$