A function in mathematics is a set of ordered pairs in which each element of the first set (the domain) is associated with exactly one element of the second set (the range). In other words, a function is a rule that assigns a unique output to each input.

One common way to represent a function is with a function notation, such as f(x) = y. In this notation, x is the input and y is the output. For example, if we have a function f(x) = x^2, then for any input (or domain value) of x, the output (or range value) is x squared. So, f(3) = 9, f(-2) = 4 and so on.

Another way to represent a function is with a graph. In this case, the domain values are plotted on the x-axis and the range values are plotted on the y-axis. For example, the graph of the function y = x^2 would be a parabola with the vertex at the origin.

Examples of functions include:

- Linear functions, such as y = 2x + 1, which have a constant rate of change.
- Quadratic functions, such as y = x^2, which are parabolas that open upwards.
- Exponential functions, such as y = 2^x, which increase at an increasing rate.
- Trigonometric functions, such as y = sin(x), which are periodic and oscillate between -1 and 1.

Functions can also be combined, such as y = f(x) = 2x + g(x), where g(x) is another function. Additionally, inverse functions are used to undo the actions of a function, such as finding the input that corresponds to a given output.

Functions play an important role in mathematics, they are used in various fields such as physics, engineering and computer science. They are also widely used in modeling real-world phenomena.

There are many real-world examples of functions, some of which include:

- Distance-time graphs in physics: The distance traveled by an object in a certain period of time can be represented by a function, where time is the input and distance is the output.
- Supply and demand in economics: The relationship between the price of a good and the quantity of that good that consumers are willing to buy can be modeled as a function.
- Population growth: The growth of a population over time can be modeled as a function, where time is the input and population size is the output.
- Sound waves: The amplitude of a sound wave (the loudness of the sound) can be modeled as a function of time.
- Medical dosage: The amount of medication a patient should take can be determined by their weight and age, this relationship can be modeled as a function.
- Climate: Temperature, precipitation, and other climate variables can be modeled as functions of time and location.
- Computer Science: In computer science, a function is a subprogram that can be called by other parts of a program, it takes inputs and returns outputs.

These are just a few examples of how functions are used to model real-world phenomena. They can be found in many other fields such as engineering, finance, biology, and many more.