Function of a sum
false(a + b)² = a² + 2ab + b², and the 2ab disappears when you distribute f. The sides only match when a = 0 or b = 0.
A function is a rule that takes a number and returns exactly one number. You put in the input x, the rule does its work and out comes f(x). Here you will see what can go in (the domain), what can come out (the range), how to recognize a function from its graph and how to compute f(x) without skipping steps.
Pick a rule and change the input. See what comes out, where the point lands on the graph and when the machine refuses the number.
A function f from a set A to a set B is a rule that assigns to each element x of A exactly one element of B, called f(x). You write:
Read it as “f from A to B” and “f of x”. f(x) is not f times x: it is the name of the output the rule gives for the input x. With f(x) = 2x + 1, f(3) is the output for the input 3: 2 · 3 + 1 = 7.
Domain: the set of allowed inputs. In practice, every number for which the rule makes sense.
Codomain: where the outputs live, the set declared in f: A → B. Not every element of it has to be reached.
Range: the outputs that actually show up. With f(x) = x² on the reals, the codomain is ℝ, but the range is only [0, +∞): no square is negative.
The two words that carry the definition are “each” and “exactly one”:
A function can also be given as a list of (input, output) pairs. Here are two lists:
function Each input (1, 2 and 3) appears only once. That 1 and 2 both give 5 is no problem.
not a function The input 1 has two outputs, 5 and 7. There is no way to say what f(1) is.
Interval notation. Domains and ranges are often intervals. A bracket says the endpoint is included; a parenthesis, that it is not: [2, 5] runs from 2 to 5 with both ends, (2, 5] leaves 2 out, and [0, +∞) means “from 0 on”. Infinity always takes a parenthesis, because it is not a number you reach. When a single point is missing, use a backslash: ℝ ∖ {0} means “every real number except 0”.
On a graph, each input x is a vertical line. If some vertical line crosses the curve more than once, that x would have two outputs, and the curve is not the graph of a function. Pick a curve and drag the line.
Pick the kind of rule, the coefficients (whole numbers from −20 to 20) and the input x (up to two decimal places, from −100 to 100). The calculator replaces x with the number, does one operation at a time and shows the domain and range on the graph: the domain in green on the x-axis, the range in purple on the y-axis.
Many functions come as a graph, not a formula. This one shows a city's temperature every hour of one day (made-up numbers for the example). The input is the hour; the output, the temperature. Drag on the graph or use the slider.
To read T(h), find h on the bottom axis, go up to the curve and look at the height. At 14 h, the curve is at height 28: T(14) = 28 °C.
What the graph does not say. The temperature was measured every hour; between two measurements, the straight segments are just one way of joining the points. Following the segment from 7 h (17 °C) to 8 h (19 °C), for example, the temperature would have passed 18 °C at 7:30, but that is an assumption, not a measurement.
The parentheses in f(…) look like those of a multiplication, and that tempts you to “distribute f”. With f(x) = x², test it with your own numbers: the values are the same in every card.
(a + b)² = a² + 2ab + b², and the 2ab disappears when you distribute f. The sides only match when a = 0 or b = 0.
f(2x) is the rule applied to the number 2x; 2f(x) is twice the output. With x², the first gives 4x² and the second, 2x². They only match at x = 0.
For a rule of the kind “multiply by a fixed number”, the sum goes through, by the distributive property: 3(a + b) = 3a + 3b. It is the exception, not the rule: with 3x + 1 it already fails.
f(x) is not multiplication. f is the name of the rule; f(x), the output for the input x.
Order changes everything. With f(x) = x + 1 and x = 3: f(3)² = 4² = 16, but f(3²) = f(9) = 10.
Range is not codomain. The range is what actually comes out; the codomain is where the output may be.
A negative input goes in parentheses. With f(x) = x², f(−3) = (−3)² = 9, not −3² = −9.
The numbers in this example are made up to keep the arithmetic simple. A taxi ride costs a flag fare of R$ 5.00 (the fixed amount for getting in) plus R$ 2.50 per kilometer driven (prices in Brazilian reais). (a) How much does a 12 km ride cost? (b) With R$ 50.00, how many kilometers can you ride? (c) What are the domain and range of this function?
Data (from the problem): flag fare, R$ 5.00; price per kilometer, R$ 2.50; ride distance in (a), d = 12 km; money available in (b), R$ 50.00.
Formula. The price P, in reais, depends on the distance d, in kilometers: it is the flag fare plus 2.50 for each kilometer.
Each distance gives exactly one price, so P is a function: the input is d, the output is P(d).
(a) Substitution. Replace d with 12:
Arithmetic. Multiplication first, then addition:
Result: the 12 km ride costs R$ 35.00 (exact, no rounding).
(b) The reverse path. Now the output is known, P(d) = 50, and the input is missing. Write the equation and isolate d:
Subtract 5 from both sides:
Divide both sides by 2.5:
Check: P(18) = 5 + 2.5 · 18 = 5 + 45 = 50. Result: R$ 50.00 pays for 18 km.
(c) Domain and range. The formula would accept any number, but a ride's distance is not negative: the domain, in this context, is d ≥ 0, or [0, +∞). The lowest price is the one for d = 0, P(0) = 5, and each extra kilometer only raises the price; every value from 5 up is reached by some distance (d = (P − 5)/2.5). The range is [5, +∞), in reais.
Interpretation. A 12 km ride costs R$ 35.00, and R$ 50.00 pays for 18 km. No ride costs less than R$ 5.00, even if the car does not move: that is what a range starting at 5 means. The example also shows that the domain does not come only from the formula: here it was cut down by what d means.
What the model does not say. A real taxi also charges for waiting time and changes the fare by time of day. The function P(d) = 5 + 2.5d is a simplification; with other prices, the numbers change, not the reasoning.
The next lessons study families of functions: linear functions (in Portuguese), whose graph is a straight line, and the parabola of the quadratic equation (in Portuguese). The post on functions in calculus goes further: composition, inverse functions, even and odd functions and piecewise functions.
In statistics, a probability distribution (in Portuguese) is a function: the input is a possible value; the output, a probability or a density. A regression line is a function that gives, for each x, a predicted y.
Data do not always form a function. In a group of students, two can study the same 4 hours and get different grades: the pair (hours, grade) shows up with the same input and two outputs. That is why regression (in Portuguese) does not connect all the points: it looks for the function that passes closest to them.
1. Which of these lists of (input, output) pairs is a function? {(1, 3), (2, 3), (3, 3)} and {(2, 1), (2, 4), (5, 0)}.
The first one is: each input appears once, and all of them give 3 (it is a constant function). The second one is not: the input 2 has two outputs, 1 and 4.
2. With f(x) = x² − 3x, compute f(−2).
f(−2) = (−2)² − 3 · (−2) = 4 − (−6) = 4 + 6 = 10.
3. What is the domain of g(x) = √(6 − 2x)?
What is inside the root cannot be negative: 6 − 2x ≥ 0, so −2x ≥ −6. Dividing by −2, which is negative, flips the inequality: x ≤ 3. Domain: (−∞, 3].
4. Give the domain and range of h(x) = 5/(x − 2) and compute h(4).
The denominator is zero at x = 2: domain ℝ ∖ {2}. A fraction with 5 on top is never zero, and every other value is reached: range ℝ ∖ {0}. h(4) = 5/(4 − 2) = 5/2 = 2.5.
5. What is the range of f(x) = −x² + 4x?
With a = −1 < 0, the parabola opens downward and the vertex is its highest point. xv = −4/(2 · (−1)) = 2 and f(2) = −4 + 8 = 4. Range: (−∞, 4].
6. On the temperature graph, what is T(9)? At which whole hours was the temperature 23 °C?
T(9) = 21 °C. The temperature was 23 °C at 10 h and at 18 h: rising in the morning and falling in the evening.
7. Is the circle x² + y² = 25 the graph of a function y = f(x)?
No. The vertical line x = 0 crosses the circle at (0, 5) and (0, −5): the input 0 would have two outputs.
What the page claims always holds (the circle and the sideways parabola not being functions, the traps with x², the domain and range of the calculator's four rules, and the taxi arithmetic) is proved in the Lean proof assistant, with the same hypotheses as the text (provas/Provas/FuncaoElementar.lean, in the site's repository). The calculator was checked by computer against exact fraction arithmetic.