# 5Notation and mathematical background

## 5.1 Notation

Before analysing decision-making under risk and uncertainty, I will introduce some notation.

Suppose we have a lottery L with n possible outcomes x_1, x_2, ..., x_n each with probabilities p_1, p_2, ..., p_n. A shorthand way to write this is:

L=(p_1,x_1; p_2,x_2; ...; p_n,x_n)

For example, suppose you are offered a gamble with a 50% probability of winning $200 and a 50% probability of losing$100. We can write this as:

L=(0.5, −100; 0.5, 200)

The order of each outcome-probability pair does not matter. I could also write:

L=(0.5, 200; 0.5, -100)

You may also see gambles represented with the outcome and probability in a different order, such as:

L=(x_1,p_1; x_2,p_2; ...; x_n,p_n)

Or:

L=(x_1,x_2,...,x_n;p_1,p_2,...,p_n)

It is typically not difficult to determine which is which.

## 5.2 Mathematical background

We will use some basic mathematical concepts to analyse expected utility. I will briefly review these concepts here.

### 5.2.1 Functions

#### 5.2.1.1 Exponentiation

Exponentiation is a mathematical operation where a number is multiplied by itself a certain number of times.

Exponentiation is written as f(x)=x^a. That is, x is multiplied by itself a times. For example, 2^3=2\times2\times2=8.

The exponent a can be any real number, including fractions and negative numbers. For example, a plot of the function f(x)=x^{0.5} is shown in Figure 5.1.

Code
library(ggplot2)

x <- seq(0, 5, 0.1)

y <- x^0.5

df <- data.frame(x, y)

ggplot(df, aes(x, y)) +
geom_line() +
geom_vline(xintercept = 0, linewidth=0.25)+
geom_hline(yintercept = 0, linewidth=0.25)+
labs(x = "x", y = "f(x)=x^0.5") +
theme_minimal()

#### 5.2.1.2 The exponential function

The exponential function is written as f(x)=e^x. The letter e is a constant, approximately equal to 2.71828. It is a special case of exponentiation where the base is e, which is multiplied by itself x times.

A plot of the exponential function is shown in Figure 5.2.

Code
library(ggplot2)

x <- seq(-5, 5, 0.1)
y <- exp(x)

df <- data.frame(x, y)

ggplot(df, aes(x, y)) +
geom_line() +
geom_vline(xintercept = 0, linewidth=0.25)+
geom_hline(yintercept = 0, linewidth=0.25)+
labs(x = "x", y = "f(x)=e^x") +
theme_minimal()

#### 5.2.1.3 The logarithmic function

The logarithmic function is written as f(x)=\ln(x) or \log_e(x).

The logarithmic function is the inverse of the exponential function. That is, if f(x)=e^x, then x=\ln(f(x)).

A plot of the logarithmic function is shown in Figure 5.3.

Code
x <- seq(0.01, 5, 0.01)
y <- log(x)

df <- data.frame(x, y)

ggplot(df, aes(x, y)) +
geom_line() +
geom_vline(xintercept = 0, linewidth=0.25)+
geom_hline(yintercept = 0, linewidth=0.25)+
labs(x = "x", y = "f(x)=ln(x)") +
theme_minimal()

Note that the logarithmic function is only defined for positive values of x. The logarithm of zero is undefined.

### 5.2.2 Differentiation

Differentiation is a mathematical operation that finds the rate of change (or slope) of a function. It is written as \frac{d}{dx}f(x) or \frac{dy}{dx} or f'(x).

There are several simple rules to differentiate a function. The rules relevant to these notes are as follows.

The derivative of a constant is zero.

\frac{d}{dx}c=0

The derivative of an exponentiation is:

\frac{d}{dx}x^a=ax^{a-1}

For example:

\frac{d}{dx}x^2=2x

You can see from this that for any value of x greater than zero, the derivative of x^2 is greater than zero, signifying that the function f(x)=x^2 is increasing and has positive slope. For any value of x less than zero, the derivative is less than zero, signifying that the function is decreasing and has negative slope.

As another example:

\frac{d}{dx}x^{0.5}=0.5x^{-0.5}

You can see from this that for any value of x greater than zero, the derivative of x^{0.5} is greater than zero, signifying that the function f(x)=x^{0.5} is increasing and has positive slope. The function is not defined for x<0. This is shown in Figure 5.1.

The derivative of the logarithmic function is:

\frac{d}{dx}\ln(x)=\frac{1}{x}

This derivative is positive for all values of x for which \ln(x) is defined. Therefore \ln(x) is increasing in x. You can see this in Figure 5.3.

The derivative of a fraction is:

\frac{d}{dx}\frac{1}{f(x)}=-\frac{f'(x)}{f(x)^2}

For example:

\frac{d}{dx}\frac{1}{x}=-\frac{1}{x^2}

Where you have a function \frac{1}{x^a}, it is often easier to write it as x^{-a} and use the rule for exponentiation. For example:

\frac{d}{dx}\frac{1}{x}=\frac{d}{dx}x^{-1}=-1x^{-2}=-\frac{1}{x^2}

#### 5.2.2.1 The second derivative

The second derivative of the function is a measure of the curvature of the function or the rate of change of the slope. We can calculate the second derivative by taking the derivative of the first derivative.

\frac{d^2}{dx^2}f(x)=\frac{d}{dx}\left(\frac{d}{dx}f(x)\right)

We can use the second derivative to determine whether a function is concave or convex. A function is concave if the second derivative is negative and convex if the second derivative is positive.

\frac{d^2}{dx^2}f(x)>0 \text{ for all } x \Rightarrow \text{f(x) is convex} \frac{d^2}{dx^2}f(x)<0 \text{ for all } x \Rightarrow \text{f(x) is concave}

The second derivative of a function is written as \frac{d^2}{dx^2}f(x) or \frac{d^2 y}{dx^2} or f''(x).

For example, if f(x)=x^2, then:

\frac{d^2}{dx^2}x^2=\frac{d}{dx}2x=2

The second derivative is positive (equal to 2) for all values of x. This implies that f(x)=x^2 is increasing at an increasing rate. The function is convex.

The second derivative of x^{0.5} is:

\frac{d^2}{dx^2}x^{0.5}=\frac{d}{dx}0.5x^{-0.5}=-0.25x^{-1.5}

The second derivative is negative for all values of x for which x^{0.5} is defined. This implies that x^{0.5} is increasing at a decreasing rate. The function is concave. You can see this in Figure 5.1.

The second derivative of the logarithmic function is:

\frac{d^2}{dx^2}\ln(x)=\frac{d}{dx}\frac{1}{x}=-\frac{1}{x^2}

This second derivative is negative for all values of x for which \ln(x) is defined. This implies that \ln(x) is increasing at a decreasing rate. The function is concave. You can see this in Figure 5.3.

When working through these notes, you will not be asked to differentiate any functions. However, understanding what differentiation is and what it shows will help you understand the intuition behind the concepts I discuss. I will use the functions f(x)=\ln(x) and f(x)=x^{0.5} in future sections.