# Finding gradient vectors for multivariable functions

## Formula for the gradient vector

The find the gradient (also called the gradient vector) of a two variable function, we’ll use the formula

???\nabla{f}=\left\langle\frac{\partial{f}}{\partial{x}},\frac{\partial{f}}{\partial{y}}\right\rangle???

Hi! I'm krista.

This gives a vector-valued function that describes the function’s gradient everywhere. If we want to find the gradient at a particular point, we just evaluate at that point.

???\nabla{f(x,y)}=\left\langle\frac{\partial{f}}{\partial{x}}(x,y),\frac{\partial{f}}{\partial{y}}(x,y)\right\rangle???

The maximal directional derivative is given by the magnitude of the gradient.

???\parallel\nabla f\parallel=\parallel{a},b\parallel=\sqrt{a^2+b^2}???

where ???a??? and ???b??? come from ???\nabla{f(x,y)}=\left\langle{a},b\right\rangle???

The gradient ???\nabla f??? always points in the direction of the maximal directional derivative.

Remember that the gradient is not limited to two variable functions. We can modify the two variable formula to accommodate more than two variables as needed.

## Finding the gradient and maximal directional derivative

Example

Find the gradient vector of the function and the maximal directional derivative.

???f(x,y)=x^3+2x^2y+4y^2???

at ???P(1,1)???

???\frac{\partial{f}}{\partial{x}}=3x^2+4xy???

???\frac{\partial{f}}{\partial{y}}=2x^2+8y???

The gradient of the function in general is

???\nabla{f}=\left\langle\frac{\partial{f}}{\partial{x}},\frac{\partial{f}}{\partial{y}}\right\rangle???

???\nabla{f}=\left\langle3x^2+4xy,2x^2+8y\right\rangle???

To find the gradient at the point we’re interested in, we’ll plug in ???P(1,1)???.

???\nabla{f(1,1)}=\left\langle3(1)^2+4(1)(1),2(1)^2+8(1)\right\rangle???

???\nabla{f(1,1)}=\left\langle7,10\right\rangle???

To find the maximal directional derivative, we take the magnitude of the gradient that we found.

???\parallel\nabla f\parallel=\parallel{a},b\parallel=\sqrt{a^2+b^2}???

???\parallel7,10\parallel=\sqrt{(7)^2+(10)^2}???

???\parallel7,10\parallel=\sqrt{149}???

The maximal directional derivative always points in the direction of the gradient. So the maximal directional derivative is ???\parallel7,10\parallel=\sqrt{149}???, and it points toward ???\nabla{f(1,1)}=\left\langle7,10\right\rangle???.

The maximal directional derivative always points in the direction of the gradient.

## Derivative rules and the gradient

The gradient can also be found for the product and quotient of functions. To find the gradient of the product of two functions ???f??? and ???g???, we extend the product rule for derivatives to say that the gradient of the product is

???\nabla (fg)=f\nabla g+g\nabla f???

Or to find the gradient of the quotient of two functions ???f??? and ???g???, we extend the quotient rule for derivatives to say that the gradient of the quotient is

???\nabla \left(\frac{f}{g} \right)=\frac{g\nabla f-f\nabla g}{g^{2}}???

Let’s work through an example using a derivative rule.

Example

Find ???\nabla (f/g)???.

???f(x,y)=3x^2y???

???g(x,y)=x^3+2x^2y+x???

First we’ll find ???\nabla f(x,y)??? and ???\nabla g(x,y)???.

???\nabla f(x,y)=\frac{\partial \left(3x^{2} y\right)}{\partial x} {\bold i}+\frac{\partial \left(3x^{2} y\right)}{\partial y} {\bold j}???

???\nabla f(x,y)=6xy{\bold i}+3x^{2} {\bold j}???

and

???\nabla g(x,y)=\frac{\partial \left(x^3+2x^2y+x\right)}{\partial x} {\bold i}+\frac{\partial \left(x^3+2x^2y+x\right)}{\partial y} {\bold j}???

???\nabla g(x,y)=\left(3x^2+4xy+1\right){\bold i}+2x^2{\bold j}???

Plug into the formula.

???\nabla \left(\frac{f}{g} \right)=\frac{g\nabla f-f\nabla g}{g^{2}}???

???\nabla\left(\frac{f}{g}\right)=\frac{\left(x^3+2x^2y+x\right)\left(6xy{\bold i}+3x^{2} {\bold j}\right)-\left(3x^2y\right)\left(\left(3x^2+4xy+1\right){\bold i}+2x^2{\bold j}\right)}{\left(x^3+2x^2y+x\right)^{2}}???

???\nabla\left(\frac{f}{g}\right)=\frac{6xy\left(x^3+2x^2y+x\right){\bold i}+3x^{2} \left(x^3+2x^2y+x\right){\bold j}-3x^2y\left(3x^2+4xy+1\right){\bold i}-3x^2y\left(2x^2\right){\bold j}}{\left(x^3+2x^2y+x\right)^{2}}???

???\nabla\left(\frac{f}{g}\right)=\frac{\left(6x^4y+12x^3y^2+6x^2y\right){\bold i}+\left(3x^5+6x^4y+3x^3\right){\bold j}-\left(9x^4y-12x^3y^2-3x^2y\right){\bold i}-6x^4y{\bold j}}{\left(x^3+2x^2y+x\right)^{2}}???

???\nabla\left(\frac{f}{g}\right)=\frac{\left(6x^4y+12x^3y^2+6x^2y-9x^4y+12x^3y^2+3x^2y\right){\bold i}+\left(3x^5+6x^4y+3x^3-6x^4y\right){\bold j}}{\left(x^3+2x^2y+x\right)^{2}}???

???\nabla\left(\frac{f}{g}\right)=\frac{\left(-3x^4y+24x^3y^2+9x^2y\right){\bold i}+\left(3x^5+3x^3\right){\bold j}}{\left(x^3+2x^2y+x\right)^{2}}???

???\nabla\left(\frac{f}{g}\right)=\frac{-3x^4y+24x^3y^2+9x^2y}{\left(x^3+2x^2y+x\right)^{2}}{\bold i}+\frac{3x^5+3x^3}{\left(x^3+2x^2y+x\right)^{2}}{\bold j}???

???\nabla\left(\frac{f}{g}\right)=\frac{3x^2y\left(-x^2+8xy+3\right)}{x^2\left(x^2+2xy+1\right)^{2}}{\bold i}+\frac{3x^3\left(x^2+1\right)}{x^2\left(x^2+2xy+1\right)^{2}}{\bold j}???

???\nabla\left(\frac{f}{g}\right)=\frac{3y\left(-x^2+8xy+3\right)}{\left(x^2+2xy+1\right)^{2}}{\bold i}+\frac{3x\left(x^2+1\right)}{\left(x^2+2xy+1\right)^{2}}{\bold j}???