Functions, domain and range · Mathematics Class 11–12 | StemPy Lab
Course 1.1·Lesson 3 of 3
Functions, domain and range
A function from A to B is a relation in which every element of A has exactly one image in B. A is the domain, B is the codomain and the set of images is the range. A graph is the graph of a function if no vertical line meets it twice. We find the domain of a formula by ruling out division by zero and the square root of a negative number.
about 30 min1 simulation2 practice questions1 Python program4 questions to check yourself
This lesson is free to read. Enroll free to keep your place and take the tests.
Lesson 3 of 3Show all lessonsHide
Try the code and the simulations beside the lesson.
One input, one output
A vending machine gives one item for each code. A calendar gives one day of the week for each date. A rule that gives one and only one output for every input is a function.
Here is the exact definition. A functionf from a set A to a set B is a relation in which every element of A has exactly one image in B. We write f:A→B, and y=f(x) for the image of x.
A is the domain. B is the codomain.
The range is the set of all the images, {f(x):x∈A}. It is a subset of the codomain.
Which relations are functions?
Four arrow diagrams. The first is a function: 1, 2, 3 go to 2, 4, 6, one arrow each. The second is a function in which two elements, minus 1 and 1, go to the same image 1. The third is not a function, because 1 has two arrows, to 2 and to 4. The fourth is not a function, because 3 has no arrow.
Look at the arrow diagrams. In a function, every element of the domain has exactly one arrow leaving it. Two things break this rule:
an element with two arrows, such as 1→2 and 1→4: then the image is not one number;
an element with no arrow: then the domain is not all of A.
The second diagram is a function even though two elements go to the same image. Many inputs may share an output. One input may not have two outputs.
The vertical line test
On a graph, the input is x and the output is y. A vertical line is the line of one fixed input. If the line meets the graph in two points, that input has two outputs, so the graph is not the graph of a function.
Two graphs with a vertical dashed line. On the left, a parabola meets the line at one point, so it is the graph of a function. On the right, a circle meets the line at two points, so it is not the graph of a function.
A graph is the graph of a function if and only if no vertical line meets it more than once. The circle x2+y2=4 fails the test, because for x=1 we get two values of y, ±3.
Real functions and their domain
A function with a domain and a range that are sets of real numbers is a real function. Often a function is given only by a formula, and we must find the largest set of x for which the formula works. This is the domain. Two things can go wrong:
Division by zero. The denominator must not be zero.
The square root of a negative number. The number under an even root must be zero or more.
Example 1.f(x)=x−31. The denominator is zero at x=3, so the domain is R−{3}, which is (−∞,3)∪(3,∞).
Example 2.g(x)=x−2. We need x−2≥0, so x≥2 and the domain is [2,∞).
Example 3.h(x)=x−5x−2. Both rules apply: x≥2 and x=5. The domain is [2,5)∪(5,∞).
Move a and b apart and the domain grows. Slide a past b and the curve disappears: no x makes both roots real.
Finding the range
To find the range, we write y=f(x) and ask: for which y can we solve for x?
Example.g(x)=9−x2. The domain needs 9−x2≥0, so −3≤x≤3. For these x, x2 goes from 0 to 9, so 9−x2 goes from 9 down to 0, and the root goes from 3 down to 0. The range is [0,3].
The graph of g of x equal to the square root of 9 minus x squared, which is the upper half of a circle of radius 3. A green bar along the x axis from minus 3 to 3 shows the domain. An orange bar along the y axis from 0 to 3 shows the range.
Example.f(x)=x−31. Put y=x−31. Then x−3=y1, which works for every y=0. So the range is R−{0}.
When are two functions equal?
Two functions are equal when they have the same domain and the same value at every point. Take f(x)=x−2x2−4 and g(x)=x+2. For x=2 they are the same number, but f is not defined at x=2 and g is. The domains differ, so f=g.
Practise with new numbers
Try it in Python
This program tries many values of x in the formula x−5x−2 and finds where it works.
Remember these
A function gives exactly one output for each element of the domain.
Vertical line test: no vertical line meets the graph twice.
Domain: rule out division by zero and the even root of a negative number.
Range: the values of y that actually occur.
Equal functions have the same domain and the same rule.
Check yourself
Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.
Is {(1,2),(2,3),(3,3)} a function? Is {(1,2),(1,3)}?
Find the domain of f(x)=x−7.
Find the domain of f(x)=x2−16x.
Find the range of f(x)=x2+4.
Enroll free in Sets, Relations and Functions
Every lesson is open to read. Enrolling also lets you:
Mark lessons done and carry on where you stopped.
Take the tests of this lesson and its course.
Count the course towards the certificate for its chapter.