For the layman, a "function" indicates a relationship among objects. A function provides a model to describe a system. Economists refer to demand functions which refer to the sales volume of an item as a function of the item's price. Similarily, economists refer to supply function which considers production volume of an item as a function of the prevailing/projected price of the item.
A function expresses the relationship of one variable or a group of variables (called the Domain) with another variable (called the Range) by associating every member in the domain with a unique member in the range.
Suppose X represents the "price of a good" and Y the "demand". We may postulate that Y is related to X in the sense that if we fix the price of the good, then we will be able to determine the demand. We say that Y is a function of X since we are able to compute a unique value of Y for a given value of X. We may represent the relationship as y = f(x), where f represents the relationship. It is important to note that it may be the case, though it is not necessary, that the relationship is a causal one, that is, X is the cause and Y is the effect. When the relationship is causal, we may regard X as the independent variable and Y as the dependent variable.
Thus,
y = f(x) = 2 - 3x,
y = g(x) = 2x^{2} - x + 100
are examples of functions. But
y^{2} = x
is not a function of X since the rule that a given value of X should yield a unique value of Y is violated. (Verify for X = 4.)
Functions can be expressed algebraically (as in y = 2x - 3) or graphically or in a tabular form.
Example
Suppose we play a game involving the toss of two fair coins. And for every Head that turns up, you win Re.1 and for every Tail that turns up, you lose Re.1
Let D = {TT, HT, HH} and R = {-2, 0, 2}
Then the game may be represented by the function
R = f(D)
where f(TT) = -2, f(HT) = 0 and f(HH) = 2