# Gradient Calculator

**
Instructions:
**
Use this gradient calculator to compute the vector of partial derivatives for a multivariate function that you provide, showing all the steps.
Please type the multivariable function in the form box below.

## The Gradient Calculator

This gradient calculator with steps will help you find the gradient vector of a given multivariate function that you provide. This function needs to be a valid, differentiable function with 2 or more variables.

The function you provide needs to come with a full definition of its variable name and function, for example f(x, y) = x^2 + y^2, or f(x,y,z) = xy+z*sin(xy), etc.

Once a valid multivariable function is provided, all that is left to do is to click on the "Calculate" button, in order to get all the steps shown.

Gradients represent the natural extension of derivatives for the multivariable situation, in which the rate of change is better defined by a vector than a number.

## What is the Gradient

In simple terms, the gradient is a vector that contains all the first order partial derivatives of a multivariable function \(f\). So then, for a function of two variables \(f(x, y)\), its gradient would be a 2-dimensional vector \(\nabla f(x, y) = \displaystyle \left(\frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}\right)\).

Similarly, for a function of three variables \(f(x, y, z\), its gradient would be a 3-dimensional vector \(\nabla f(x, y, z) = \displaystyle \left(\frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}, \frac{\partial f}{\partial z}\right)\), and so forth.

## Steps for computing the gradient

**Step 1:**Identify the function f you want to work with, and identify the number of variables involved**Step 2:**Find the first order partial derivative with respect to each of the variables**Step 3:**Construct the gradient as the vector that contains all those first order partial derivatives found in Step 2

Optionally, you can simplify, if possible, after completing Step 3. Then, with the gradient, you have version of what is the derivative for a univariate function, in this case for a multivariate function.

## Applications of the gradient

Same as in the case of univariate functions when looking for critical points we need to find the points where the derivative is zero, for multivariate functions we need to search for points on which the gradient is equal to zero in order to find critical points.

Also, the equivalent to the second derivative tests comes in the form of the hessian rule for multivariate functions.

## Tips and tricks

Remember that the gradient is defined for multivariate functions, with two or more variables. Also, keep in mind that the gradient is a vector, where each of the components is a function. More precisely, each of its components is a partial derivative of first order.

As a way of checking your work, don't forget that the gradient is a vector with dimension equals to the number of independent variables defined in the function.

### Example: Gradient Calculator

Find the gradient associated to the function : \(f(x,y,z)=x^2+y^2+z^2\)

Solution: We consider the following multivariate function: \(\displaystyle f(x,y,z)=x^2+y^2+z^2\), so then we need to compute its gradient.

**Differentiating with respect to \(x\) **

**Differentiating with respect to \(y\) **

**Differentiating with respect to \(z\) **

**Conclusion:** Therefore, we can conclude that the gradient of the given function \(\displaystyle f(x,y,z)=x^2+y^2+z^2 \) is equal to:

### Gradient Calculation Example

For the following function: \(f(x, y) = xy\), find its gradient.

Solution: For this example we have a function of two variables x and y: \(\displaystyle f(x,y)=xy\).

**First, differentiating with respect to x **

**Now, fifferentiate with respect to y **

**Conclusion:** We get directly that the gradient of the function \(\displaystyle f(x,y)=xy \) is:

### More gradient examples

Calculate the corresponding gradient of \( f(x, y) = x^2 - y^2 - xy \).

Solution: Finally, the following function needs to be analyzed in this example: \(\displaystyle f(x,y)=x^2-y^2-xy\). Since it is a multivariate function, it makes sense to compute its gradient.

**Step 2: Find the derivative with respect to \(x\) **

**Step 2: Find the derivative with respect to \(y\) **

**Conclusion:** Therefore, we can conclude that the gradient of the given function \(\displaystyle f(x,y)=x^2-y^2-xy \) is equal to:

## More derivative calculators

Using a derivative calculator can definitely make your life easier as it will allow you to keep track of all the derivative rules.

Most of the differentiation rules used for univariate functions have their equivalent for multivariate functions. This way, the chain rule, product rule and quotient rule will also work for multivariate function, keeping in mind the right dimensions.