Calculus
Anton Velinov
DIW WS 2016
Takeaways
Differentiation: rules, implicit differentiationTaylor and power seriesMaximizationDefinite and indefinite integralsDifferential equationsMultivariate function limits and continuityPartial derivatives, gradient and directional derivativesComplex numbersImplicit function theorem
Anton Velinov Calculus 2 / 57
Differentiation I
DefinitionLet f : R→ R. Its derivative with respect to a point x is definedby the following limit
f ′(x) =dfdx
= lim∆→0
f (x + ∆)− f (x)
∆.
Class ExerciseUse the above definition to calculate the derivative of
f (x) = a + bx
andf (x) =
xx + 1
with respect to x .
Anton Velinov Calculus 3 / 57
Differentiation II
Useful Rulesdxk/dx = kxk−1
d(sin(x))/dx = cos(x) and d(cos(x))/dx = −sin(x)
d(ex )/dx = ex
d(log(x))/dx = 1/x
Anton Velinov Calculus 4 / 57
Differentiation III
TheoremIf a function f (x) is differentiable at some point x , then it iscontinuous at x .
differentiability⇒ continuity.
The converse is not true
continuity ; differentiability.
Class ExerciseShow that f (x) = |x − 2|+ 1 is continuous but not differentiableat x = 2.
Anton Velinov Calculus 5 / 57
Differentiation Rules I
Product RuleIf functions f (x) and g(x) are differentiable then their product isdifferentiable and given as follows:
(f (x)g(x))′ =d(f (x)g(x))
dx= f ′(x)g(x) + f (x)g′(x).
Quotient RuleIf functions f (x) and g(x) are differentiable then their quotient isdifferentiable and given as follows:(
f (x)
g(x)
)′=
d(f (x)/g(x))
dx=
f ′(x)g(x)− f (x)g′(x)
(g(x))2 .
Anton Velinov Calculus 6 / 57
Differentiation Rules II
ExampleProve the product rule. Hint: Add and subtract f (x + ∆)g(x).
Chain RuleFor the composite function g(x) = f (u(x)) or g(x) = (f ◦ u)(x)the derivative is given as follows:
dg(x)
dx=
df (·)du
du(x)
dx.
Class ExerciseUse the chain rule to find the derivative of
f (x) = 2x
with respect to x .
Anton Velinov Calculus 7 / 57
Implicit Differentiation I
It is not always possible to differentiate x explicitly from f (x). Asa direct consequence of the chain rule we can therefore makeuse of implicit differentiation
ExampleFind the derivative of
x2 + y2 = 1
with respect to x and compare this to the explicit solution.
Class ExerciseFind the derivative of
(x2 + y2)3 = 5x2y2
with respect to x .
Anton Velinov Calculus 8 / 57
Implicit Differentiation II
Class Exercise (optional)Find the derivative of
y = xx
with respect to x .
Anton Velinov Calculus 9 / 57
Higher Order Derivatives
DefinitionThe second derivative of f (x) is given by
f ′′(x) =d2f (x)
dx2 =ddx
[df (x)
dx
].
DefinitionIn general the k th-order derivative is the derivative of the(k − 1)th-order derivative.
Anton Velinov Calculus 10 / 57
Taylor Series Approximation
DefinitionAn r-th-order Taylor series approximation of a function f (x) atx = c + ∆ is as follows:
f (x) = f (c) +dfdx
∣∣∣∣∣x=c
·∆ +12!
d2fdx2
∣∣∣∣∣x=c
·∆2 +
+13!
d3fdx3
∣∣∣∣∣x=c
·∆3 + · · ·+ 1r !
d r fdx r
∣∣∣∣∣x=c
·∆r + R(c, x)
provided that all r derivatives of f (x) exist and are continuous ina neighbourhood of c.
Anton Velinov Calculus 11 / 57
First Order Taylor Series Approximation
Figure: First Order Approximation
C
Anton Velinov Calculus 12 / 57
Power Series I
DefinitionA Power series assumes that the remainder term, R(c, x) of theTaylor series goes to 0 as r →∞. It also centres the expansionat c = 0.
Class ExerciseFind the Power series of
f (x) = ex
evaluated at x = 1.
Anton Velinov Calculus 13 / 57
Power Series II
Class Exercise (Optional)Use the previous result to evaluate
limn→∞
(1 +
1n
)n
.
Anton Velinov Calculus 14 / 57
Maxima and Minima
DefinitionThe function f : X → R has a global maximum at x = c iff (x) ≤ f (c) for all x ∈ XThe function f : X → R has a local maximum at x = c iff (x) ≤ f (c) for all x in some open interval around x = c.Analogous definitions hold for global and local minima.
Class ExerciseWhat does the Extreme Value Theorem have to do with theabove definition?
Anton Velinov Calculus 15 / 57
Maximization I
Fermat’s TheoremIf a function f (x) has an extreme point at x = c and f ′(c) exists,then f ′(c) = 0.
This is a necessary condition for an interior maximum.
Class ExerciseFind an example where f ′(x) = 0 does not lead to a maximumor a minimum.
Anton Velinov Calculus 16 / 57
Maximization II
Second Derivative TestIf the second derivative of f (x) exists and if x = c is a criticalpoint of f (x) then:
If f ′′(x) < 0, f (x) has a local maximum at xIf f ′′(x) > 0, f (x) has a local minimum at xIf f ′′(x) = 0, the test is inconclusive.
Class ExerciseUse the second derivative test for the previous exercise.
Anton Velinov Calculus 17 / 57
Indefinite Integral
DefinitionInformally speaking, in case of a continuous function,integration, denoted by
∫·dx , is the inverse of differentiation:∫f ′(x)dx = f (x).
However, we assume that we only know f ′(x) and hence, whenintegrating a function we always add a constant, C to it. This iscalled an indefinite integral. It is over ±∞.
NoteIntegration is not quite the opposite of differentiation asfunctions that are non-differentiable can still be integrated.
Anton Velinov Calculus 18 / 57
Indefinite Integral Rules
Integration Rules∫xkdx = xk+1
k+1 + C for k 6= −1∫x−1dx =log(|x |) + C∫cos(x)dx = sin(x) + C∫sin(x)dx = −cos(x) + C∫eaxdx = (1/a)eax + C∫af (x)dx = a
∫f (x)dx for some constant a not depending
on x∫[af (x) + bg(x)]dx = a
∫f (x)dx + b
∫g(x)dx for some
constants a,b not depending on x .
Anton Velinov Calculus 19 / 57
Definite Integral
DefinitionFrom the fundamental theorem of calculus a definite integral isdefined as:∫ b
af (x)dx =
[∫f (x)dx
]∣∣∣∣∣x=b
−
[∫f (x)dx
]∣∣∣∣∣x=a
= F (b)− F (a).
Intuitively, it is the area under a function over the domain [a,b].
Class ExerciseFind the integral of ∫ b
ax
1b − a
dx .
Anton Velinov Calculus 20 / 57
Integration by Substitution
DefinitionFor the function that can be composed as f (g(x))g′(x), itsintegral over the domain a,b is given as∫ b
af (g(x))g′(x)dx =
∫ g(b)
g(a)f (u)du.
This is known as integration by substitution. This definitionapplies to indefinite integration analogously.
Class Exercise1 What is
∫x/(x2 + 1)dx?
2 What is∫
(x + 1)3dx?
Anton Velinov Calculus 21 / 57
Integration by Parts
DefinitionThrough the product rule we can derive the following formulafor integration by parts∫
f (x)g′(x)dx = f (x)g(x)−∫
f ′(x)g(x)dx .
Class ExerciseFind the integral of ln x .
Anton Velinov Calculus 22 / 57
Differential Equations I
DefinitionA differential equation is an equation that involves an unknownfunction as its solution. It usually involves a general and aparticular solution given some initial conditions.
Intuitively, we are given the nth order derivatives of a function inan equation and we need to solve this in order to find theoriginal function.In economics differential equations are mainly used ingrowth theory
ExampleFind the solution to
dydx
=√
x/y
given the initial condition y = 4, x = 1.
Anton Velinov Calculus 23 / 57
Differential Equations II
Class ExerciseFind the solution to
dydx
= x/y
given the initial condition y = 1, x = 1.
DefinitionThe previous two exercises deal with separable differentialequations, i.e. when the xs and ys can be separated on bothsides of the equation.
Anton Velinov Calculus 24 / 57
Homogeneous Differential Equations (Optional)
DefinitionAn equation of the form
dydx
= f (x , y)
is referred to as a homogeneous differential equation. If the xsand ys are not separable, v = y/x is used to solve theequation.
Class ExerciseFind the solution to
1dydx = x+y
x
2dydx = x2+3y2
2xy (optional).
Anton Velinov Calculus 25 / 57
Multivariate Function Limits I
DefinitionA multivariate or multivariable function, f has n > 1 argumentsmapping onto R, i.e. f : Rn → R. Written as f (x1, x2, . . . , xn) orf (x).
Multivariate function limitIn Euclidean space f has a limit L as x approaches x0 if
∀ ε > 0 ∃ δ(ε) > 0; |f (x)−L| < εwhenever 0 < ‖x−x0‖2 < δ(ε).
We write f (x)→ L as x→ x0 or limx→x0 f (x) = L.
NoteUnlike the univariate case, there are an infinite number ofdirections for x to approach x0.
Anton Velinov Calculus 26 / 57
Multivariate Function Limits II
Class ExerciseDetermine whether the following limits exist
1 lim(x ,y)→(0,0)x2
x2+y2
2 lim(x ,y)→(0,0)xy
x2+y2 .
Anton Velinov Calculus 27 / 57
Multivariate Function Limits III
Class ExerciseShow that the following limit exists
lim(x ,y)→(0,0)
x2yx2 + y2 .
Anton Velinov Calculus 28 / 57
Continuity of Multivariate Functions
Epsilon-Delta Definition
A function f : Rn → R is said to be continuous at x0 ∈ Rn if
∀ ε > 0 ∃ δ(ε,x0) > 0 ; |f (x)− f (x0)| < ε
whenever 0 < ‖x− x0‖2 < δ(ε,x0)
Limit DefinitionA function f : Rn → R is said to be continuous at x0 ∈ Rn if
limx→x0
f (x) = f (x0).
TheoremPolynomial functions are continuous everywhere. Rationalfunctions are continuous everywhere they are defined.
Anton Velinov Calculus 29 / 57
Partial Derivatives I
DefinitionFor the function f : Rn → R, its partial derivative w.r.t. xi isdefined as
fxi =∂f∂xi
= lim∆→0
[f (x1, x2, . . . , xi−1, xi + ∆, xi+1, . . . , xn)
− f (x1, x2, . . . , xi−1, xi , xi+1, . . . , xn)]/∆.
Class ExerciseFind the partial derivatives with respect to x and y for thefollowing function
f (x , y) = x4 + 6√
y + 10.
Anton Velinov Calculus 30 / 57
Partial Derivatives II
Anton Velinov Calculus 31 / 57
Gradient I
DefinitionThe column vector of partial derivatives of the n dimensionalvector valued function f (x) is known as the gradient (denoted∇) of f :
∂f (x)/∂x = ∇ =
∂f (x)/∂x1∂f (x)/∂x2
...∂f (x)/∂xn
=∂f (x)
∂x1e1+
∂f (x)
∂x2e2+· · ·+∂f (x)
∂xnen,
where the eis are orthogonal unit vectors.
Geometric InterpretationThe gradient is always orthogonal to the level set f (x) = k . Itgives the direction of the steepest ascent (in Rn).
Anton Velinov Calculus 32 / 57
Gradient II
Anton Velinov Calculus 33 / 57
Directional Derivatives I
DefinitionPartial derivatives examine the rate of change when allowingone variable to change while the rest are kept constant.Directional derivatives examine the rate of change whenallowing all of a function’s variables to vary. For the functionf : Rn → R the directional derivative with the direction of therate of change denoted by the n dimensional vectoru = [u1 u2 . . . un]′ is given by
Duf (x1, x2, . . . , xn) = lim∆→0
[f (x1 + u1∆, x2 + u2∆, . . . , xn + un∆)
− f (x1, x2, . . . , xn)]/∆
Anton Velinov Calculus 34 / 57
Directional Derivatives II
The limit in the above definition is sometimes difficult tocalculate so an equivalent formula based on the partialderivative is often used
Duf (x1, x2, . . . , xn) = (∂f/∂x1)u1 + (∂f/∂x2)u2 + · · ·+ (∂f/∂xn)un
=n∑
i=1
(∂f/∂xi)ui =n∑
i=1
fxi ui .
Notice that this can be expressed in terms of the gradientvector as
Duf (x) = ∇ · uwhere · denotes the dot product.
ExampleShow that the above formula is equivalent to the one on theprevious slide. Hint: Define the univariate functiong(z) = f (x0
1 + u1z, x02 + u2z, . . . , x0
n + unz) and take itsderivative at z = 0.
Anton Velinov Calculus 35 / 57
Directional Derivatives III
The u VectorNote that the vector u can describe a rate of change in anyinfinite amount of directions. It is normalized to a unit length as
‖uN‖2 =
√√√√ n∑i=1
u2iN = 1,
whereuN =
u‖u‖2
,
and ‖ · ‖2 is the L− 2 vector norm.
Anton Velinov Calculus 36 / 57
The Gradient and the Directional Derivative
NoteUnlike a directional derivative, the gradient is not a scalar but avector.
Class ExerciseFor the function
f (x , y , z) = x2z + y3z2 − xyz
1 Calculate the gradient2 Determine the directional derivative in the direction of
u = [−1 0 3]′
3 Would the directional derivative go in the steepestdirection?
Anton Velinov Calculus 37 / 57
Hessian I
DefinitionThe second derivative of the n dimensional vector valuedfunction f (x) is given by:
∂2f (x)
∂xi∂xj∀i , j = 1, . . . ,n.
These derivatives can be grouped in a matrix known as theHessian matrix, H:
H =∂f (x)
∂x∂x′=
∂2f/∂x1∂x1 ∂2f/∂x1∂x2 · · · ∂2f/∂x1∂xn∂2f/∂x2∂x1 ∂2f/∂x2∂x2 · · · ∂2f/∂x2∂xn
...... · · ·
...∂2f/∂xn∂x1 ∂2f/∂xn∂x2 · · · ∂2f/∂xn∂xn
.Since the order of differentiation does not matter, H is asymmetric matrix.
Anton Velinov Calculus 38 / 57
Hessian II
Second Derivative TestIf x = c ∈ Rn is a critical point of f (x) and if the matrix H exists,then it can be used as a second derivative test in determininglocal optima as follows:
If H is positive definite, then f (·) attains a local minimum atcIf H is negative definite, then f (·) attains a local maximumat cIf the Eigenvalues of H alternate in sign, then f (·) has asaddle point at c.
Anton Velinov Calculus 39 / 57
Jacobian and the Vector-Valued Function
DefinitionSuppose we have the following vector-valued functionf : Rn → Rm, that is we have fi(x1, x2, . . . , xn) = fi(x),x ∈ Rn fori = 1, . . . ,m. Collect all the m functions in an (m × 1) columnvector
f (x) = [f1(x) f2(x) · · · fm(x)]′,
then the derivative of f (x) w.r.t. x is called the Jacobian matrix:
J =∂f (x)
∂x′=
∂f1/∂x1 ∂f1/∂x2 · · · ∂f1/∂xn∂f2/∂x1 ∂f2/∂x2 · · · ∂f2/∂xn
...... · · ·
...∂fm/∂x1 ∂fm/∂x2 · · · ∂fm/∂xn
.
NoteBoth H and J are sometimes defined as their respectivedeterminants.Anton Velinov Calculus 40 / 57
Matrix Differentiation Rules
Matrix Differentiation RulesFor the (n × 1) vector a we have ∂a′x/∂x = ∂x′a/∂x = aFor the (m × n) matrix A we have ∂Ax/∂x′ = AFor the (n × n) matrix C, the quadratic form x′Cx has thederivative ∂x′Cx/∂x = (C′ + C)x, which is 2Cx if C issymmetricFor the (n × n) matrix C, ∂C−1/∂x = −C−1(∂C/∂x)C−1
Class ExerciseShow that the first two points hold.
Anton Velinov Calculus 41 / 57
Multiple Integrals
DefinitionMultiple integrals are of the form∫ ∫
· · ·∫
f (x1, x2, . . . , xn)dx1dx2 · · · dxn.
They can be solved by integrating x1 out, then x2 and so on.Note however that the order of integration does not matter.
Class ExerciseSolve ∫ 2
0
∫ 2
1e−(x+y)dxdy
by integrating out x and y and then y and x . Compare youranswers.
Anton Velinov Calculus 42 / 57
Logarithms in Economics
DefinitionThe natural logarithm is the inverse of e
ln(ex ) = x .
For x > 0 it also follows that
x = eln(x).
In economics texts this is usually denoted as log instead of ln.
Class ExerciseFrom the above definition show that
ln(xa) = a ln(x).
Anton Velinov Calculus 43 / 57
Logarithms as Percentages
Logarithms as PercentagesIn economics the logarithm is often used to describe apercentage. For some small ∆
ln(1 + ∆) ≈ ∆.
Class ExerciseShow that this holds by taking a first-order Taylor expansion ofthe function f (x) = ln(x) around c = 1 evaluated at x = 1.
Anton Velinov Calculus 44 / 57
Complex Numbers C I
DefinitionA complex number, c is written in the form of
c = a + bi
where a and b are real numbers and i is an imaginary numbersuch that i =
√−1.
The Set CThe real number set is a subset of the complex numberset, R ⊂ CC is a field obeying the field axioms (since R is also a field)C however does not satisfy the order axioms, unlike R.
Anton Velinov Calculus 45 / 57
Complex Numbers C II
Figure: Complex Circle
Imaginary axis (i)
Real axis (a)
a+bi
bi
a
R
θ
Anton Velinov Calculus 46 / 57
Complex Numbers C III
DefinitionA complex conjugate, of a complex number a + bi is given by
a− bi .
Both numbers are known as a complex conjugate pair. Additionand multiplication of complex conjugate pairs produce realnumbers.
DefinitionThe modulus or absolute value of a complex number, is itsdistance from the origin as measured by the L− 2 norm
R ≡ ‖a + bi‖2 =√
a2 + b2.
Anton Velinov Calculus 47 / 57
Complex Numbers C IV
Polar CoordinatesA complex number can also be written in Polar coordinate form.Note that
cos(θ) = a/R
andsin(θ) = b/R
hence,a + bi = R[cos(θ) + i · sin(θ)].
Anton Velinov Calculus 48 / 57
Complex Numbers C V
Exponent FormUsing the Power series it is also possible to write a complexnumber as
a + bi = Reiθ.
ExampleVerify the above result by taking the Power series of f (x) =sin(x) and f (x) = cos(x). Hint: Also take the Power series ofex evaluated at x = iθ and plug in all the results in the Polarcoordinate form.
Anton Velinov Calculus 49 / 57
L’ Hôpital’s Rule
DefinitionLet f (·) and g(·) be functions, which are differentiable on theopen interval set X . Then for some point x0 ∈ X if
limx→x0 f (x) = 0 and limx→x0 g(x) = 0 and limx→x0f ′(x)g′(x)
exists or iflimx→x0 f (x) = ±∞ and limx→x0 g(x) = ±∞ andlimx→x0
f ′(x)g′(x) exists
then limx→x0f (x)g(x) = limx→x0
f ′(x)g′(x) .
Class ExerciseUse L’ Hôpital’s Rule to evaluate
limx→0
f (x)
g(x)= lim
x→0
2 sin(x)− sin(2x)
x − sin(x).
Anton Velinov Calculus 50 / 57
Homogenous Functions
DefinitionThe function f (x1, x2, . . . , xn) is homogenous of degree r ∈ R iffor any t > 0
f (tx1, tx2, . . . , txn) = t r f (x1, x2, . . . , xn).
Such functions are commonly used in economics. A functionthat is homogenous of degree 1 can be manipulated as
f (1, x2/x1, . . . , xn/x1) = (1/x1)f (x1, x2, . . . , xn).
Class Exercise1 Give an example of a homogenous function in economics.2 Show that f (x1, x2) =
√x1x2 is homogenous of degree 1.
Anton Velinov Calculus 51 / 57
Implicit Function Theorem I
SettingSuppose we have a system of n functions fi : Rn+m → R, whichdepend on n ’parameters’ x = [x1 x2 · · · xn]′ and m’endogenous’ variables y = [y1 y2 · · · ym]′, i.e. fi(x,y),where x ∈ X ⊂ Rn and y ∈ Y ⊂ Rm. Further, suppose that
fi(x,y) = 0 i = 1, . . . ,n. (1)
Assume the vectors x0 ∈ X and y0 ∈ Y satisfy (1).
GoalWe want to solve for y as a function of x locally around x0 andy0.
Anton Velinov Calculus 52 / 57
Implicit Function Theorem II
DefinitionEquation (1) can be solved locally around (x0,y0) so that y is afunction of x if there are open neighbourhoods of x0 and y0
such that
fi(x, (g1(x),g2(x), . . . ,gn(x))) = 0, i = 1, . . . ,n, (2)
whereyi = gi(x), i = 1, . . . ,n,
provided that x is in its open neighbourhood. gi(x) are know asunique implicit functions.
DefinitionAn open neighbourhood of x ∈ Rn is defined as
{x0 ∈ Rn : ‖x0 − x‖2 < ε}.Anton Velinov Calculus 53 / 57
Implicit Function Theorem III
Implicit Function TheoremSuppose all n functions are continuously partially differentiablew.r.t. their n + m variables. A solution of the type of (2),involving unique implicit functions for the endogenous variables,is possible provided that
|Jy|(x=x0,y=y0) 6= 0.
Further, the effect of a change of x on y at (x0,y0) can beexpressed as
∂g(x)
∂x′= −
[∂f (x,y)
∂y
]−1∂f (x,y)
∂x,
evaluated at (x0,y0).
Anton Velinov Calculus 54 / 57
Implicit Function Theorem IV
Intuitively, the IFT provides a sufficient condition for theexistence of unique solutions (equilibria) and gives us thefirst-order comparative static effects of such a solution.
Example
For the unit circle, x2 + y2 = 1⇔ f (x , y) = x2 + y2 − 1 = 0 canwe solve uniquely for x in terms of y at the point(x0, y0) = (1,0) s.t. f (x ,g(x)) = 0?
Class ExerciseCan we do this at a point (x0, y0) where y0 > 0 or wherey0 < 0?
Class ExerciseTo illustrate that the IFT only gives a sufficient condition for theexistence of unique solutions solve f (x , y) = y3 − x = 0 for y interms of x at the point (x0, y0) = (0,0).
Anton Velinov Calculus 55 / 57
Inverse Function Theorem
Inverse Function TheoremWhen the number of parameters are the same as the numberof endogenous variables, m = n we have that
fi(x,y) = gi(x)− yi , i = 1, . . . ,n.
which is known as the Inverse Function Theorem.
This is a special case of the IFT.
Anton Velinov Calculus 56 / 57
End of Theme 4
DIW Berlin – Deutsches Institutfür Wirtschaftsforschung e.V.Mohrenstraße 58, 10117 Berlinwww.diw.de