Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 2

Mastering Functions: Definitions, Operations, Domain & Range

Recommended resources

Welcome to your second lesson. In our last session, we focused on manipulating algebraic expressions and solving equations to find specific, unknown values. That was about finding a static answer. Now, we will explore a more dynamic and powerful concept: the function.

Instead of solving for a single unknown, functions describe a consistent relationship between variables. This idea is central to almost every field you plan to study, from computer science, where programs are essentially complex functions transforming data, to AI, where neural networks are built by composing layers of functions. Today, you will learn to define what a function is, identify its key components called the domain and range, and learn how to combine (compose) and reverse (invert) them.

1. What is a Function? A Rule of Relationship

At its core, a function is a rule that takes an input and produces a single, predictable output. Think of it like a coffee machine: you put in coffee grounds (the input), and it produces coffee (the output). It won't ever give you tea.

To get a clear picture of this concept, let's watch a segment from a Math Antics video.

Algebra Basics What Are Functions? - Math Antics

This video provides an excellent, beginner-friendly introduction to what a function is, using helpful analogies and visuals.

Please watch from the beginning to the end of the first algebraic example. This part covers the idea of a function relating an "input set" to an "output set," introduces the formal names domain (inputs) and range (outputs), and shows how an algebraic equation like y = 2x acts as a function.

As the video explained, a function relates each member of the input set (the domain) to a member of the output set (the range). The most critical part of this definition is that for any given input, there can be exactly one output.

To formalize this, let's examine the definitions more closely.

Domain, Range and Codomain

This resource from "Maths is Fun" clearly defines the parts of a function using set diagrams.

Please read the sections titled Formal Definition of a Function and Domain, Codomain and Range. Pay attention to the distinction between the codomain (all possible outputs) and the range (all actual outputs). The vending machine analogy is quite effective.

The "One Output" Rule

The rule that one input must map to exactly one output is non-negotiable. If a relationship violates this, it's not a function. Let's see what happens when it's violated.

Algebra Basics What Are Functions? - Math Antics

We'll return to the Math Antics video to see a clear example of what is not a function.

Watch the segment from "an important limitation", which explains why the equation y^2 = x is not a function. It introduces the idea of a "one-to-many" relationship, which functions are not allowed to have.

This is a crucial distinction. The equation is a function because for any you input (e.g., ), you get only one out (). But the relation is not a function because for one input (e.g., ), you get two possible outputs ( and ).

Function Notation: f(x)

In algebra, you're used to seeing equations like . In the context of functions, you will often see this written as . This is called function notation. It's useful because it gives a name to the function (in this case, f) and explicitly shows the input variable (in this case, x).

  • is read as "f of x".
  • It does not mean f multiplied by x.
  • It represents the output of the function f when the input is x. So, and are interchangeable; they both mean the output value.

Using this notation, we can ask for the output for a specific input concisely. For , if we want to find the output when the input is 3, we write . We find the answer by substituting 3 for :


2. Identifying Domain and Range

We've defined domain and range, but how do we find them for a given function? The method depends on whether you have an equation or a graph.

From an Equation

When a function is given as an equation (e.g., ), the domain is usually assumed to be "all real numbers that make sense." Your job is to find any values that don't make sense. There are two primary restrictions to look for in this course:

  1. Division by zero: The denominator of a fraction cannot be zero.
  2. Square roots of negative numbers: You cannot take the square root of a negative number and get a real number as a result. The value under the square root must be zero or positive.

Tutorial 30: Introduction to Functions

This tutorial from West Texas A&M University provides clear, worked-out examples for finding the domain from an equation.

Please read the section Finding the Domain. Follow Examples 10, 11, and 12 closely. They demonstrate how to handle a function with no restrictions, one with a square root, and one with a denominator.

From a Graph

Finding the domain and range from a graph is a visual process.

  • Domain: Look at the graph from left to right. The domain is the set of all -values that the graph covers.
  • Range: Look at the graph from bottom to top. The range is the set of all -values that the graph covers.

This process can be tricky when the graph has gaps, holes, or extends to infinity. The following video provides a fantastic guide to all these scenarios.

Domain and Range of a Function From a Graph

The Organic Chemistry Tutor is excellent at breaking down graphical analysis step-by-step.

Watch these key segments: The first example shows a simple, continuous graph with closed endpoints. The second example explains how to handle open vs. closed circles, which indicate whether a point is included or not. The next two examples show how to describe domain and range when a graph extends to infinity. The final example demonstrates how to deal with graphs that have "jumps" or discontinuities, using the union symbol (∪) to combine separate intervals.


3. Function Composition

Now that we understand what a single function does, we can explore what happens when we chain them together. Function composition is the process of applying one function to the result of another.

Imagine an assembly line. The first machine takes a raw material and produces a component. The second machine takes that component and turns it into a finished product. Function composition works the same way.

This diagram shows that the output from the first function, f(x), becomes the input for the second function, g(x). The final result comes from g(x).

The notation for composing function g with function f is , which is defined as . You always work from the inside out: first, you find the output of , and then you use that entire output as the input for .

Let's see an example:
Suppose we have two functions:

  • (adds 5 to the input)
  • (doubles the input)

To find , we first apply , then :

  1. Start with .
  2. Apply : .
  3. Apply to that result: .
    So, .

Crucially, the order matters. Let's find :

  1. Start with .
  2. Apply : .
  3. Apply to that result: .
    So, .

As you can see, . This concept of chaining functions is fundamental in programming and is the core principle behind how deep learning models (neural networks) are built—each layer is a function that processes the output of the previous layer.


4. Inverse Functions

If a function is a process, is there a way to reverse it? Yes, and that is called an inverse function. An inverse function takes an output from the original function and returns the original input.

The inverse of a function f is denoted as . (Note: this is not an exponent; it does not mean ).

This diagram illustrates how an inverse function, f⁻¹(x), reverses the mapping of the original function, f(x). If f maps 'a' to 'b', then f⁻¹ maps 'b' back to 'a'. Notice that the domain of f becomes the range of f⁻¹, and the range of f becomes the domain of f⁻¹.

For a function to have an inverse, it must be one-to-one. This means that every output corresponds to exactly one input. The function is not one-to-one because both and produce the output 4. You can't have an inverse that knows whether to return 2 or -2 from the input 4. However, if we restrict the domain of to only , it becomes one-to-one and its inverse is .

How to Find the Inverse

To find the inverse of a function algebraically, follow these steps:

  1. Write the function as an equation: .
  2. Swap the x and y variables in the equation.
  3. Solve the new equation for y. The resulting expression is .

Let's find the inverse of .

  1. Write as an equation:
  2. Swap x and y:
  3. Solve for y:

So, the inverse function is .

We can check our work. An inverse should "undo" the original function. If we compose a function with its inverse, we should get back our original input, .

It works.


Conclusion

In this lesson, we made the leap from solving for single values to describing dynamic relationships with functions. This is a significant step towards the mathematical maturity required for computer science and AI.

Here are the main ideas we covered:

  • A function is a rule that assigns each input from its domain to exactly one output in its range.
  • We use function notation, , to represent the output of a function f for an input x.
  • The domain and range can be determined from a function's equation by looking for restrictions (like division by zero) or from its graph by observing its span on the x and y axes.
  • Function composition, , is the process of applying one function to the results of another.
  • Inverse functions, , reverse the action of the original function and only exist for one-to-one functions.

In our next lesson, we will connect these algebraic ideas to a visual representation by diving into 2D and 3D Cartesian coordinate systems. This will give us the framework to graph functions and visualize the data and geometric spaces that are fundamental to computer graphics, data analysis, and robotics.