# Can there be a scalar function with a vector variable?

Can I define a scalar function which has a vector-valued argument?

For example, let $U$ be a potential function in 3-D, and its variable is $\vec{r}=x\hat{\mathrm{i}}+y\hat{\mathrm{j}}+z\hat{\mathrm{k}}$.

Then $U$ will have the form of $U(\vec{r})$.

Is there any problem?

-

## migrated from physics.stackexchange.comApr 12 '12 at 17:20

This question came from our site for active researchers, academics and students of physics.

That's perfectly okay. – kηives Apr 12 '12 at 0:23
I think this might be more suitable on math.SE... thoughts from anyone else? – David Z Apr 12 '12 at 4:13
@DavidZaslavsky: Yeah, makes more sense on math.SE – Manishearth Apr 12 '12 at 4:48

That depends on what exactly you mean by scalar.

Do you mean a function that's just a number? Then of course you can think up any function you want that turns three input numbers $x, y$ and $z$ into one output number $U(\vec{r}) = U(x,y,z)$. Examples would be $U(\vec{r}) = |\vec{r}| = \sqrt{x^2 + y^2 + z^2}$ or $U(\vec{r}) = x + y - 2z$, or just general definitions such as $U(\vec{r}) =$ temperature at location $\vec{r}$, or $\varrho(\vec{r}) =$ Charge density at location $\vec{r}$.

If, however, by scalar you mean an object that's not only a number, but also rotationally invariant, then your options are a tiny bit limited. An object that's invariant under rotation cannot depend on the specific direction of $\vec{r}$ but only on its magnitude, so the first example above would be a scalar, but the second example would not.

EDIT: Since this was migrated from the physics SE, let me note that there are some subtle differences in nomenclature. In physics, the term "scalar" can have more meaning than "element of $\mathbb{R}$ or $\mathbb{C}$. It can mean: "Something that is invariant under rotation". Or, in the case of a Lorentz scalar, "something that is invariant under a certain transformation".

-

That's a perfectly fine thing to do. The classic example of such a field is the temperature in a room: the temperature $T$ at each point $(x,y,z)$ is a function of a $3$-vector, but the output of the function is just a scalar ($T$). $\phi^4$ scalar fields are also an example, as are utility functions in economics.

-

The (more or less) canonical example is the divergence, here the divergence is of a vector valued function $\mathbf{F} = U(x,y,z)\hat{i} + V(x,y,z)]\hat{j} + W(x,y,z)\hat{k}$

$$\operatorname{div}\,\mathbf{F} = \nabla\cdot\mathbf{F} =\frac{\partial U}{\partial x} +\frac{\partial V}{\partial y} +\frac{\partial W}{\partial z }$$

-