math for cs

Upload: ethan0nguyen

Post on 03-Jun-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 Math for CS

    1/38

    1

    POSTGRADUATE LECTURE

    ------

    ------

    Fundamentals of Algorithm

    PART I CHAPTERMATHEMATICAL BASICS

    for:MSc students in Computer Science

    14-Mar-14 N.P. Khu

  • 8/12/2019 Math for CS

    2/38

    2

    CONTENTS

    1. Complex Numbers

    2. Complex Power Series3. Generating Functions

    4. Harmonic &Bernoui l l i Number

    5. Asymptotic Behavior

    1.0

    N.P. Khu

  • 8/12/2019 Math for CS

    3/38

    3

    1. Definitions and Properties

    a. F ield of Complex Numbers

    How we can find a root of the equation ?

    What abou t a new number i that ?

    Complex numbers, can be defined as pairs of real numbers

    equipped with the addition: +

    and the multiplication: .

    form a field, in which is an Abel groupwith

    element uni t , and is also an Abel groupwith

    its unit element, and . distributedto +operation.

    N.P. Khu

    1.COMPLEX NUMBERS

  • 8/12/2019 Math for CS

    4/38

    4

    b. Representations

    Facts:

    So, can be though of as real numbers and

    we mean a combination of with coefficients .

    Let us denote byi , thencan be written as: .

    From this, and

    are called the real

    and imaginary part, respectively.

    Identity: is reads as : !

    N.P. Khu

    1.COMPLEX NUMBERS

    1. Definitions and Properties

  • 8/12/2019 Math for CS

    5/38

    5

    c. Modulus and Argument

    Modulusof absolute value of is defined as:

    Argumentof is a number such that :

    Distancebetween

    is :

    N.P. Khu

    1.COMPLEX NUMBERS

    1. Definitions and Properties

  • 8/12/2019 Math for CS

    6/38

    6

    d. Euler formula

    Let

    it is obtained:

    Euler formula

    then:

    Conjugateof is . From this, we have:

    for a triangle inequality:

    N.P. Khu

    1.COMPLEX NUMBERS

    1. Definitions and Properties

  • 8/12/2019 Math for CS

    7/38

    7

    e. Some Properties

    Some basic properties of the conjugate, for any :

    Identities satisfying for all :

    -a rewrite of the triangle inequality,

    -this is a reverse triangle inequality

    that can be proved as an exercise,

    -this follows by induction.

    N.P. Khu

    1.COMPLEX NUMBERS

    1. Definitions and Properties

  • 8/12/2019 Math for CS

    8/38

    8

    2. Limits - Continuous

    a. Limits

    Open disk with center a, radius r :

    closed disk and boundary:

    A complex function:e.g. :

    A limit: is defined as

    Note: does not exist ! Because, on the real and imaginary

    while

    N.P. Khu

    1.COMPLEX NUMBERS

  • 8/12/2019 Math for CS

    9/38

    9N.P. Khu

    2. Limits - Continuous

    b. Continuity

    If and exist, then:

    In case of then the function is continuous at .

    A function is continuouson a domain if it is at every .If is continuous at and then it is obtained:

    1.COMPLEX NUMBERS

  • 8/12/2019 Math for CS

    10/38

    10

    a. Derivatives

    Suppose is a complex function and is an interior pointof . The derivativeof at is defined as:

    or

    If this limit exists. Then is called dif ferentiable at .. If thefunction is differentiable all points in an open disk centered at

    then is holomorphicor analyticat .

    The function is holomorphic on the open set if it is

    differentiable at every point . Functions which are

    differentiable in the whole complex plane are called entire.

    is entire, , it is holomorphic for any

    is nowheredifferentiable due to

    does not existN.P. Khu

    3. Derivatives

    1.COMPLEX NUMBERS

  • 8/12/2019 Math for CS

    11/38

    11

    a. Derivatives

    Suppose and are differentiable at , and ,and is differentiable at :

    and are open sets in , is a bijection,is the inversefunction of , . . If f is differentiable at ,

    , and is continuous at then is differentiable at

    with:

    N.P. Khu

    3. Derivatives

    1.COMPLEX NUMBERS

  • 8/12/2019 Math for CS

    12/38

    b. Cauchy-Riemann Equations

    If is differentiable at , then:

    [Cauchy-Riemann]

    Suppose is such that the partial derivatives and exist in an

    open disk centered at and are continuous at . If these partialderivatives satisfy the C-R equation then is differentiable at .

    Based on these above cases, the derivative at is given by:

    If we write then and

    , in this case, Eq. C-R becomes:

    It is obtained: (Laplace Equation).12N.P. Khu

    3. Derivatives

    1.COMPLEX NUMBERS

  • 8/12/2019 Math for CS

    13/38

    13

    c. Exponential Function

    Complex exponential functionis defined for as

    Some properties follow from Euler formulaSlide no. 6, satisfying

    for all are:

    The 3rd identity is a very special one and has no counterpart for

    the real exponential function: periodicity with period 2.For then .

    N.P. Khu

    4. Special Functions

    1.COMPLEX NUMBERS

  • 8/12/2019 Math for CS

    14/38

    14

    d. Trigonometr ic Function

    Complex sine, cosineand tangent, cotangent are definedas:

    and

    and

    Properties: for all it is obtained:

    Warning:

    N.P. Khu

    4. Special Functions

    1.COMPLEX NUMBERS

  • 8/12/2019 Math for CS

    15/38

    15N.P. Khu

    4. Special Functions

    e. Logar ithmic Function

    An inverse function to the complex exponential function is

    the complex logari thm , such that:

    that is and

    . The logarithm function would be .

    Given a region , any continuous function that

    satisfies is a branch of the logarithm (on ). Let

    denote that argument of which is in . Then the

    principal logari thmis defined as .

    Suppose is a branch of the logarithm. Then is differentiable

    wherever it is continuous

    and:

    1.COMPLEX NUMBERS

  • 8/12/2019 Math for CS

    16/38

    16N.P. Khu

    5. Curvilinear Integration

    a. I ntegration on Smooth Curve

    Let be a smooth curveparametrized, andis a complex function which is continuous on , we define integral

    of on as

    This definition can be extended to piecewise smooth curves.

    Example: Let over parabol with

    from to . A parametrization of this curve

    is , and . Thus:

    whence

    1.COMPLEX NUMBERS

  • 8/12/2019 Math for CS

    17/38

    17

    1. Sequences

    a. Convergence-Divergence

    Suppose is a sequence and such that for all , thereis an integer such that for all : , in such a case

    the sequence is convergent and is its limit:

    If no such exists, the sequence is divergent.

    Example 1: We have: . For any , let ,

    then

    Example 2: Sequence diverges. Let and :

    if : for any and , let then .

    if : doing the same, letting also has .

    N.P. Khu

    2.COMPLEX POWER SERIES

  • 8/12/2019 Math for CS

    18/38

    18

    1. Sequences

    b. Related Properties

    Let be convergent sequences and , we have:

    In(c)we have to make sure we do not divide by zero.

    Monotone Property: Any bounded monotone sequence converges.

    Archimedean Property: If is any real number, there is an

    integer which is greater than .

    Exponenti als beat polynomials: for any polynomial and

    any , it is obtained .

    Factorials beat exponentials: if , then .

    Note these last properties also works for !

    N.P. Khu

    2.COMPLEX POWER SERIES

    2

  • 8/12/2019 Math for CS

    19/38

    19

    2. Series

    a. Definitions

    A series is a whose members are orpartial sums of the series, where is the sequence of terms.

    A series converges to the limit by definition if :

    for any there exists ,

    or so that for all .

    Example 1: For the telescoping series, we have:

    Example 2: Harmonic series diverges, due to this fact:

    N.P. Khu

    2.COMPLEX POWER SERIES

    2

  • 8/12/2019 Math for CS

    20/38

    20

    2. Series

    b. Absolute Convergence

    Series converges absolutelyif .

    If a series converges absolutely then it converges.

    Example: The alternating harmonic series: converges,

    but not absolutely.

    In fact,

    It is verified , , the general term satisfies:

    The series converges by comparison Example 1 in previous slide.

    N.P. Khu

    2.COMPLEX POWER SERIES

    2 CO O S S

  • 8/12/2019 Math for CS

    21/38

    21

    2. Series

    c. Sequences and Ser ies of Functions

    Sequence of functions convergesat if the sequence ofcomplex numbers converges. If a sequence of functions,

    converges at all in then converges pointwiseon .

    Suppose and are functions defined on . If for all

    there is an such that for all and for all we havethen converges uni formlyin to .

    Let be a sequence of continuous functions on converging

    uniformly to on . Then is continuous on .

    Suppose are continuous on the region , , for alland converges. Then converges absolutely

    and uniformly in , Weierstr ass M-Test .

    Consider on converges pointwise to 0or 1.

    N.P. Khu

    2.COMPLEX POWER SERIES

    2 COMPLEX POWER SERIES

  • 8/12/2019 Math for CS

    22/38

    22

    3. Power Series

    a. Definition

    A power series centered at is a series of functions of the form:

    + The geometr ic series converges absolutely for to

    the function .+ The convergence is uniformon any set of the form

    for any .

    This is straightforward by using Weierstrass M-Test and letting:

    with .

    Finally, for all .

    N.P. Khu

    2.COMPLEX POWER SERIES

    2 COMPLEX POWER SERIES

  • 8/12/2019 Math for CS

    23/38

    23

    3. Power Series

    b. Region of Convergence

    Let an open disk with radius centred at 0,

    and corresponding closed disk: .

    Any power series has a radius of convergence .

    By this, is a nonnegative real number, or , satisfying:

    a. If :, converges absolutelyand uniformlyon

    the closed disk of radius centered at .

    b. If : the sequence of terms is unbounded,

    so does not converge, or divergences.

    Open disk in which the power series converges absolutely isthe region of convergence. If then is the entire

    complex plane, and if then is the empty, e.g. :

    Ratio Test shows that, has a radius of convergence .

    N.P. Khu

    2.COMPLEX POWER SERIES

    2 COMPLEX POWER SERIES

  • 8/12/2019 Math for CS

    24/38

    24

    3. Power Series

    b. Region of Convergence

    Suppose has radius of convergence , thenis differentiable, holomorphic, analyticin .

    has the same radius of convergence .

    Example: Consider and , it is obtained

    From and ,

    this means that for some constant .

    Evaluating at , we see that so as desired !

    N.P. Khu

    2.COMPLEX POWER SERIES

    3 GENERATING FUNCTIONS

  • 8/12/2019 Math for CS

    25/38

    25

    1. Definition

    a. Definition

    Consider a sequence of real numbers, thegenerating function of this sequence is defined on as:

    for those values of s for which the sum

    there exists a radius of convergence such that

    the series convergent if .

    Some of useful generating functions:Polynomial: is entieron .

    Exponential: is also entieron , in which

    Triginometrics:

    N.P. Khu

    3.GENERATING FUNCTIONS

    3 GENERATING FUNCTIONS

  • 8/12/2019 Math for CS

    26/38

    26

    b. Harmonic Numbers

    It is obtained: converges absolutely if .

    Taking its integration, term by term, we have:

    Hence,

    By multiplying the above series of and , we have:

    where

    Hence, is the generating functionof , the so-called

    harmonic sequenceor harmonic numbersw.r.t n.

    N.P. Khu

    3.GENERATING FUNCTIONS

    1. Definition

    3 GENERATING FUNCTIONS

  • 8/12/2019 Math for CS

    27/38

    27

    2. Generating Probabilities

    a. Probabil i ty Generating Functions

    Consider a count r.v. , i.e. a discrete r.v. taking non-negativevalues, and , probabil i ty generating

    functionis:

    From , the series converges absolutely for , e.g.

    : Binomialr.v. ,

    : Poissonr.v. ,

    : Negative Binomialr.v. has generating function:

    if , .

    N.P. Khu

    3.GENERATING FUNCTIONS

    3 GENERATING FUNCTIONS

  • 8/12/2019 Math for CS

    28/38

    28

    b. Uniqueness

    If and have probability generating function andrespectively, then it is obtained :

    iff

    i.e. iff and have the same probability distribution.

    Let be a count r.v. and the rthderivative of itsat . Then

    So, and

    That is :

    e.g. , then , ,

    and finally,

    N.P. Khu

    3.GENERATING FUNCTIONS

    2. Generating Probabilities

    3 GENERATING FUNCTIONS

  • 8/12/2019 Math for CS

    29/38

    29

    3. An Application

    a. Solving Recurrence Relation

    Matching Problem: it is faced with the recurrence relation

    for the probability that no matches occur in an n-card matching

    problem. Multiply through by and sum over:

    Let we can write , provided that

    with condition :

    Expand and extract the coefficient of , then for :

    N.P. Khu

    3.GENERATING FUNCTIONS

    4 BERNOUILLI NUMBER

  • 8/12/2019 Math for CS

    30/38

    30

    1. Bernouilli Polynomial

    a. Bernouil l i Numbers

    The generating function for the Bernoull i numbersis

    From:

    Then:

    Replacing and using , it is obtained:

    N.P. Khu

    4.BERNOUILLI NUMBER

    4 BERNOUILLI NUMBER

  • 8/12/2019 Math for CS

    31/38

    31

    1. Bernouilli Polynomial

    a. Bernouil l i Numbers

    Radius of convergence: the generating function is singularwhenever , except for . Thus the closest singularities to

    the real axis occur at 2i , so that the radius of convergence

    is 2, and :

    It is inferred that the Bernoulli numbers grow rapidly with n .

    We can not deduce the sign or overall constant from this analysis:

    The true asymptotic behavior of is :

    N.P. Khu

    4.BERNOUILLI NUMBER

    4 BERNOUILLI NUMBER

  • 8/12/2019 Math for CS

    32/38

    32

    1. Bernouilli Polynomial

    a. Bernouil l i Numbers

    Bernouilli numbers compared with its above approximation:

    N.P. Khu

    4.BERNOUILLI NUMBER

    4 BERNOUILLI NUMBER

  • 8/12/2019 Math for CS

    33/38

    33

    1. Bernouilli Polynomial

    b. Bernouil li Polynomials

    The Bernoulli polynomials are defined by the generating function

    where

    Properties of these polynomials can be deduced as follows,

    Bernoulli polynomials at zero are equal to the Bernoulli numbers

    with

    and

    by comparing corresponding terms in the generating function

    expansion, we find

    N.P. Khu

    4.BERNOUILLI NUMBER

    4 BERNOUILLI NUMBER

  • 8/12/2019 Math for CS

    34/38

    34

    2. Properties

    b. Bernouil li Polynomials

    Dierentiate the generating function w.r.t its 2ndargument:and

    Equating coecients of we have: .By direct power series expansion of the generating function, the 1st

    few Bernoulli polynomials can be read o:

    So, and some others also be found, as follows:

    N.P. Khu

    4.BERNOUILLI NUMBER

    4 BERNOUILLI NUMBER

  • 8/12/2019 Math for CS

    35/38

    35

    2. Properties

    b. Bernouil li Polynomials

    Direct power series expansion of the generating function we have:

    from which we read o:

    By keeping two more terms in the expansion we find

    N.P. Khu

    4.BERNOUILLI NUMBER

    5 ASYMPTOTIC BEHAVIORS

  • 8/12/2019 Math for CS

    36/38

    36

    1. Stirling Formula

    a. Theorem:

    Proof :

    using the following steps:

    1. Verify that:

    2. Show that: is a bounded, monotone decreasing sequence.

    3. Conclude that: , for some .

    4. Conclude that: for some positive

    real number .

    5. Show that: using the following formula, named Wallis:

    N.P. Khu

    5.ASYMPTOTIC BEHAVIORS

    5 ASYMPTOTIC BEHAVIORS

  • 8/12/2019 Math for CS

    37/38

    37

    2. Approximations

    b. Some Approximations

    Euler constant:

    whence

    By using 6 terms:

    Stirling constant: .Using complex integral : , in general, it is obtained:

    Replacing :

    hence .

    N.P. Khu

    5.ASYMPTOTIC BEHAVIORS

  • 8/12/2019 Math for CS

    38/38

    38

    Home works:1. file BT-x, x = 1, 2, 3, 4 in:

    MScMath-Excer-1.zip

    Assignments:1. read extensions in zip-file

    MScMath-Assig-1.zip

    Assignment