Skip to content
Glacius
CalculusConcept reference

Multivariable functions

A scalar multivariable function assigns one real output to each ordered vector in its domain.

On this page 9 sections
  1. Overview
  2. Understand the idea
  3. Coordinate order matters
  4. More input coordinates still can produce one number
  5. A closer look
  6. Key takeaway
  7. Further questions
  8. Sources & further reading
  9. Concept connections

01Understand the idea#

A model can use several inputs to produce one number: features in, prediction out, or many weights in, loss out. A multivariable function describes that relationship. An ordered input is one complete setting of all its variables, not a list of separate trials.

In f(x,y)=2xyf(x,y)=2x-y, the input (3,1)(3,1) has two coordinates. Assign x=3x=3 and y=1y=1; both belong to one evaluation.

For f(x,y)=2x−y, straight level sets satisfy y=2x−c. Lines for c=1,3,5 are shown. Input (3,1) lies on the c=5 line, so its scalar output is 5. The drawing is the input plane.For f(x,y)=2x−y, straight level sets satisfy y=2x−c. Lines for c=1,3,5 are shown. Input (3,1) lies on the c=5 line, so its scalar output is 5. The drawing is the input plane.
Figure 1For f(x,y)=2x−y, straight level sets satisfy y=2x−c. Lines for c=1,3,5 are shown. Input (3,1) lies on the c=5 line, so its scalar output is 5. The drawing is the input plane.
Link to this figure ↗Download SVGDownload PNG

For f(x,y)=2xyf(x,y)=2x-y, substitute the coordinates before combining the terms. The output is a scalar.

2(3)1=52(3)-1=5

If f(x,y)=2xyf(x,y)=2x-y, the input (3,1)(3,1) means x=3x=3 and y=1y=1. Substitute first: 2(3)1=52(3)-1=5. Swapping to (1,3)(1,3) gives 2(1)3=12(1)-3=-1. The positions carry meaning, just as swapping two feature columns changes which coefficient multiplies them.

Check your reasoning

f(x,y)=3xyf(x,y)=3x-y. Find f(2,1)f(2,-1).

Show answer and explanation
7

Substitute in order: 3(2)(1)=73(2)-(-1)=7.

02Coordinate order matters#

Coordinate order matters. For f(x,y)=2xyf(x,y)=2x-y, swapping the input usually changes the result.

f(3,1)=5f(1,3)=1\begin{gathered}f(3,1)=5\\f(1,3)=-1\end{gathered}
Check your reasoning

f(x,y)=x2yf(x,y)=x-2y. A learner swaps (1,4)(1,4). Find the actual f(1,4)f(1,4).

  1. A22
  2. B7-7
  3. C(1,8)(1,-8)
Show answer and explanation
7-7

Use x=1x=1, y=4y=4: 18=71-8=-7.

03More input coordinates still can produce one number#

More input coordinates still can produce one number. For S(a,b,c)=abcS(a,b,c)=ab-c, evaluate at (3,2,1)(3,2,1) by substituting all three entries.

3(2)1=53(2)-1=5
Check your reasoning

Score S(a,b,c)=abcS(a,b,c)=ab-c. For (a,b,c)=(2,4,3)(a,b,c)=(2,4,3), find SS.

Show answer and explanation
5

The scalar score is 2(4)3=52(4)-3=5.

04A closer look#

When testing a model at a particular parameter vector, give every parameter its value before evaluating the scalar loss. Later, partial derivatives vary one parameter while holding the others fixed; the function you evaluate remains the same.

Key takeaway

Match coordinates to arguments, then compute one output.

  • Evaluate a scalar function at a vector input.

Further questions

Does a vector input force a vector output?
No. The formula specifies the output type. These functions combine several inputs into one real number.

Sources & further reading

  1. [1]

Reference this concept

Link to this page, a section, or an individual figure.

Glacius. “Multivariable functions.” Math behind ML. /learn/c-multifunction