Skip to content

Instantly share code, notes, and snippets.

@Another-DevX
Last active May 26, 2024 17:53
Show Gist options
  • Save Another-DevX/33b1653be99113d4bc107d0a5af58736 to your computer and use it in GitHub Desktop.
Save Another-DevX/33b1653be99113d4bc107d0a5af58736 to your computer and use it in GitHub Desktop.
Multivariable derivates

Understanding multivariables derivatives

In calculus the concept of instantaneous rate of change is essential. Normally we explore this in functions defined on $R$ fields. If we think about a derivative like a linear transformation, it can help us understand more complex scenarios.

Remember the definition of a derivative on $R$

$\ f'(x) = \lim_{h \to 0} \frac{f(x+h) - f(x)}{h} $

Therefore this equation means we are calculating the slope of the tangent line as we approach an infinitely small interval near an arbitrary point on the function, but not exactly at that point.

It's straightforward to understand this on an easy way if we're talking about $R$. However, what happens if we try to think about a similar process on $R^n$?.

Partial Derivatives

For instance think in a function on $R^2$

This functions represents a 3D curves and surfaces, for this example we will use a simple function that represents an Elliptic Paraboloid, don't worry about how it looks:

$\ f(x,y) = x^2 + y^2 $

To understand how such functions change we introduce the concept of partial derivatives, since we are in $R^2$ linear transformation related the derivative generates a sub-field of $R$, that means, the derivative generate a curve in a plane passing through an arbitrary point. But which plane? We have infinite planes passing through on every arbitrary point of the surface.

So, the partial derivates only creates a plane paralel to the planes $XZ$ or $YZ$, you can think of this as taking a slice of the surface and then analyze the change of curve printed on that plane on that arbitrary point, that means: Partial derivatives help us understand how a function changes in one direction while keeping other variables constant.

The definition of the partial derivate is:

Given a function $f(x, y)$, the partial derivative of $f$ with respect to $x$ is defined as:

$\frac{\partial f}{\partial x} = \lim_{\Delta x \to 0} \frac{f(x + \Delta x, y) - f(x, y)}{\Delta x} $

Similarly, the partial derivative with respect to $y$ is defined as:

$\frac{\partial f}{\partial y} = \lim_{\Delta y \to 0} \frac{f(x, y + \Delta y) - f(x, y)}{\Delta y} $

For the elliptic paraboloid $\ f(x, y) = x^2 + y^2 $, the partial derivatives are:

$\frac{\partial f}{\partial x} = 2x $ $\frac{\partial f}{\partial y} = 2y $

Directional derivatives

However, how can we determine the rate of change in any direction on the curve. Let's introduce the concept of the directional derivative.

The directional derivative of a function $f$ in the direction of a unit vector $\vec{u}$ at a point $(x_0, y_0)$ provides this information.

Suppose $\vec{u}$ is defined as:

$\vec{u} = \cos \theta \ \vec{i} + \sin \theta \ \vec{j} $

where $\theta$ is the angle between the direction of $\vec{u}$ and the positive $x$-axis. The unit vector $\vec{u}$ has components cos($\theta$) in the $x$-direction and sin($\theta$) in the $y$-direction.

The definition of the directional derivative

$\ D_{\vec{u}} f(x_0, y_0) = \frac{\partial f}{\partial x}(x_0, y_0) \cos \theta + \frac{\partial f}{\partial y}(x_0, y_0) \sin \theta $

Think of this as the plane that the derivative creates being parallel to the unit vector $\vec{u}$, this is why this kind of derivative works in any direction.

Conclusion

Understanding multivariables derivatives, such as partial derivatives and directional derivatives, allows us to analyze how functions changes in multiple dimensions, despite the examples above are on $R^2$, the concepts are easy extensible to $R^n$ with minor adjustments, we use $R^2$ example because that's the highest dimension we can fully imagine.

All of these concepts are essential in various fields like physics, enginnering and economics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment