Functions and Rational Functions

☰ Contents

A function is a rule that takes an input and gives back exactly one output. That definition decides which inputs are allowed, when a rule can be run backwards, and why some graphs have gaps.

What does f(x) mean?

f(x) is the output of the function f when the input is x. It is not f multiplied by x. To evaluate it, put the input in place of every x in the rule. If f(x) = x² − 3x, then f(5) is 5² − 3 × 5 = 25 − 15 = 10. The x is only a placeholder, so any number or expression can take its place: f(a + 1) means (a + 1)² − 3(a + 1). The notation is useful because it names the input and the output in one symbol, so a statement such as f(5) = 10 records both at once. A negative input needs brackets: f(−2) is (−2)² − 3 × (−2) = 4 + 6 = 10, and leaving the brackets out turns (−2)² into −4. Check a value against the graph: the point (5, 10) lies on the curve y = f(x), because y is the output when x is 5.

12345−224xy

passing through (2, 3) forces 2m + c = 3, so each intercept c fixes m = (3 − c) / 2

Make the line pass through (2, 3)

4× 312+ 113f(4) = 13
f(4) does not mean f times 4. It means substitute 4 for x: 3 × 4 + 1 = 13. Full lesson: Function Notation

If f(x) = 2x + 1, then f(3) = 2 × 3 + 1 = 7. In the same way, f(a + 1) = 2a + 3.

xy
Plot every input against its output and the rule becomes a picture. Full lesson: Function Notation

See Function Notation.

Now you

xy

f(x) = 6x + 1. What is f(5)?

xy

f(x) = 6x − 4. What is f(6)?

How do you find the domain and range?

The domain is the set of inputs a function accepts, and the range is the set of outputs it produces. Begin the domain with all real numbers and remove every value that breaks a rule: a denominator cannot be zero, a square root cannot hold a negative number, and a logarithm needs a positive input. For f(x) = √(x − 3) + 1, the root needs x − 3 ≥ 0, so the domain is x ≥ 3. The smallest root is 0, at x = 3, so the smallest output is 0 + 1 = 1, and the range is y ≥ 1. These rules exist because each operation is undefined outside them. A real setting can shrink the domain further, as when a length must be positive. The range usually needs the graph or the shape of the rule, not a list of banned values. Test with a value: x = 7 gives √4 + 1, which is 3, inside the range.

domain ℝrange (−∞, 4]f(1) = 3√(x + 3)1/(x − 1)4 − x²

4 − x²: every x is allowed, so the whole x-axis is lit; but 4 − x² ≤ 4, so the y-shadow stops at 4 and never goes above

Choose √(x + 3) and drag the point to where its shadow starts

Two more examples: f(x) = 1/(x − 2) has domain every real number except 2. f(x) = √(x − 5) has domain x ≥ 5.

xy
Here x cannot be zero at all, because dividing by zero has no answer. Full lesson: Domain and Range

For f(x) = x² every input is allowed, but a square is never negative, so the range is y ≥ 0.

xy
But x² is never negative, so the range, the set of outputs, is every number from 0 up. Full lesson: Domain and Range

See Domain and Range.

Now you

x

f(x) = 1 / (x − 6). Which input is not allowed?

xy

f(x) = x² + 9. What is the smallest output?

Functions built out of pieces

A piecewise function uses a different rule on each stretch of its domain. To evaluate it, first find which stretch the input falls in, then use that rule. The boundary belongs to the rule whose inequality includes "or equal to".

f(x) = 2x + 1 for x < 1f(x) = 5 − x for x ≥ 1f(0.4) = 1.8< → ≤

x = 0.4 < 1: the first rule is in charge, f(x) = 2x + 1 = 1.8, and the other line is not consulted

Drag x to exactly 1 and read which rule owns it

f(0): 0 < 3, so use 2x + 1f(0) = 1
To evaluate, first find which interval the input is in, then use that rule. Full lesson: Piecewise Functions
xy(2, 3)(2, 4)
A hollow dot marks a point that is not there; a filled dot marks one that is. Full lesson: Graphing a Piecewise Function

The pieces join without a jump when both rules give the same value at the boundary. To make that happen, work out each rule at the boundary, set the two values equal, and solve for the unknown constant.

2 + k = 4the only value that joins themk = 2
Set the two equal, and one value of k is left: k = 2. Full lesson: Making a Piecewise Function Continuous

See Piecewise Functions, Graphing a Piecewise Function and Making a Piecewise Function Continuous.

Composite and inverse functions

A composite function sends the output of one function into another as its input. fg(x) means f(g(x)): apply g first, then f. If f(x) = x + 1 and g(x) = x², then fg(2) = f(4) = 5, but gf(2) = g(3) = 9.

y = xP′ (2.2, 1.3)P (1.3, 2.2)f(x) = x³f(x) = x²

P = (a, a³) reflects in y = x to P′ = (a³, a): swap the coordinates and the mirror point traces the inverse, y = ∛x, which is still a function

On x³, drag P to (2, 8) and read where its mirror lands

4g: × 28f: + 311fg(4) — g first. Same boxes, different answer
fg means do g first: 4 becomes 8, then adding 3 gives 11. The order matters. Full lesson: Composite Functions

An inverse function undoes the original: if f sends 3 to 10, then f⁻¹ sends 10 back to 3. To find one, reverse the order of the steps and replace each step with its opposite. f(x) = 3x + 1 multiplies by 3 and then adds 1, so f⁻¹ subtracts 1 and then divides by 3: f⁻¹(x) = (x − 1)/3.

y− 1y − 1÷ 3(y − 1)/3f⁻¹ undoes it backwards
To undo it, reverse the order of the steps and swap each step for its opposite. Full lesson: Inverse Functions

Swapping input and output swaps the coordinates of every point, so (3, 10) becomes (10, 3).

xy
The inverse is the original reflected in the line y = x. Full lesson: Inverse Functions
Not every function has an inverse. Since 3² = 9 and (−3)² = 9, an inverse of x² would have to send 9 to two outputs, and a function may give only one. That is why √9 means the positive root only, and why a question restricts the domain to x ≥ 0 before asking for the inverse of x².

See Composite Functions and Inverse Functions.

Now you

gf(4)what does this come to?

f(x) = x + 2, g(x) = 3x. What is gf(4)?

gf(3)what does this come to?

f(x) = x + 6, g(x) = 4x. What is gf(3)?

How do transformations change a graph?

A change outside the bracket acts on the output and moves the graph the way it reads: y = x² + 3 lifts every point of y = x² up 3. Inside the bracket, a change acts on the input and works in reverse: y = (x − 3)² shifts the graph 3 to the right. The reversal happens because x must now be 3 bigger to give the bracket the same value, so the vertex moves from x = 0 to x = 3. When several changes act together, apply those inside the bracket first and those outside last: y = 2(x − 3)² + 3 shifts right 3, doubles every height, then lifts 3. Check with one point: (1, 1) on y = x² should move to (4, 4) on y = (x − 3)² + 3, and indeed (4 − 3)² + 3 = 1 + 3 = 4.

−3−2−1123x − c = 0x = 0

c = 0: f(x − 0) = f(x), so the graph is where it started

Set c = 3 and find where the peak lands

y = (x − 3)²
Subtract 3 inside the bracket, (x − 3)², and the curve moves 3 to the right. Full lesson: Transforming Graphs

Stretches follow the same split. y = 2x² doubles every height, and no point moves sideways. y = (2x)² − 4 acts on the input, so the bracket reaches its old value at half the x, and the curve is squashed to half its width.

xy
y = 2x² doubles every height, so the curve is stretched away from the x-axis. Full lesson: Stretching a Graph Vertically
xy−11
So y = (2x)² − 4 crosses at −1 and 1: the curve is squashed toward the axis. Full lesson: Stretching a Graph Horizontally

See Transforming Graphs, Stretching a Graph Vertically and Stretching a Graph Horizontally.

What makes exponential growth different?

Exponential growth multiplies by the same factor at each step, while linear growth adds the same amount. After n steps of doubling, a starting amount A has become A × 2ⁿ. From 3, adding 3 each step gives 6, 9, 12, 15, but doubling gives 6, 12, 24, 48. Doubling ten times multiplies by 1,024, and 3 × 1,024 = 3,072 against 3 + 10 × 3 = 33. Each exponential step is bigger than the last because the increase is a fixed fraction of the current amount, so the curve eventually overtakes any straight line. A percentage rate gives the factor: growth of 10% a year multiplies by 11/10. The picture reverses when the factor is below 1: the amount shrinks toward zero without reaching it, which is exponential decay. To test data, divide each term by the one before. For 6, 12, 24, 48 every ratio is 2, while the differences 6, 12, 24 keep changing.

−2−10123456y = 2xy = 2ˣ2ˣ: 4 → 8 (× 2, + 4)2x: 4 → 6 (+ 2)

one unit along: 2ˣ goes 4 → 8, ×2, an increase of 4; 2x gains +2 as always: the exponential adds a fixed fraction of itself, the line adds a fixed amount

Slide the bracket to start at x = 5 and read both gains

xy
Adding the same amount each time gives a line. Multiplying gives this curve. Full lesson: Exponential Growth

