The horizontal line test is a simple, visual way to tell if your function has an inverse function. It’s useful because it tells us whether a function is one-to-one or not. More on that in a moment.
Another benefit is that you get to draw with a colored pencil – a rare treat in math!
Horizontal Line on a Graph
One-to-One Function
Examples
Using the Horizontal Line Test
Examples
Challenge
Practice Questions
Question 1
Question 2
Question 3
Question 4
Question 5
Question 6
Question 7
Question 8
Question 9
Question 10
To Sum Up (Pun Intended!)
Horizontal Line on a Graph
What’s in a name? A horizontal line goes left to right across a page, like the horizon does on a nice sunny beach.
It’s called a test because just like a math test, there are two outcomes! A function can either pass or fail, depending on its shape. Read on, and you’ll only be passing your next math test!
One-to-One Function
Functions are math machines. Give them an input, and they give you an output.
Think of functions as ovens: put in food, and they give you a cooked meal!
If each specific input corresponds to a single specific output, the function is one-to-one. One input is converted to one output.
Functions can also be many-to-one, where several inputs have the same single output. It’s like your cake recipe: there are lots of ways to make the cake mix, but some of them give the same delicious result!
You want to be certain what food your oven makes, so you want a clear output. It would be difficult to cook with an oven which gives different food from the same ingredients!
You might come across one-to-many or many-to-many relations but, strictly speaking, these aren’t functions. Remember that each input must have only one output to be an official function.
Examples
\(f(x)=x\) is a one-to-one function because the output is exactly the same as the input. There’s no way for two numbers to simultaneously be the same and different!
\(f(x)=\sin x\) is not one-to-one because it has a repeating pattern.
For a clear example, \(\sin(0^{\circ})=0\) but \(\sin(360^{\circ})=0\) too, so it is still a function, but is one-to-many.
\(f(x) = x^2\) is not one-to-one because each number’s negative partner is sent to the same output. Take the inputs 1 and -1, then \((1)^2\) and \((-1)^2\) both equal 1!
\(f(x) =\sqrt{ x}\) is one-to-one because the square root of a negative number is not real.
The only real outputs are positive, with each input value neatly giving one output.
Whether the function is one-to-one, or even a function can be difficult to see just by looking at the equation. That’s where the horizontal line test comes in.
Using the Horizontal Line Test
The test is actually more of a rule! It goes like this:
If all horizontal lines intersect the function’s graph at a single point, or no points, then the function passes the test.
If you can find even one horizontal line which intersects the function’s graph at more than one point, then the function fails the test.
- Get a suitably zoomed-out copy of your graph, showing all the important features of its shape.
- Hold a ruler horizontally – remember horizon! – across the graph and move it up and down. Are there any positions where the edge of the ruler intersects the graph at more than one point?
- If there aren’t any horizontal lines that would intersect the graph in more than one place, you’re done. Draw some evenly spaced horizontal lines to demonstrate your result.
- If you’ve found a position where a horizontal line intersects the graph at more than one point, draw it on!
The important features top include in your graph are:
- All x- and y-intercepts – where the graph crosses the axes.
- Maximum and minimum points – where the graph changes direction from increasing to decreasing, or the other way.
- End behavior and asymptotes – where the graph will continue to and where it never reaches. If there are no more changes of direction, then you can stop there.
- Any repeats.
The test also works on computers! Either hold a straight edge up to the screen or imagine a sliding horizontal line.
Some resources, like Desmos, will let you slide a horizontal line across graphs! It’s a fantastic way to visualize it.
Examples
\(f(x)=x^3 +1\) passes the test. The middle section is a close call, but is luckily never completely flat because f(x) is always increasing as x increases.
There’s no “dipping up” or “dipping down” in the graph which would intersect with a horizontal line more than once.
By drawing a few “test” horizontal lines in your favorite, colored pen, you can clearly see that none of these could ever intersect the graph at more than one point!
\(f(x)=\large\frac{1}{x}\) passes the test. The part on the left, where \(x\lt0\), is entirely beneath the y-axis. The other part, where \(x\gt0\), is entirely above the y-axis.
These parts cannot ever have the same y-value!
Just like before, drawing some spaced-out horizontal lines shows that both parts of the graph pass the test.
\(f(x)=\cos x\) fails the horizontal line test spectacularly. Drawing a horizontal line anywhere within \(-1\lt y\lt1\) gives an infinite number of intersections with the function’s graph!
Remember that to pass the test, every possible horizontal line must intersect the graph at one or zero points.
Challenge
The function \(f(x)=x\) passes the horizontal line test.
What happens if you shift the graph up or down by adding a constant?
\(f(x)=x+c\) always passes the test, for any constant c!
You can test this for yourself by trying several shifts like \(f(x)=x+1\) and \(f(x)=x-10\).
The shape of the graph doesn’t change, so there are no “dips” where a horizontal line could intersect with it at more than one point.
When the constant term is added, the horizontal lines can simply be moved up or down on your page. You’d end up with a graph that looks almost the same!
Practice Questions
The Matter of Math mantra is practice, practice, practice! Determine for yourself whether the following functions are one-to-one or not, using the horizontal line test.
The Matter of Math mantra is practice, practice, practice!
Don’t forget, a function is only one-to-one if it passes the test, and cannot be one-to-one if it fails!
The questions start gentle but will get more difficult, so be careful when plotting the graphs.
Question 1
Is \(f(x)=3x+5\) one-to-one?
This function gives a straight-line graph. This passes the test, so it is one-to-one.
Question 2
Is \(f(x)=-x+9\) one-to-one?
This graph is still a straight line but is “facing the other way”. It also passes the test and is one-to-one.
Question 3
Is \(f(x)=3x^2+4x\) one-to-one?
This graph looks very similar to the \(f(x)=x^2\) example you saw at the start of the lesson. It fails the test so cannot be one-to-one.
Question 4
Is \(f(x)=\tan x\) one-to-one?
Similar to cos(x) and sin(x), tan(x) has a pattern that repeats every π, so it fails the test and is not one-to-one.
But it does look pretty cool doing it! Any horizontal line intersects with the graph at an infinite number of points.
Question 5
Is \(x^2+y^2=4\) one-to-one?
Do you recognize this equation? Hint: find out what shape it gives to help you draw a plot.
It is a circle! Centered at the origin with a radius of 2. Any horizontal line passing through the inside of the circle must intersect it at two points, so this function is not one-to-one and fails the test!
Question 6
Is \(f(x)=(x-2)^3\) one-to-one?
This function passes the test and is one-to-one because it’s the same as \(f(x)=x^3\) but translated to the right. If you’d like to see why translation does not affect the result, check out the challenge!
Question 7
Is \(f(x)=\large\frac{1}{9x}\) one-to-one?
It is one-to-one because it passes the test. This function is a transformation of \(f(x)=\large\frac{1}{x}\), which you already know passes the test.
It’s a little steeper than its 1/x cousin, but the transformation doesn’t add any strange twists or dips to its shape!
Question 8
Is \(f(x)=\mid x\,\mid\) one-to-one?
Psst… confused by the notation here? Math Shorts has a little crash course for you!
The graph fails the test so this cannot be a one-to-one function. Just like \(f(x)=x^2\), you’ve got a reflection in the y-axis.
Question 9
Is \(f(x)= \sin(x+\pi)\) one-to-one?
π looks a bit scary, but it’s just a number, so it shifts the whole graph to the left by π. or 3.14159…
This doesn’t affect the shape so just like the regular \(\sin(x)\) function, \(\sin(x+\pi)\) fails the test and is not a one-to-one function.
Question 10
Is \(f(x)=\sqrt{6-x}\) one-to one?
A very similar example to earlier! Yet again, you’ve got a transformation of a familiar function.
As you move from left to right, the function is always decreasing. This means the graph doesn’t have any waves so it passes the horizontal line test and is one-to-one.
To Sum Up (Pun Intended!)
That’s it for the horizontal line test! Another handy test you’re likely to meet soon if you haven’t already is the vertical line test.
Functions are like “math ovens”, producing outputs depending on what you put into them!
A graph passes the horizontal test if every horizontal line crosses, or intersects it, at one or fewer points. If the graph passes the test, it is a one-to-one function – every specific input corresponds to exactly one output.
Functions can also be many-to-one, but many-to-many and one-to-many relations are technically not actually functions.
I hope you enjoyed this lesson. Please leave a comment at the bottom to let us know how you found the lesson, or for some help with any bits you’re not sure on, help is at hand!