Professional Documents
Culture Documents
Linear Algebra and Optimization Basics - 2
Linear Algebra and Optimization Basics - 2
Algebra
Background Reading
◦ G. Strang Linear Algebra and its Applications 2nd Ed.
◦ Elementary Linear Algebra by Howard Anton.
50
Taylor Series
Taylor series is a series expansion of a function about a point. A one dimensional
Taylor series is an expansion of a real function f(x) about a point. If 𝑥 0, the
expansion is known as a Maclaurin Series.
The Taylor Series for f(x) is given as
51
1
Taylor Series
An animation that shows how a Taylor series
can be used to approximate a function.
The blue line shows the exponential function.
The red lines show the sum of n derivatives ‐‐
that is, n+1 terms in the Taylor series.
As n gets bigger, the red line gets closer to the
blue line.
Taylor Series Example
We use Taylor Series to get the Expansion of 𝑆𝑖𝑛 𝑥 at point 𝑥0 0
◦ 𝑓 𝑥 𝑆𝑖𝑛 𝑥 𝑎𝑡 𝑥 𝑥0 0 𝑓 𝑥 0
◦ 𝑓’ 𝑥 𝐶𝑜𝑠 𝑥 𝑎𝑡 𝑥 𝑥0 0 𝑓’ 𝑥 1
◦ 𝑓’’ 𝑥 𝑆𝑖𝑛 𝑥 𝑎𝑡 𝑥 𝑥0 0 𝑓’’ 𝑥 0
◦ 𝑓’’’ 𝑥 𝐶𝑜𝑠 𝑥 𝑎𝑡 𝑥 𝑥0 0 𝑓’’’ 𝑥 1
◦ 𝑓’’’’ 𝑥 𝑆𝑖𝑛 𝑥 𝑎𝑡 𝑥 𝑥0 0 𝑓’’’’ 𝑥 0
◦ Same Sequence is Repeated for higher derivatives.
◦ Plugging in values in the expression of Taylor Series we get
◦
x 3 x 5 x 7
f (x) x ...
3! 5! 7!
53
2
Generalized Taylor Series
If we let 𝛿𝑥 𝑥 𝑥 then the Taylor Series can be written as
For a Function of Two Variables it is written as
54
Gradient
The Gradient is a Vector Operator denoted by ∇ and sometimes also called Del.
Let 𝑓 𝑥 , 𝑥 , 𝑥 , … , 𝑥 be a scalar valued function 𝒙 𝑥 ,𝑥 ,𝑥 ,…,𝑥 then
𝑓 𝑥 ,𝑥 ,𝑥 ,…,𝑥 𝑓 𝒙
∇ 𝑓 𝑥 ∇ 𝑓 ,∇ 𝑓 ,∇ 𝑓 ,...,∇ 𝑓
55
3
Gradient
For two dimensional vectors if Gradient is not
zero then it is perpendicular to the Level Curve
through 𝑥 , 𝑦 .
56
Level Curves
A level set of c is the set of points such that
◦
The points are in the domain of the function.
If n=2 the level set is a plane curve aka Level Curve. If n=3 level set is a
surface aka Level Surface.
So a Level Curve is a level set in two dimensions. i.e. the points at
which the value of the function is constant. Level curves for a function
are shown in the above figure.
Level curves are plotted by using the contour function.
57
4
Jacobian
Given a set y=f(x) of n equations in n variables 𝑥 , 𝑥 , x ,…, 𝑥 written explicitly as
The Jacobian Matrix sometimes simply known as the Jacobian is then defined by
The Determinant of The Jacobian Matrix is also Known as The Jacobian.
58
Example
Let y1= x2+2y2 and y2= 3x2+4y2
The Jacobian can be found as
◦ δy1/δx=2x
◦ δy2/δx=6x
◦ δy1/δy=4y
◦ δy2/δy=8y
◦ The result in Matrix form is given as
2x 4y
6x 8y
59
5
Directional Derivative
The Directional Derivative∇ 𝑓is the rate at which the
function f changes at a point in the direction u. It is
the vector form of usual derivative and is defined as
𝑢
∇ 𝑓 ∇𝑓
𝑢
Where u is a unit vector.
60
Example
Find the directional derivative of 𝑓 𝑥, 𝑦 𝑥 2𝑦 𝑎𝑡 𝑥 1, 𝑦 1 in the direction of 𝑑 13
We must make the direction vector into a unit vector by normalizing.
2 x 2
f ( x, y ) and f ( x, y )
4 y 4
𝑑 1 1 1/ 10
𝑢
𝑑 1 3 3 3/ 10
u (1 / 10 ) 2 (3 / 10 ) 2 1
The directional derivative at x=1, y=1 is
61
6
Hessian
f f
The Jacobian of the Derivatives of a function
x
...
x
1
f(x1,…,xn) w.r.t x1,…,xn is known as the Hessian of f(x). i.e.
n
The Hessian for a function of Two Variables is given as.
62
Example
Find the Hessian of f(x,y)=x2+2y2
◦ δf/δx=2x
◦ δ2f/δx2=2
◦ δf/δy=4y
◦ δ2f/δy2=4
◦ δ2f/δxδy =0
◦ δ2f/δyδx =0
◦ The result is then written in matrix form as
2 0
0 4
63
7
Hessian
Hessian plays a very vital role in optimization problem, It is
analyzed for conditions of optimality and will be extensively
used.
In simple words the Hessian of a scalar function, of a vector, is
the matrix of partial second derivatives. It is the second
derivative of the function. It is written as ∇ 𝑓
Hessian is symmetric because of the equality of mixed partials
64
Quadratic Forms
An important class of functions in optimization problems is the Quadratic
form.
A quadratic form is a function of n variables which can be written as
𝑓 𝑥 𝑎 𝑥𝑥
In matrix vector notation the quadratic form becomes
𝑥 𝐴𝑥
Where 𝐴 𝑎 is an nxn square matrix. This combination of a matrix and
vectors always takes on a scalar value.
65
8
Examples
x12+x1x2+3x22 can be written in matrix form xTAx where x is [x1 x2]T
1 0.5
𝐴
0.5 3
x12+x1x2+4x1x3+2x32 can be written in matrix form xTAx where x is [x1 x2 x3]T
1 0.5 2
𝐴 0.5 0 0
2 0 2
x1 +2x2 +3x3 can be written in matrix form xTAx where x is [x1 x2 x3]T
2 2 2
1 0 0
𝐴 0 2 0
0 0 3
66
Necessary Condition
A condition which must hold for a result to be true, but
which does not guarantee it to be true. If a condition is both
necessary and sufficient, then the result is said to be true iff
the condition holds.
Example
◦ A necessary condition is that the derivative of the function must
be zero at the minimum point. But if a function has derivative zero
at some point it meets the necessary condition but it may not have
a minimum there. It can be attaining a maximum value at that
point.
67
9
Sufficient Condition
A condition which, if true, guarantees that a result is also true.
(However, the result may also be true if the condition is not met.) If a
condition is both necessary and sufficient, then the result is said to
be true iff ("if and only if") the condition holds.
Example
◦ The condition that a decimal number n end in the digit 2 is a sufficient but not
necessary condition that n be even.
68
Local And Global Minima Global Maximum
f(x0)
Local Maximum
Cost Function
Local Minimum
X0‐Є x0 X0+Є
Value of function
Parameter.
Global Minimum
69
10