Algebra

What Is a Function?

Last updated: March 2026 · Beginner
Before you start

You should be comfortable with:

Real-world applications
πŸ’Š
Nursing

Medication dosages, IV drip rates, vital monitoring

⚑
Electrical

Voltage drop, wire sizing, load balancing

A function is a rule that assigns every input exactly one output. You can think of it as a machine: you feed in a number, the machine does something to it, and exactly one result comes out. If a rule ever gives two different outputs for the same input, it is not a function. This single idea β€” one input, one output β€” is the foundation for nearly everything you will study from this point forward in algebra, trigonometry, and calculus.

Relations vs. Functions

A relation is any set of ordered pairs (x,y)(x, y). Every function is a relation, but not every relation is a function. The difference comes down to one question: Does every xx-value pair with exactly one yy-value?

RelationOrdered pairsFunction?
AA{(1,3),β€…β€Š(2,5),β€…β€Š(3,7)}\{(1, 3),\; (2, 5),\; (3, 7)\}Yes β€” each input appears once
BB{(1,4),β€…β€Š(1,6),β€…β€Š(2,5)}\{(1, 4),\; (1, 6),\; (2, 5)\}No β€” input 1 maps to both 4 and 6
CC{(2,9),β€…β€Š(3,9),β€…β€Š(4,9)}\{(2, 9),\; (3, 9),\; (4, 9)\}Yes β€” different inputs may share an output

Relation CC is worth studying. Multiple inputs are allowed to produce the same output. The rule is only violated when a single input produces multiple outputs.

The Function Machine Analogy

Imagine a vending machine. You press button A3 (the input), and exactly one snack drops out (the output). If pressing A3 sometimes gave you chips and other times gave you pretzels at random, the machine would be broken β€” it would not be a function. A properly working vending machine is a function: every button maps to exactly one product.

In algebra, the β€œmachine” is a rule like β€œmultiply by 2 and add 3.” Feed in x=4x = 4:

output=2(4)+3=11\text{output} = 2(4) + 3 = 11

Feed in x=βˆ’1x = -1:

output=2(βˆ’1)+3=1\text{output} = 2(-1) + 3 = 1

Every input produces exactly one output, so this rule is a function.

The Vertical Line Test

When you have a graph, the fastest way to check whether it represents a function is the vertical line test. Imagine sliding a vertical line across the graph from left to right:

  • If every vertical line crosses the graph at most once, the graph is a function.
  • If any vertical line crosses the graph more than once, the graph is not a function.

Example 1: Is the graph of y=2xβˆ’1y = 2x - 1 a function?

The graph of y=2xβˆ’1y = 2x - 1 is a straight line. Any vertical line you draw will cross it exactly once.

Answer: Yes, it is a function.

Example 2: Is the graph of x2+y2=25x^2 + y^2 = 25 a function?

This equation describes a circle with radius 5 centered at the origin. A vertical line at x=3x = 3, for example, crosses the circle at both y=4y = 4 and y=βˆ’4y = -4.

Answer: No, it is not a function β€” it fails the vertical line test.

Example 3: Is {(0,2),β€…β€Š(1,5),β€…β€Š(2,8),β€…β€Š(3,11)}\{(0, 2),\; (1, 5),\; (2, 8),\; (3, 11)\} a function?

Check the xx-values: 0, 1, 2, 3. No repeats β€” each input appears exactly once.

Answer: Yes, it is a function.

Domain and Range β€” First Look

Every function has two companion concepts:

  • Domain: the set of all valid inputs (xx-values)
  • Range: the set of all resulting outputs (yy-values)

For the function described by {(0,2),β€…β€Š(1,5),β€…β€Š(2,8),β€…β€Š(3,11)}\{(0, 2),\; (1, 5),\; (2, 8),\; (3, 11)\}:

  • Domain ={0,1,2,3}= \{0, 1, 2, 3\}
  • Range ={2,5,8,11}= \{2, 5, 8, 11\}

