Mathwords logoMathwords

Scalar-Valued Function — Definition & Example

A scalar-valued function (also called a scalar function) is a function that returns a single real number as its output, even when it takes several inputs. Examples include a temperature at a point in a room, the height of a hill above a spot on a map, or the cost of a production plan.

A scalar-valued function is a function f:D→Rf: D \to \mathbb{R} whose domain DD is a subset of Rn\mathbb{R}^n. It assigns to each point (x1,x2,…,xn)∈D(x_1, x_2, \ldots, x_n) \in D exactly one real number f(x1,x2,…,xn)f(x_1, x_2, \ldots, x_n). When n≥2n \geq 2, it is also called a multivariable function or, in physics, a scalar field. Its codomain is R\mathbb{R}, not Rm\mathbb{R}^m with m≥2m \geq 2. That is what separates it from a vector-valued function.

Worked Example

Problem: The temperature in a workshop, in degrees Fahrenheit, is modeled by T(x,y,z)=70+2x−3y+z2T(x, y, z) = 70 + 2x - 3y + z^2. Here xx, yy, and zz are distances in feet from one corner of the room. Find the temperature at the points P=(1,2,3)P = (1, 2, 3) and Q=(4,0,1)Q = (4, 0, 1), and decide which point is warmer.
Step 1: Substitute the coordinates of PP. All three numbers go in, and one number comes out.
T(1,2,3)=70+2(1)−3(2)+32=70+2−6+9=75T(1, 2, 3) = 70 + 2(1) - 3(2) + 3^2 = 70 + 2 - 6 + 9 = 75
Step 2: Substitute the coordinates of QQ in the same way.
T(4,0,1)=70+2(4)−3(0)+12=70+8−0+1=79T(4, 0, 1) = 70 + 2(4) - 3(0) + 1^2 = 70 + 8 - 0 + 1 = 79
Step 3: Both outputs are single real numbers, so you can compare them directly. Vector outputs could not be ranked this way.
T(Q)−T(P)=79−75=4T(Q) - T(P) = 79 - 75 = 4
Answer: T(P)=75∘FT(P) = 75^\circ\text{F} and T(Q)=79∘FT(Q) = 79^\circ\text{F}. Point QQ is warmer by 4∘F4^\circ\text{F}. Each input point in 3D space produced one number. That single-number output is what makes TT scalar-valued.

Why It Matters

Most of Calculus III is built on scalar-valued functions. You take their gradients, maximize them with Lagrange multipliers, and integrate them over regions with double and triple integrals. Outside the classroom, the same idea appears in physics as potential energy and pressure fields. In machine learning, a loss function is a scalar-valued function of thousands of model weights.

Common Mistakes

Mistake: Calling f(x,y,z)f(x, y, z) vector-valued because its input is a point or vector.
Correction: Classify a function by its output, not its input. If ff returns one real number, it is scalar-valued, no matter how many inputs it has. A function is vector-valued only when its output has two or more components, such as r(t)=⟨t,t2⟩\mathbf{r}(t) = \langle t, t^2 \rangle.

Related Terms

  • Function — The general input-to-output rule it specializes
  • Vector-Valued Function — Contrasting type whose outputs are vectors, not numbers
  • Partial Derivative — Measures how a scalar function changes along one variable
  • Gradient — Turns a scalar function into a vector field
  • Laplacian — Second-derivative operator applied to scalar functions
  • Divergence — Produces a scalar function from a vector field
  • Lagrange Multiplier — Method for optimizing a scalar function under constraints