A half-life of 3 days means the amount halves every 3 days: 80 g becomes 40 g, then 20 g, then 10 g.

xy
It closes in on zero forever without reaching it — half of something is never zero. Full lesson: Exponential Decay

Nothing real doubles forever, because the room runs out. A logistic model grows like an exponential at first, then flattens onto a ceiling called the carrying capacity.

xy
A real population flattens onto a ceiling instead: the carrying capacity. Full lesson: Logistic Growth and Carrying Capacity

See Exponential Growth, Exponential Decay, Growth and Decay Problems and Logistic Growth and Carrying Capacity.

What is a logarithm for?

A logarithm gives the power that a base must be raised to: log₂ 8 = 3 because 2³ = 8. Taking a logarithm undoes raising to a power, as subtraction undoes addition. In general, the logarithm of y to base b is the number x with bˣ = y, so every logarithm fact is an exponent fact read backward: log₁₀ 1000 = 3, since 10 × 10 × 10 = 1,000. Logarithms solve equations with the unknown in the exponent. When the answer is not a whole number, take the logarithm of both sides and bring the power down with the power law: 5ˣ = 30 gives x log 5 = log 30, so x = log 30 / log 5. Only positive numbers have real logarithms, since no power of a positive base is zero or negative. Confirm by raising the base to the answer: 2 × 2 × 2 = 8.

52 to the …32log₂5the log undoes the power
The same fact, read the other way: what power of 2 gives 32? Full lesson: Exponentials and Logarithms

The laws of logarithms come from the laws of exponents. Multiplying powers of one base adds the exponents, 2³ × 2⁴ = 2⁷, so log(ab) = log a + log b. Dividing subtracts: log(a / b) = log a − log b. A power is repeated multiplying, so the exponent comes to the front: log(xⁿ) = n log x.

log 66 = 2 × 3log(2 × 3)multiplying inside becomes adding outsidelog 2 + log 3
So log(ab) = log a + log b, in any base — so long as it is one base throughout. Full lesson: The Laws of Logarithms

To solve 3ˣ = 20: x log 3 = log 20, so x = log 20 / log 3 ≈ 2.727.

take the log of both sides
the power law brings the x down
x log 2 = log 32
Take the log of both sides, and the power law brings the x down from the exponent. Full lesson: Solving Exponential Equations

A calculator offers only log₁₀ and ln, and the change of base rule reaches every other base from those two: log₂ N = log N / log 2. ln is the logarithm with base e ≈ 2.718, and it obeys every law above.

See Exponentials and Logarithms, The Laws of Logarithms, Solving Exponential Equations, The Change of Base Rule and The Natural Logarithm.

Now you

small enough to count, and the log agrees
x = ?

3^x = 27. What is x?

x is in the exponent, so dividing will not reach it
x = ?

2^x = 40. Which expression gives x?

Reading data on a log scale

A logarithmic axis places each value v at distance log v, so equal distances stand for equal multiples: 1, 10, 100 and 1000 are evenly spaced.

250050007500100001234linear axismorph

linear axis: 10, 100 and 1000 are all within the bottom tenth, and 10000 sets the scale; the ×10 steps are invisible

Slide the axis all the way to log scale

xy(2, 4)(4, 2)
So y = log₂x is y = 2ˣ reflected in that line: every (a, b) becomes (b, a). Full lesson: Logarithmic Graphs

A log axis tests for exponential growth. If y = a × bˣ, taking logs of both sides gives log y = log a + x log b, a straight line in x. Plot log y against x: if the points straighten, the data is exponential, and undoing the logs on the gradient and the intercept recovers b and a.

xy
Plot log y instead of y and the curve straightens: same data, now a line. Full lesson: Straightening Growth with Logarithms

The axis that takes the logs picks the model. A power law y = a xⁿ straightens when log y is plotted against log x, and the gradient is n. A logarithmic model y = a + b ln x straightens when y is plotted against ln x.

ln xscore
Plot the same scores against ln x and the bend straightens into a line. Full lesson: Fitting a Logarithmic Model

See Logarithmic Graphs, Straightening Growth with Logarithms, Straightening a Power Law and Fitting a Logarithmic Model.

Why do some graphs have gaps?

A rational function is one polynomial divided by another, and it has no value where the denominator is zero, so its graph has a gap there. Factor both, then check each factor that makes the denominator zero. If it does not cancel, the graph has a vertical asymptote: y = 1/(x − 3) has one at x = 3, because near 3 the denominator is tiny and the values grow without bound. If it cancels, the gap is a single missing point, a hole. For y = (x² − 9)/(x − 3), the top is (x − 3)(x + 3), so the graph is the line y = x + 3 with the point at x = 3 removed, at height 3 + 3 = 6. The fraction and the line agree everywhere except at x = 3. Nearby inputs test an asymptote: 1/(x − 3) is 100 at x = 3 + 1/100 and −100 at x = 3 − 1/100.