For the linear function y=2xβˆ’1y = 2x - 1 with no restrictions, every real number is a valid input, and every real number is a possible output:

  • Domain =(βˆ’βˆž,∞)= (-\infty, \infty)
  • Range =(βˆ’βˆž,∞)= (-\infty, \infty)

You will explore domain and range in much more depth in Domain and Range.

Identifying Functions from Tables

A table of values represents a function if and only if no xx-value is repeated with a different yy-value.

Example 4: Does this table represent a function?

xxyy
βˆ’2-244
βˆ’1-111
0000
1111
2244

The xx-values are βˆ’2,βˆ’1,0,1,2-2, -1, 0, 1, 2 β€” all unique. Even though y=4y = 4 appears twice and y=1y = 1 appears twice, that is perfectly fine. Different inputs may share the same output.

Answer: Yes, this is a function. (In fact, it is y=x2y = x^2.)

Example 5: Does this table represent a function?

xxyy
3377
5522
33βˆ’1-1
8844

The input x=3x = 3 appears twice with different outputs (y=7y = 7 and y=βˆ’1y = -1).

Answer: No, this is not a function.

Identifying Functions from Equations

Most equations in the form y=(expressionΒ inΒ x)y = \text{(expression in } x\text{)} are functions because the rule gives a single yy for each xx. Some common non-function equations to watch for:

  • Circles: x2+y2=r2x^2 + y^2 = r^2 β€” two yy-values for most xx-values
  • Horizontal relations like x=y2x = y^2 β€” two yy-values for each positive xx

Example 6: Is y=x2+3y = x^2 + 3 a function?

For any input xx, squaring it and adding 3 gives exactly one result. For instance, x=2x = 2 gives y=7y = 7, and there is no other value yy could be.

Answer: Yes, it is a function.

Example 7: Is x=y2x = y^2 a function (of xx)?

If x=9x = 9, then yy could be 33 or βˆ’3-3. One input, two outputs.

Answer: No, it is not a function of xx.

Real-World Application: Nursing β€” Dosage as a Function of Weight

In clinical settings, many medication dosages are calculated as a function of patient weight. A common model for a certain antibiotic is:

D(w)=5wD(w) = 5w

where DD is the dosage in milligrams and ww is the patient’s weight in kilograms.

  • A 60 kg patient: D(60)=5(60)=300D(60) = 5(60) = 300 mg
  • An 80 kg patient: D(80)=5(80)=400D(80) = 5(80) = 400 mg

This is a function because each weight maps to exactly one dosage. A nurse would never want a formula that gives two different dosages for the same patient weight β€” that would be dangerous and, mathematically, not a function.

Domain in context: Patient weight must be positive, so the domain is w>0w > 0. In practice, it might be restricted further (e.g., 2 kg to 200 kg for typical patients).

Real-World Application: Electrician β€” Voltage as a Function of Current

Ohm’s Law states:

V(I)=IRV(I) = IR

where VV is voltage in volts, II is current in amps, and RR is resistance in ohms (treated as a constant for a given resistor). For a 50-ohm resistor:

V(I)=50IV(I) = 50I

  • At I=0.5I = 0.5 amps: V(0.5)=50(0.5)=25V(0.5) = 50(0.5) = 25 volts
  • At I=2I = 2 amps: V(2)=50(2)=100V(2) = 50(2) = 100 volts

Every current value produces exactly one voltage. This is a function.

Common Mistakes to Avoid

  1. Thinking two inputs cannot share the same output. They absolutely can. In y=x2y = x^2, both x=3x = 3 and x=βˆ’3x = -3 give y=9y = 9. That is still a function.
  2. Confusing β€œrelation” with β€œfunction.” All functions are relations, but not all relations are functions. The word β€œrelation” is more general.
  3. Applying the vertical line test to a table. The vertical line test applies to graphs. For tables, check whether any xx-value is repeated with different yy-values.
  4. Assuming every equation is a function. Equations like x2+y2=25x^2 + y^2 = 25 (a circle) are not functions because a single xx can yield two yy-values.
  5. Forgetting that the domain matters. A rule might fail to be a function on one domain but succeed on another. For instance, x=y2x = y^2 is not a function from xx to yy, but if you restrict yβ‰₯0y \geq 0, then y=xy = \sqrt{x} is a function.

