latex

How to Write and Use a Derivative Symbol in LaTeX

There is a fundamental approach to calculus known as derivatives. Calculating the derivative of a real variable function involves measuring how sensitive a change in the input value (the argument) is to a change in the output value (the function value).

While calculating any mathematical number or question of derivatives, it is essential to write a derivative symbol. That’s why document processors like LaTeX provide simple source codes to write derivative symbols. So in this tutorial, we will give you some brief information on how to write and use a derivative symbol in LateX.

How to Write and Use a Derivative Symbol in LaTeX?

You can show derivatives in different ways in LaTeX, so let’s start with the simple source code to write a derivative symbol:

\documentclass{article}

\begin{document}

$$\frac{\mathrm{d}}{\mathrm{d}z}f(z) , \frac{\mathrm{d^2}}{\mathrm{d}t^2}$$

\end{document}

Output

You can easily use the derivative symbol with the physics \usepackage and \dv source code:

\documentclass{article}

\usepackage{physics}

\begin{document}

$$\dv{z}f(z) , \dv[2]{t}$$

\end{document}

Output

Similarly, you can use the derivative \usepackage and \odv source codes to write the derivative symbol in LaTeX:

\documentclass{article}

\usepackage{derivative}

\begin{document}

$$\odv[order={2}]{x}{y}, \odv[order={k}]{x}{y}$$

\end{document}

Output

Let’s see a simple numerical example of the derivative expression:

\documentclass{article}

\usepackage{derivative}

\begin{document}

If y= $5x^3 + 2x^2$, then

$\odv{y}{x}$ = $15x^2$ + 4x

\end{document}

Output

You can use the following source code to present the derivative symbol of all orders in LaTeX:

\documentclass{article}

\usepackage{physics}

\begin{document}

$First \; order \; derivative = \dv{x}{y}$

$Second \; order \; derivative = \dv[2]{x}{y}$

$Third \; order \; derivative = \dv[3]{x}{y}$

$\vdots$

$Kth \; order \; derivative = \dv[k]{x}{y}$

\end{document}

Output

Let’s take another example to show the way to create a derivative equation, including the limits and fractions section:

\documentclass{article}

\usepackage{mathtools}

\usepackage{xfrac}

\begin{document}

$f'(x) = \lim\limits_{h \rightarrow 0} \frac{(x^2 + 2xh + h^2) - x^2}{h}$

\end{document}

Output

Partial Derivative Symbol in LateX

A function’s partial derivative is the function’s directional derivative in the canonical directions of Rn. Real multivariate functions define them. It also occurs in different orders of derivatives. To use the partial derivative symbol in LaTeX, you can manually use the \partial code.

Suppose you have a function f(y1, y2…yn), and you want to derive it with respect to yi. You can derive it when the other variables are constant. So this derivation is denoted as ∂f / ∂yi. The partial derivative symbol is a general derivative with “curly d’s.”

You can write the partial derivative symbol in LaTeX using the following source code:

\documentclass{article}

\begin{document}

$First \; order \; partial \; derivative = \frac{\partial f}{\partial y}$

$Second \; order \; partial \; derivative = \frac{\partial^2 f}{\partial y^2}$

$Third \; order \; partial \; derivative = \frac{\partial^3 f}{\partial y^3}$

$Kth \; order \; partial \; derivative = \frac{\partial^k f}{\partial y^k}$

\end{document}

Output

Instead of manually writing the above derivative symbol, you can also use the physics package. To use the physics package’s partial derivative symbol, please use the \pdv code in the same way as used in the general derivative:

\documentclass{article}

\usepackage{physics}

\usepackage{xfrac}

\begin{document}

$$\pdv{f}{y}{x} = \pdv{f}{x}{y} = 3$$

\end{document}

Output

There are many features not available under the physics package, so you can use the derivative package instead:

\documentclass{article}

\usepackage{derivative}

\begin{document}

$$u_{xy} = \pdv{u}{y,x}$$

\end{document}

Output

The evaluation bar is used when the variable’s value is known along with the derivative. The \eval code is used to write the evaluation bar with a derivative symbol, which completes the entire expression:

\documentclass{article}

\usepackage{physics}

\begin{document}

$$\eval{5 + \dv{x}{t}_{t=0} }$$

$$\eval{\pdv[2]{f}{x}}_{x=0}$$

\end{document}

Output

Dot Derivative in LaTeX

In LaTeX, you can create time and dot derivatives manually. Dot derivatives only need the following source code:

\documentclass{article}

\usepackage{physics}

\begin{document}

$$\dv{x}{t} = \dot{x}$$

$$\dv[2]{x}{t} = \ddot{x}$$

$$\dv[3]{x}{t} = \dddot{x}$$

\end{document}

Output

Note that the \dot and \ddot codes don’t require any package but \dddot codes require a physics \usepackage.

Conclusion

In this tutorial, we have explained the approaches to writing and using derivative symbols in LaTeX. You can also manually create a derivative symbol in Latex, significantly increasing the syntax length. To reduce this, you can use the derivatives and physics packages in LaTeX. Along with the general derivative, we have also seen the use of the partial derivative, the dot derivative, and the evaluate bar with the derivative symbols.