Utility function is a mathematical representation of the satisfaction (utility) of consumption of a basket of goods. The function translates each bundle of products and services into an unit (utils).

## Why is the utility function important?

The utility function is essential to explain human behavior. Economists use it in explaining the basis of consumer choice theory. The theory explains consumer choices when dealing with limited resources and unlimited needs.

Economists assume humans choose rationally. In a sense, with existing resources, they will maximize the satisfaction obtained from the consumption of goods and services. To quantify consumer satisfaction, economists use the utility function. In this theory, economists also use the budget constraint function (line) as a combination of goods and services that consumers might obtain with their resources (money).

With these two mathematical functions, economists can determine the optimum point of consumer choice. And, to make it easier, they describe it in a two-dimensional graph. The graph consists of an indifference curve and a budget constraint line. The indifference curve represents combinations of goods that maximize utility, and the budget constraint line represents combinations of products that consumers can obtain from their resources. The optimum point occurs when the two curves are tangent (this point we also call the consumer equilibrium).

## How the utility function works

With the utility function, we can rank different consumption bundles based on consumer preferences. Let’s take a simple case:

- Bundle A contains 4 oranges and 3 apples
- Bundle B consists of 3 oranges and 4 apples

For example, when you are asked to give a satisfaction value from the two baskets, you value the total utility of bundle A as 12 utils and bundle B as 6 utils. You prefer bundle A because it contains more oranges. Your satisfaction with grapefruit is somewhat higher than that of Apples. Therefore, you prefer bundle A.

As a note, the utility function does not give a cardinal rating, but an ordinal rating. **What are the consequences?**

With ordinal ranking, you can determine which bundle you prefer. However, you cannot calculate the relative satisfaction of each bundle. In the case above, you like A, and you think it gives the pleasure of 12 utils. That number doesn’t mean bundle A has double the utility of bundle B.** Why?**

Because you judge based on perception, and it is subjective and depends on the conditions when you value. When faced with the same choice at a later time, you might give a different assessment. And, the function is trying to quantify your satisfaction.

In general, we can write the utility function using the following formula:

**U = f(Q _{1}, Q_{2}, …, Q_{n})**

The function states that utility is a function of the quantity (Q) of various goods, from 1 to n. Because there are many combinations of items that consumers might choose, in this article, we only use two items as representations, oranges, and apples.

For example, the bundle A utility we formulate in the mathematical function as follows:

**U = 4X + 3Y**

X is orange, and Y is apple.

Furthermore, when utilities are written in mathematical functions, we can also measure the marginal utility. Marginal utility is the additional satisfaction consumers get from an item by consuming one more. Marginal utility is the first derivative of the total utility function.

Say, we want to calculate the marginal utility of orange consumption. That means we assume apples as constants. Thus, the marginal utility of the above equation is:

**MU (x) = ∂U / ∂x = 4**