The following section from DiscussEconomics on microeconomics and preferences discusses the mathematical representation of preference using utility functions.

Using utility function : U(x) = U (x1, x2, x3.......xn)
(Where U is in fact mu.)

This assigns a number (utility number to every consumption bundle in a person’s preference ordering. 1. Now if someone is indifferent between two bundles, the U function assigns the same number to both bundles:
utility function

2. Now if you prefer 1 bundle to another, the utility function assigns a larger number to the preferred bundle:
utility function 2

Many (any number) of utility functions can be constructed to represent the same preference ordering. They are not unique except with respect to rank.

*some U (x1, x2) exists for any preferences that satisfy the following: 1 completeness, 2 continuity, 3 transitivity, 4 non-satiation.

Also remember that utility numbers are ordinal, no cardinal in that only relative rankings matter.

Here is an example I’ve written, hopefully you don’t have trouble following:

utility example

With any transformation which preserves the ranking of a utility function, the new utility function is legitimate.

Monotomic Transformation

utility example

If function ‘f’ has the property that the larger the number you enter, the larger the number that comes out (monotomicaly increases) then the new functions V(x) is also a utility function.

Therefore: (Where B1 is bundle 1)

utility example

Utility numbers can be negative, however, it still must rank correctly and prefer. So end the introduction to utility functions (coupled with indifference curves).