Practice Problems

Test your understanding with these problems. Click to reveal each answer.

Problem 1: Is the relation {(2,5),β€…β€Š(3,8),β€…β€Š(4,5),β€…β€Š(5,12)}\{(2, 5),\; (3, 8),\; (4, 5),\; (5, 12)\} a function?

Check the xx-values: 2, 3, 4, 5 β€” all unique. Even though y=5y = 5 appears twice (for x=2x = 2 and x=4x = 4), that is allowed.

Answer: Yes, it is a function.

Problem 2: Is the relation {(1,3),β€…β€Š(2,7),β€…β€Š(1,βˆ’3),β€…β€Š(4,9)}\{(1, 3),\; (2, 7),\; (1, -3),\; (4, 9)\} a function?

The input x=1x = 1 maps to both y=3y = 3 and y=βˆ’3y = -3. One input, two outputs.

Answer: No, it is not a function.

Problem 3: A vending machine has 10 buttons, each dispensing a unique snack. Is this a function from buttons to snacks?

Yes. Each button (input) produces exactly one snack (output). Different buttons produce different snacks, but that is not required β€” what matters is that no single button gives two different snacks.

Answer: Yes, it is a function.

Problem 4: Does the equation y=3xβˆ’7y = 3x - 7 define a function?

For any value of xx, multiplying by 3 and subtracting 7 gives exactly one value of yy. For example, x=2x = 2 gives y=3(2)βˆ’7=βˆ’1y = 3(2) - 7 = -1 and no other value.

Answer: Yes, it is a function.

Problem 5: Does the equation x2+y2=100x^2 + y^2 = 100 define yy as a function of xx?

This is a circle with radius 10. At x=6x = 6, for instance, y2=100βˆ’36=64y^2 = 100 - 36 = 64, so y=8y = 8 or y=βˆ’8y = -8. One input yields two outputs.

Answer: No, it is not a function. It fails the vertical line test.

Problem 6: A nurse uses the rule D(w)=10w+50D(w) = 10w + 50 to calculate a dosage in milligrams based on a patient’s weight ww in kilograms. What is the dosage for a 70 kg patient? Is this rule a function?

D(70)=10(70)+50=700+50=750Β mgD(70) = 10(70) + 50 = 700 + 50 = 750 \text{ mg}

Each weight gives exactly one dosage, so this is a function.

Answer: 750 mg. Yes, it is a function.

Problem 7: An electrician measures voltage across a 120-ohm resistor using V=120IV = 120I. Find the voltage when the current is 0.25 amps. State the domain and range in context.

V=120(0.25)=30Β voltsV = 120(0.25) = 30 \text{ volts}

Domain: Current must be non-negative in this context, so Iβ‰₯0I \geq 0.

Range: Voltage is also non-negative: Vβ‰₯0V \geq 0.

Answer: 30 volts. Domain: Iβ‰₯0I \geq 0. Range: Vβ‰₯0V \geq 0.

Key Takeaways

  • A function assigns exactly one output to every input β€” one input, one output
  • A relation is any set of ordered pairs; a function is a special type of relation
  • The vertical line test checks graphs: if any vertical line hits the curve more than once, it is not a function
  • Multiple inputs can share the same output without violating the function definition
  • Domain is the set of valid inputs; Range is the set of resulting outputs
  • Functions model real-world relationships (dosage vs. weight, voltage vs. current) where a single input must produce a single, predictable result

Return to Algebra for more topics in this section.

Last updated: March 29, 2026