# derivative with respect to a vector

$\frac{\partial f} {\partial \left( \begin{array}{l} x \\ y \\ z \end{array} \right) }$

gives

Can you help me to improve this by reducing the size of the denominator?

-
write it as {x,y,z}^T where T is transpose (if it must be a column vector, else leave it as row vector) –  Nasser Feb 20 at 5:43
add comment

## 6 Answers

The psmallmatrix environment from »mathtools« could come in handy here. Partial derivatives are easier to typeset with the help of the »physics« package.

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{mathtools}
\usepackage{physics}

\begin{document}
$\pdv{f}{% \begin{psmallmatrix} x \\ y \\ z \end{psmallmatrix} }$
\end{document}

-
I've upvoted all previous solutions, and accepted yours for the psmallmatrix environment! Thx –  Marco Feb 20 at 8:34
When using only amsmath and not mathtools the same can be achieved with \left(\begin{smallmatrix}x\\y\\z\end{smallmatrix}\right). –  canaaerus Feb 20 at 12:18
@canaaerus: But psmallmatrix is easier due to less typing. And »mathtools« offers many other enhancements to »amsmath«. –  Thorsten Donig Feb 20 at 15:10
@ThorstenDonig: That is true. Although to have to type less, a special macro or an editor short-cut is superior to both. My comment was only meant for people who are not able or do not want to use mathtools. –  canaaerus Feb 20 at 16:50
@canaaerus: I can't see why a short-cut or a special macro should be superior over a sophisticated package. And furthermore I don't see reasons why one wouldn't want or be able to use that package. –  Thorsten Donig Feb 20 at 17:02
add comment

To really economize on vertical space, you could typeset the denominator term as a row vector -- and apply a transpose symbol to indicate that the result of the operation should be a column vector. Two possible ways to represent this approach are, the second possibility is based on a suggestion by @percusse.

\documentclass{article}
\begin{document}
$\frac{\partial f}{\bigl( \partial (\,x \ y \ z\,) \bigr)'} \quad \frac{\partial f}{\partial \bigl( (\,x \ y \ z\,)' \bigr)}$
\end{document}
-
I think the transpose should be in and the partial should be out of the outer brackets. –  percusse Feb 20 at 6:45
@percusse - Thanks, I've incorporated your comment by showing both possible solutions. –  Mico Feb 20 at 7:29
add comment

Something like this?

\documentclass{article}

\usepackage{amsmath}

\begin{document}

$\frac{\partial f} {\partial \begin{pmatrix} x \\[-4pt] y \\[-3pt] z \end{pmatrix} }$

\end{document}
-
add comment

A possible solution:

\documentclass{article}

\usepackage{amsmath}

\newcommand*\PartDiff[4]{%
\frac{\partial #1}{\partial \mkern-4mu
\begingroup
\renewcommand*{\arraystretch}{0.7}
\begin{pmatrix}
#2\\  #3\\  #4
\end{pmatrix}
\endgroup
}%
}

\begin{document}

\begin{equation*}
\PartDiff{f}{x}{y}{z}
\end{equation*}

\end{document}

Note that the distance between the rows is adjusted by \arraystretch.

If you enclose the \begingroup/\endgroup construction in curly braces ({}), you also reduce the spacing around the vector:

\documentclass{article}

\usepackage{amsmath}

\newcommand*\PartDiff[4]{%
\frac{\partial #1}{\partial{
\begingroup
\renewcommand*{\arraystretch}{0.7}
\begin{pmatrix}
#2\\  #3\\  #4
\end{pmatrix}
\endgroup
}}%
}

\begin{document}

\begin{equation*}
\PartDiff{f}{x}{y}{z}
\end{equation*}

\end{document}

-
add comment

A solution with mathtools and nccmath so as to ensure right-aligned matrices and medium size matrices:

\documentclass[12pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage{mathtools}
\usepackage{nccmath}

\begin{document}
$\frac{\partial f}{\partial\begin{pmatrix*}[r] x\\ y\\ z \end{pmatrix*}} \qquad \frac{\partial f}{\partial\begin{medsize}\begin{pmatrix*}[r] x\\ y\\ z \end{pmatrix*}\end{medsize}} \qquad \frac{\partial f}{\partial\begin{psmallmatrix*}[r] x\\ y\\ z \end{psmallmatrix*}}$

\end{document}

-
add comment

Maybe a bit out-of-the-box, but why not use

\nabla f ?

Or use

\partial_{\vec r} f

with

\vec r := \left( \begin{array}{l} x\\ y\\ z \end{array} \right) ?
-
add comment