What is a function in mathematics?

If you want to know what a function is, pretend you are going to feed something into a machine and that machine will do something with what you gave it and give you something new. That machine is precisely what a function is doing. All sorts of variables (the things you give the machine and the things you get out of the machine) are used for functions. The most commonly used variables you give are ‘x’. What you get out is generally ‘y’. For example:

y = 2*x

Give this function x and it multiplies x by 2 and gives you the new value back. If x = 2 then y = 4. That is a function.

Commonly, the function can be written like this:

f(x)= y = f(2) = 2*x = 4.