Some things go together in a way. One thing can change another thing. Like a planet moves as time goes by. This helps us learn many things. It is a great tool for us. Can you find a pattern?
Some things go together in a special way. One thing can change based on another.
Imagine a planet moving in space. Its place changes as time goes by. This is a way things connect. 
We can use a rule to link two groups. One group is the start. The other group is the end.
We can draw these links on paper. This drawing is called a graph. It helps us see the pattern.
Math uses these rules for many things. They help us study science and engineering.
Imagine a machine that takes an input and gives an output.
In math, this machine is called a function. A function connects two groups of things. The first group is called the domain. The second group is called the codomain. A function follows a strict rule. Each item in the domain must link to exactly one item in the codomain.
If you have two inputs that go to the same output, that is still a function. But one input cannot go to two different outputs. If that happens, it is just a relation, not a function.
We often use letters like f to name a function. We write f(x) to show the value of the function. The x is the input, also called the argument.
Scientists use functions to study the world. For example, the position of a planet depends on time. We can also draw functions on a plane. These drawings are called graphs. A graph helps us see how the values change. 
Imagine you have a machine that follows a specific rule. You drop one thing into the machine, and it gives you exactly one thing back. In mathematics, this rule is called a function. A function connects two different sets of things. The first set, which contains all the possible inputs, is called the domain. The second set, which holds the possible results, is called the codomain.
To understand how this works, think about how we name these connections. We often use a letter like $f$ to name the function. When we want to show an input, we use a symbol like $x$. We write this as $f(x)$, which we read as "$f$ of $x$." The $x$ is called the argument or the variable. The result that comes out is called the image.
People have been thinking about these rules for a very long time. Early mathematicians like Isaac Newton, Gottfried Leibniz, and Leonhard Euler studied how quantities change. They used these ideas to build calculus at the end of the 17th century. Back then, they mostly looked at smooth and regular changes. It was not until the end of the 19th century that math became more formal. Scientists used set theory to create a very strict definition for functions. This new way of thinking allowed math to be used in many more ways.
Functions can be very simple or very complicated. Some functions only work for certain numbers, which are called partial functions. For these, we talk about a "domain of definition" to show which inputs actually work. We can also have functions with more than one input. A bivariate function uses two inputs at the same time. For example, the position of a car depends on both time and speed.
We use functions to see patterns in almost everything. One way to see a function is to draw a graph. A graph is a set of pairs that shows how the inputs and outputs relate. When we use real numbers, the graph looks like a curve or a line on a plane. 
In mathematics, a function is a precise way to connect two sets of objects. It acts as a rule that assigns to each element in one set exactly one element in another set. This relationship is sometimes called a mapping, a transformation, or a correspondence. A function is more than just a simple link; it is a predictable rule. If you know the input, the function tells you exactly what the output will be. Because of this precision, functions are considered the central objects of investigation in most mathematical fields.
To understand the mechanics, we must define the specific parts of a function. The first set, which contains all possible inputs, is called the domain. The second set, which contains the potential results, is called the codomain. When an input from the domain is linked to a specific result, that result is called the image. The set of all possible images is known as the range. Mathematicians often use a letter, such as $f$, to name the function. We write $f(x)$ to represent the value of the function at a specific input $x$. In this notation, $x$ is called the argument or the variable.
Functions can be represented in several ways, most notably through a graph. A graph is a set of all ordered pairs $(x, f(x))$ that show the relationship between inputs and outputs. When a function uses real numbers, these pairs can be plotted as coordinates on a plane. This allows us to see the function as a visual curve or line. For example, a linear function might appear as a straight line, while a quadratic function appears as a curve. 
Historically, the concept of a function has changed significantly. In the late 17th century, the development of infinitesimal calculus by figures like Isaac Newton, Gottfried Leibniz, and Leonhard Euler shaped early ideas. During this time, functions were seen as ways to describe how one varying quantity depends on another, such as a planet's position changing over time. Until the 19th century, mathematicians mostly focused on differentiable functions, which possess a high degree of regularity. It was not until the end of the 19th century that the concept was formalized using set theory. This formalization greatly increased the possible applications of the concept across all of science.
Sometimes, a function does not work for every possible input in its codomain. These are called partial functions. In a partial function, an input might be undefined. The specific subset of the domain where the function actually works is called the domain of definition. For example, in calculus, many real-valued functions are actually partial functions. Determining the domain of definition can be quite difficult. In complex analysis, finding the domain of the multiplicative inverse of the Riemann zeta function is related to the Riemann hypothesis, one of the major open problems in mathematics.
Functions can also involve more than one input at a time. These are known as multivariate functions or functions of several variables. A bivariate function depends on two arguments. An example is a binary operation, such as integer multiplication, which takes two integers and produces one result.
Because functions describe relationships, they are vital to many disciplines. Scientists and engineers use them to model everything from physical movement to statistical trends. For example, one can use functions to map years to the number of motor vehicle deaths in the United States.
🖼️ Images & Media (12)
More to explore
✨ What else?
Related topics you might enjoy
🔬 Go deeper
More advanced topics to explore
🪜 Step back
Simpler topics to build understanding
What is Nepedia?
A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.