x = 2f(1.5) = −21 / (x − 2)(x² − 4) / (x − 2)

at x = 2 the denominator is 0 and the numerator is not, so f grows without bound: a vertical asymptote, with opposite signs either side

Bring x to 0.1 from the forbidden point

A fraction is zero only when its numerator is zero, so the zeros of the numerator are the x-intercepts.

xy
At x = 3 the denominator is zero, and division by zero is undefined. Full lesson: Zeros and Vertical Asymptotes

(x² − 4)/(x − 2) = (x − 2)(x + 2)/(x − 2). Cancel, and x + 2 is left for every x except 2, where the original reads 0 ÷ 0. A hole is a removable discontinuity; an asymptote cannot be repaired.

xy(2, 4)
So the graph is the line y = x + 2 with exactly one point missing: a hole. Full lesson: Holes Where a Factor Cancels

Far from the origin the leading terms decide the shape, so compare the degrees of the top and the bottom. If the bottom has the higher degree, the curve flattens onto y = 0. If the degrees are equal, it flattens onto the ratio of the leading coefficients: (2x + 1)/(x − 1) flattens onto y = 2. If the top is exactly one degree higher, the curve approaches a slanted line instead.

Long division finds that line. Divide polynomials the way you divide numbers: compare the leading terms, multiply back, subtract, and repeat. The quotient is the slant asymptote, and the remainder over the divisor fades to nothing far out. (x² + 3x + 5)/(x + 1) = x + 2 + 3/(x + 1), so the slant asymptote is y = x + 2.

xy
The curve approaches that slant line on both sides and never meets it. Full lesson: Slant Asymptotes by Long Division

See Zeros and Vertical Asymptotes, Holes Where a Factor Cancels, Horizontal Asymptotes by Degree, Long Division of Polynomials and Slant Asymptotes by Long Division.

Now you

xy

What is the horizontal asymptote of y = (x + 4)/(x² + 1)?

xy

What is the horizontal asymptote of y = (x + 3)/(x² + 5)?

The mistakes worth naming

Graphs of equations and coordinate geometry covers the lines and curves these transformations act on, and sequences and series continues from exponential growth into geometric series. Related guides: Limits and Continuity and Quadratics and Polynomials.

Your turn

Three to try — tap what you get.

f(x) = 2x + 3. What is f(4)?

Where is 1/(x − 2) undefined?

f(x) = x² and g(x) = x + 1. f(g(2))?

Questions and answers

What does f(x) actually mean?
It means the output of the rule f when the input is x, and it is not f multiplied by x. If f(x) equals 2x plus 1, then f(3) is 7. The notation exists so that a rule can be named once and used many times, and so that you can talk about the output at an unnamed input, which is what makes calculus expressible at all.
How do you find the domain of a function?
Start with every real number and remove the inputs that break the rule. Division by zero removes any x that makes a denominator zero, square roots remove anything that would make the inside negative, and logarithms remove zero and everything below it. For f(x) equal to 1 over (x minus 2), the domain is every real number except 2.
Why does the inverse of a function reflect in the line y = x?
Because the inverse swaps the roles of input and output, and swapping the coordinates of a point is exactly what reflecting in y = x does to it. If the original function sends 3 to 10, its graph passes through (3, 10) and the inverse's graph passes through (10, 3). Doing that to every point at once reflects the whole curve.
What is a logarithm, in plain terms?
A logarithm answers the question 'what power do I need?'. Log base 2 of 8 is 3 because 2 to the power 3 is 8. It is the inverse of raising to a power, which is why it is the tool that gets an unknown down out of an exponent — and why the laws of logarithms turn multiplication into addition.
What is a vertical asymptote, and how is it different from a hole?
A vertical asymptote is an input the function cannot take where the graph runs off to infinity on at least one side; a hole is an input it cannot take where the graph would otherwise be ordinary. The difference is whether the troublesome factor cancels. In (x² − 1)/(x − 1) the factor cancels, so there is a hole at x = 1; in 1/(x − 1) nothing cancels, so it is an asymptote.
How do you find the horizontal asymptote of a rational function?
Compare the degrees of the top and the bottom. If the bottom has the higher degree the asymptote is y = 0; if the degrees are equal it is the ratio of the leading coefficients; and if the top is exactly one degree higher there is no horizontal asymptote but there is a slanted one, found by long division. For very large x, only the leading terms matter, which is why the degrees are the whole story.
Mr. Chalk