MathLabs

Grade 8

Functions and their graphs

The correspondence between inputs and outputs, and its visual representation as a graph.

IntuitionA Machine That Turns Inputs Into Outputs

Picture a vending machine: you put in a code (the input), and out comes exactly one snack (the output) — never two different snacks for the same code. A function is the mathematical version of this idea: a rule that assigns to each input xx exactly one output, written y=f(x)y=f(x). For instance the rule "double the input, then subtract one" is the function y=2x−1y=2x-1: feeding in x=3x=3 produces y=5y=5, and feeding in the same x=3x=3 again always produces the same y=5y=5 — that reliability is exactly what makes it a function.

A straight line graph controlled by adjustable slope and intercept sliders.
The line f(x)=2x−1f(x)=2x-1: drag cc to change the slope and dd to change the intercept, and watch every point on the line stay of the form (x0,f(x0))(x_0,f(x_0)).

SchoolDomain, Graph, and the Linear Function

Definition: Graph of a function

The graph of a function ff is the set of every point (x0,f(x0))(x_0,f(x_0)) obtained by letting x0x_0 range over all valid inputs (the domain). Plotting these points in the coordinate plane turns the abstract rule into a picture we can read at a glance.

y=f(x)y=f(x)

A linear function has the form y=ax+by=ax+b where aa is the slope (rate of change of yy per unit of xx) and bb is the yy-intercept. Its graph is always a straight (non-vertical) line, and conversely every non-vertical straight line is the graph of exactly one linear function — a fact we prove below.

a=y2−y1x2−x1a=\dfrac{y_2-y_1}{x_2-x_1}
Comparing basic function behaviors
Sign of aa in y=ax+by=ax+bBehavior as xx increases
a>0a>0yy increases (line rises)
a<0a<0yy decreases (line falls)
a=0a=0y=by=b stays constant

UndergraduateTwo Fundamental Theorems

A curve CC in the coordinate plane is the graph of some function of xx if and only if every vertical line x=x0x=x_0 meets CC in at most one point.

Why is it true?

A function assigns exactly one output to each input, so a graph that hits a given vertical line twice would be assigning two different yy values to the same xx, breaking the "exactly one output" rule.

Proof

(⇒\Rightarrow) Suppose CC is the graph of a function ff, so every point of CC has the form (x0,f(x0))(x_0,f(x_0)) for some input x0x_0. Fix any vertical line x=x0x=x_0; the only points of CC that can lie on it are those with first coordinate x0x_0, and there is only one such point, (x0,f(x0))(x_0,f(x_0)), because ff assigns a single value to x0x_0. So the line meets CC in at most one point.

(⇐\Leftarrow) Conversely, suppose every vertical line meets CC in at most one point. Define ff by: for each x0x_0 that has a point of CC above it, let f(x0)f(x_0) be the yy-coordinate of that (unique, by hypothesis) point. This assigns at most one output to each input, so ff is a well-defined function, and by construction its graph is exactly CC.

The two directions together show the equivalence: being a function's graph and passing the vertical line test are the same property viewed from two angles.

Let x1≠x2x_1\ne x_2 be any two inputs of the linear function y=ax+by=ax+b, with outputs y1=ax1+by_1=ax_1+b and y2=ax2+by_2=ax_2+b. Then the slope computed between any two points of the graph is always the same constant aa: a=y2−y1x2−x1a=\dfrac{y_2-y_1}{x_2-x_1}

Why is it true?

A constant slope between every pair of points is exactly the geometric definition of "straight" — the direction never bends.

Proof

Compute the rise and run between the two points on the graph: rise =y2−y1=(ax2+b)−(ax1+b)=a(x2−x1)=y_2-y_1=(ax_2+b)-(ax_1+b)=a(x_2-x_1), using the fact that both points satisfy the same rule y=ax+by=ax+b.

Since x1≠x2x_1\ne x_2, we may divide both sides by the run x2−x1≠0x_2-x_1\ne 0: y2−y1x2−x1=a(x2−x1)x2−x1=a.\dfrac{y_2-y_1}{x_2-x_1}=\dfrac{a(x_2-x_1)}{x_2-x_1}=a.

This computation used only the values x1,x2x_1,x_2 and the rule y=ax+by=ax+b, and the bb term canceled out completely — so the ratio equals aa regardless of which two points (x1,y1),(x2,y2)(x_1,y_1),(x_2,y_2) were chosen. A curve on which the slope between every pair of points is the same fixed number is, by the geometric definition of straightness, a line; hence the graph of y=ax+by=ax+b is a straight line of slope aa.

Conversely, given any non-vertical line with slope aa passing through a point (x0,y0)(x_0,y_0), setting b=y0−ax0b=y_0-ax_0 produces a linear function y=ax+by=ax+b whose graph is exactly that line, which establishes the converse direction of the correspondence between linear functions and non-vertical lines.

UndergraduateReal-World Applications and Worked Examples

Functions and their graphs are the shared visual language of physics (distance vs. time), economics (cost vs. quantity), and computer science (input vs. output of a program): whenever one quantity is completely determined by another, a graph turns a table of numbers into a shape the eye can reason about instantly — reading off a maximum, a break-even point, or a trend at a glance.

Example: Distance traveled by a car

A car travels at a constant 3030 km/h, so the distance covered after tt hours is d=30td=30t. Sketch what the graph looks like and find the distance after t=2.5t=2.5 hours.

Solution

The rule d=30td=30t is a linear function of tt with slope a=30a=30 and intercept b=0b=0 (no head start), so by the theorem above its graph is a straight line through the origin.

Because a=30>0a=30>0, the line rises as tt increases: the car never travels backward in this model, matching the physical picture of constant forward speed.

Substituting t=2.5t=2.5: d=30×2.5=75d=30\times 2.5=75 km. Reading this off the graph would mean finding the height of the line directly above t=2.5t=2.5 on the horizontal axis.

Example: Break-even point of a small business

A small workshop has a fixed cost of 200200 (rent, equipment) plus a variable cost of 55 per item produced, so total cost is C(x)=200+5xC(x)=200+5x. Each item sells for 88, so revenue is R(x)=8xR(x)=8x. Find the break-even quantity xx, where cost equals revenue.

Solution

Both C(x)=200+5xC(x)=200+5x and R(x)=8xR(x)=8x are linear functions of xx, so by the straight-line theorem their graphs are two lines; the break-even point is where they intersect, i.e. where C(x)=R(x)C(x)=R(x).

Set the two expressions equal: 200+5x=8x200+5x=8x. Subtract 5x5x from both sides: 200=3x200=3x.

Divide both sides by 33: x=2003≈66.7x=\dfrac{200}{3}\approx 66.7. Since the workshop can only produce a whole number of items, it needs to produce and sell 6767 items to guarantee a profit.

Graphically, for x<200/3x<200/3 the cost line lies above the revenue line (the business loses money), and for x>200/3x>200/3 revenue overtakes cost (the business is profitable) — the crossing point is exactly the break-even quantity.

For the function y=2x−1y=2x-1, what is the output when x=3x=3?

Which relation is NOT a function, according to the vertical line test?

A car travels at constant speed so d=30td=30t (distance in km, tt in hours). How far has it gone after t=2.5t=2.5 hours?

In the workshop example with cost C(x)=200+5xC(x)=200+5x and revenue R(x)=8xR(x)=8x, at the break-even quantity, which statement is true?