Let S be a non-empty open set in $mathbb{R}^n$,then $f:Srightarrow mathbb{R}$ is said to be differentiable at $hat{x} in S$ if there exist a vector $bigtriangledown fleft ( hat{x} right )$ called gradient vector and a function $alpha :mathbb{R}^nrightarrow mathbb{R}$ such that
$fleft ( x right )=fleft ( hat{x} right )+bigtriangledown fleft ( hat{x} right )^Tleft ( x-hat{x} right )+left | x=hat{x} right |alpha left ( hat{x}, x-hat{x} right ), forall x in S$ where
$alpha left (hat{x}, x-hat{x} right )rightarrow 0 bigtriangledown fleft ( hat{x} right )=left [ frac{partial f}{partial x_1}frac{partial f}{partial x_2}…frac{partial f}{partial x_n} right ]_{x=hat{x}}^{T}$
Theorem
let S be a non-empty, open convexset in $mathbb{R}^n$ and let $f:Srightarrow mathbb{R}$ be differentiable on S. Then, f is convex if and only if for $x_1,x_2 in S, bigtriangledown fleft ( x_2 right )^T left ( x_1-x_2 right ) leq fleft ( x_1 right )-fleft ( x_2 right )$
Proof
Let f be a convex function. i.e., for $x_1,x_2 in S, lambda in left ( 0, 1 right )$
$fleft [ lambda x_1+left ( 1-lambda right )x_2 right ]leq lambda fleft ( x_1 right )+left ( 1-lambda right )fleft ( x_2 right )$
$ Rightarrow fleft [ lambda x_1+left ( 1-lambda right )x_2 right ]leq lambda left ( fleft ( x_1 right )-fleft ( x_2 right ) right )+fleft ( x_2 right )$
$ Rightarrowlambda left ( fleft ( x_1 right )-fleft ( x_2 right ) right )geq fleft ( x_2+lambda left ( x_1-x_2 right ) right )-fleft ( x_2 right )$
$Rightarrow lambda left ( fleft ( x_1 right )-fleft ( x_2 right ) right )geq fleft ( x_2 right )+bigtriangledown fleft ( x_2 right )^Tleft ( x_1-x_2 right )lambda +$
$left | lambda left ( x_1-x_2 right ) right |alpha left ( x_2,lambdaleft (x_1 – x_2 right )-fleft ( x_2 right ) right )$
where $alphaleft ( x_2, lambdaleft (x_1 – x_2 right ) right )rightarrow 0$ as$lambda rightarrow 0$
Dividing by $lambda$ on both sides, we get −
$fleft ( x_1 right )-fleft ( x_2 right ) geq bigtriangledown fleft ( x_2 right )^T left ( x_1-x_2 right )$
Converse
Let for $x_1,x_2 in S, bigtriangledown fleft ( x_2 right )^T left ( x_1-x_2 right ) leq fleft ( x_1 right )-f left ( x_2 right )$
To show that f is convex.
Since S is convex, $x_3=lambda x_1+left (1-lambda right )x_2 in S, lambda in left ( 0, 1 right )$
Since $x_1, x_3 in S$, therefore
$fleft ( x_1 right )-f left ( x_3 right ) geq bigtriangledown fleft ( x_3 right )^T left ( x_1 -x_3right )$
$ Rightarrow fleft ( x_1 right )-f left ( x_3 right )geq bigtriangledown fleft ( x_3 right )^T left ( x_1 – lambda x_1-left (1-lambda right )x_2right )$
$ Rightarrow fleft ( x_1 right )-f left ( x_3 right )geq left ( 1- lambdaright )bigtriangledown fleft ( x_3 right )^T left ( x_1 – x_2right )$
Since, $x_2, x_3 in S$ therefore
$fleft ( x_2 right )-fleft ( x_3 right )geq bigtriangledown fleft ( x_3 right )^Tleft ( x_2-x_3 right )$
$Rightarrow fleft ( x_2 right )-fleft ( x_3 right )geq bigtriangledown fleft ( x_3 right )^Tleft ( x_2-lambda x_1-left ( 1-lambda right )x_2 right )$
$Rightarrow fleft ( x_2 right )-fleft ( x_3 right )geq left ( -lambda right )bigtriangledown fleft ( x_3 right )^Tleft ( x_1-x_2 right )$
Thus, combining the above equations, we get −
$lambda left ( fleft ( x_1 right )-fleft ( x_3 right ) right )+left ( 1- lambda right )left ( fleft ( x_2 right )-fleft ( x_3 right ) right )geq 0$
$Rightarrow fleft ( x_3right )leq lambda fleft ( x_1 right )+left ( 1-lambda right )fleft ( x_2 right )$
Theorem
let S be a non-empty open convex set in $mathbb{R}^n$ and let $f:S rightarrow mathbb{R}$ be differentiable on S, then f is convex on S if and only if for any $x_1,x_2 in S,left ( bigtriangledown f left ( x_2 right )-bigtriangledown f left ( x_1 right ) right )^T left ( x_2-x_1 right ) geq 0$
Proof
let f be a convex function, then using the previous theorem −
$bigtriangledown fleft ( x_2 right )^Tleft ( x_1-x_2 right )leq fleft ( x_1 right )-fleft ( x_2 right )$ and
$bigtriangledown fleft ( x_1 right )^Tleft ( x_2-x_1 right )leq fleft ( x_2 right )-fleft ( x_1 right )$
Adding the above two equations, we get −
$bigtriangledown fleft ( x_2 right )^Tleft ( x_1-x_2 right )+bigtriangledown fleft ( x_1 right )^Tleft ( x_2-x_1 right )leq 0$
$Rightarrow left ( bigtriangledown fleft ( x_2 right )-bigtriangledown fleft ( x_1 right ) right )^Tleft ( x_1-x_2 right )leq 0$
$Rightarrow left ( bigtriangledown fleft ( x_2 right )-bigtriangledown fleft ( x_1 right ) right )^Tleft ( x_2-x_1 right )geq 0$
Converse
Let for any $x_1,x_2 in S,left (bigtriangledown f left ( x_2right )- bigtriangledown f left ( x_1right )right )^T left ( x_2-x_1right )geq 0$
To show that f is convex.
Let $x_1,x_2 in S$, thus by mean value theorem, $frac{fleft ( x_1right )-fleft ( x_2right )}{x_1-x_2}=bigtriangledown fleft ( xright ),x in left ( x_1-x_2right ) Rightarrow x= lambda x_1+left ( 1-lambdaright )x_2$ because S is a convex set.
$Rightarrow fleft ( x_1 right )- fleft ( x_2 right )=left ( bigtriangledown fleft ( x right )^T right )left ( x_1-x_2 right )$
for $x,x_1$, we know −
$left ( bigtriangledown fleft ( x right )-bigtriangledown fleft ( x_1 right ) right )^Tleft ( x-x_1 right )geq 0$
$Rightarrow left ( bigtriangledown fleft ( x right )-bigtriangledown fleft ( x_1 right ) right )^Tleft ( lambda x_1+left ( 1-lambda right )x_2-x_1 right )geq 0$
$Rightarrow left ( bigtriangledown fleft ( x right )- bigtriangledown fleft ( x_1 right )right )^Tleft ( 1- lambda right )left ( x_2-x_1 right )geq 0$
$Rightarrow bigtriangledown fleft ( x right )^Tleft ( x_2-x_1 right )geq bigtriangledown fleft ( x_1 right )^Tleft ( x_2-x_1 right )$
Combining the above equations, we get −
$Rightarrow bigtriangledown fleft ( x_1 right )^Tleft ( x_2-x_1 right )leq fleft ( x_2 right )-fleft ( x_1 right )$
Hence using the last theorem, f is a convex function.
Twice Differentiable function
Let S be a non-empty subset of $mathbb{R}^n$ and let $f:Srightarrow mathbb{R}$ then f is said to be twice differentiable at $bar{x} in S$ if there exists a vector $bigtriangledown fleft (bar{x}right ), a :nXn$ matrix $Hleft (xright )$(called Hessian matrix) and a function $alpha:mathbb{R}^n rightarrow mathbb{R}$ such that $fleft ( x right )=fleft ( bar{x}+x-bar{x} right )=fleft ( bar{x} right )+bigtriangledown fleft ( bar{x} right )^Tleft ( x-bar{x} right )+frac{1}{2}left ( x-bar{x} right )Hleft ( bar{x} right )left ( x-bar{x} right )$
where $ alpha left ( bar{x}, x-bar{x} right )rightarrow Oasxrightarrow bar{x}$
Learning working make money