f(x,y) Explained- Functions of Two Variables

What Is f(x, y)?

You're probably comfortable with functions like f(x) = x². One input, one output. Simple enough.

But math doesn't stop there. f(x, y) is a function that takes two inputs and produces one output. Two numbers go in, one number comes out.

The notation looks like this:

f(x, y) = x² + y²

Here, x and y are independent variables. You pick values for both, and the function spits out a result.

That's it. That's the whole concept. Everything else is just variations on this theme.

Why Bother With Two Variables?

Single-variable functions are fine for basic stuff. But real life involves multiple factors.

Think about temperature at a weather station. It depends on both altitude and distance from the equator. One variable isn't enough.

Or profit for a business. It depends on price and quantity sold. You need both inputs to get the output.

Two-variable functions let you model situations where two things matter simultaneously. That's their whole value.

Evaluating f(x, y) — The Basics

Evaluating a function of two variables is identical to evaluating a single-variable function. You just substitute two values instead of one.

Example

Given: f(x, y) = 3x + 2y - 5

Find f(2, 4):

f(2, 4) = 3(2) + 2(4) - 5 = 6 + 8 - 5 = 9

That's it. Plug in x = 2 and y = 4. Do the arithmetic. Done.

Another Example

Given: f(x, y) = x²y + 3

Find f(3, 2):

f(3, 2) = (3)²(2) + 3 = 9(2) + 3 = 18 + 3 = 21

Order of operations still applies. Square the x-value first, multiply by y, then add.

Domain of Two-Variable Functions

The domain is the set of all valid (x, y) pairs you can plug in without breaking the function.

For most polynomial functions, the domain is all real numbers. You can plug in any x and any y and nothing goes wrong.

But watch out for functions with:

Graphing f(x, y) — 3D Surfaces

Single-variable functions graph as 2D curves. Two-variable functions graph as 3D surfaces.

Every point on the surface has coordinates (x, y, z) where z = f(x, y).

Picture a sheet stretched over hills and valleys. The height at any point tells you the function's output for those x and y values.

Common Surface Shapes

Level Curves — The 2D Alternative

Drawing 3D surfaces is tedious. Level curves (or contour lines) let you represent 3D surfaces on a 2D plane.

A level curve is the set of all points (x, y) where f(x, y) equals a constant value k.

Think of a topographic map. Each contour line represents points at the same elevation. Same idea here.

Example

For f(x, y) = x² + y²:

Each successive curve is a larger circle. Stack them together and you get concentric circles representing the paraboloid's "slices."

Partial Derivatives — How f Changes

With one variable, you have one derivative. With two variables, you have two partial derivatives.

fₓ(x, y) — treat y as constant, differentiate with respect to x

fᵧ(x, y) — treat x as constant, differentiate with respect to y

Example

f(x, y) = 3x²y + 2y³

fₓ = ∂f/∂x = 6xy (y stays as y, differentiate the x part)

fᵧ = ∂f/∂y = 3x² + 6y² (x stays as x, differentiate the y part)

Partial derivatives tell you the slope of the surface in each direction. Useful for optimization, tangent planes, and understanding rates of change.

Real-World Applications

Functions of two variables show up constantly outside math class:

Common Mistakes to Avoid

Getting Started: Evaluating Your First f(x, y)

Try these steps with any two-variable function:

  1. Identify the function — write down f(x, y) clearly
  2. Substitute values — replace x with your first number, y with your second
  3. Simplify — follow order of operations, combine like terms
  4. Check your domain — make sure your inputs are valid

Practice Problem

f(x, y) = 2x² + 3xy - y² + 4

Find f(1, 3):

f(1, 3) = 2(1)² + 3(1)(3) - (3)² + 4

f(1, 3) = 2 + 9 - 9 + 4

f(1, 3) = 6

Work through five more problems before moving on. You won't get faster at this without practice.

Tools for Visualization

If you want to actually see these surfaces instead of imagining them:

Tool Cost Best For
Desmos 3D Free Quick surface plots, level curves
GeoGebra 3D Free Interactive exploration, slicing planes
Wolfram Alpha Free tier Instant plots, level curves, partial derivatives
MATLAB Paid Professional quality, research applications
Python (matplotlib) Free Custom visualizations, automation

Desmos is the fastest way to see what a function looks like. Type in z = x² + y² and it renders immediately.

What's Next

Once you're comfortable with the basics, move on to:

Each topic builds directly on f(x, y). Master the fundamentals first. Skip ahead and you'll just confuse yourself.