Lecture2 Slides 2014

Embed Size (px)

Citation preview

  • 8/19/2019 Lecture2 Slides 2014

    1/37

       

       

    FUNCTIONS OF SEVERAL VARIABLES

    FABIZ I, Fall 2014

    Luiza Bădin

    Department of Applied Mathematics,

    Bucharest University of Economic Studies

  • 8/19/2019 Lecture2 Slides 2014

    2/37

    Functions of several variables    2

       

       

    Limits. Continuity

    •  So far, we have studied functions of one variable, typically written as y =  f (x),which represented the variation that occurred in some (dependent) variable y, as

    another (independent) variable x changed.

    •  In the real world, however, it is unusual to deal with functions that depend on asingle variable, and instead of  y =  f (x), we often work with  y  =  f (x1, x2),

    y  =  f (x1, x2, x3), or even the multivariate case y =  f (x1, x2,...,xn).

    •  Economic models are usually functions of more than one variable, assuming forinstance that output, Q = f (L, K), is a function of two inputs, labor and capital.

    •  In order to understand the concept of limit and continuity in the general,multivariate case, we have to start with the idea of ”closeness" in the

    n-dimensional space.

    •  In the univariate space, we measure the closeness of two arbitrary points by thelength of the segment joining the points.

    •  In the  n-dimensional space, the distance will be called Euclidian distance.

  • 8/19/2019 Lecture2 Slides 2014

    3/37

    Functions of several variables    3

       

       

    Limits. Continuity

    Consider the set

    Rn = {x = (x1, x2, . . . , xn)| xi ∈ Rn, ∀i = 1, . . . , n} = R× R× . . .× R  

       n  times  R

    .

    Definition  1.  An application  f   : A ⊆ Rn → R,  f (x) = f (x1, x2, . . . , xn)  is called real  function of  n  variables.Definition  2.  An application  d : Rn × Rn → [0,∞)  is said to be a distance if the 

     following properties hold:

    1.   d(x, y) ≥ 0, ∀x, y ∈ Rn and  d(x, y) = 0 ⇔ x =  y;2.   d(x, y) = d(y, x), ∀x, y ∈ Rn;3.   d(x, z ) ≤ d(x, y) + d(y, z ), ∀x , y , z   ∈ Rn

  • 8/19/2019 Lecture2 Slides 2014

    4/37

    Functions of several variables    4

       

       

    Limits. Continuity

    Example  1.   The function  d : Rn × Rn → [0,∞)  defined by 

    d(x, y) =  n

    i=1(xi − yi)

    2

     for  x = (x1, x2, . . . xn)  and  y = (y1, y2, . . . , yn)   is a distance named Euclidian distance.

    For  n = 1, we have  d(x, y) = |x1 − y1|, where  x =  x1  and  y =  y1.For  n = 2, we have  x = (x1, x2),  y = (y1, y2)  and  d(x, y) =  

    (x1 − y1)2 + (x2 − y2)2.

  • 8/19/2019 Lecture2 Slides 2014

    5/37

    Functions of several variables    5

       

       

    Limits. Continuity

    Definition  3.  Consider  x0 ∈ Rn and  r > 0. The set  S r(x0) = {x ∈ Rn| d(x0, x) < r}is the open sphere centered at  x0  with radius  r.

    The point  x0 ∈

    Rn is an interior point of the set  A

    ⊂R

    n if and only if  ∃

    r > 0   such 

    that  S r(x0) ⊆ A.An  n-dimensional interval is  I 1 × I 2 × . . . I  n = {(x1, x2, . . . , xn)|xk ∈ I k, k = 1, . . . n}where  I k  = (ak, bk),  k = 1, . . . n.

    Any open sphere centered at x0  contains an n-dimensional interval which includes x0

    and conversely.

  • 8/19/2019 Lecture2 Slides 2014

    6/37

    Functions of several variables    6

       

       

    Limits. Continuity

    For simplicity, all the results are presented for n = 2.

    Consider A ⊂ R2,  f   : A → R and  (a, b)  an interior point of  A.Definition  4.   (Limit)   lim

    (x,y)→(a,b)f (x, y) = l ∈ R   if for every  (xn, yn)n≥1 ⊂ A  with 

    (xn, yn) → (a, b)  and  (xn, yn) = (a, b), ∀n ≥ 1  we have   limn→∞ f (xn, yn) = l.Equivalently, if   l ∈ R,   lim

    (x,y)→(a,b)f (x, y) = l ∈ R if for every  ε > 0  there exists

    η =  η(ε) >  0  such that for every (x, y) ∈ A with |x − a| < η, |y − b| < η  we have|f (x, y) − l| < ε.Definition  5.   (Continuity) A function  f   is continuous at  (a, b)   if the limit 

    lim(x,y)→(a,b) f (x, y)  exists and it is equal to  f (a, b):   lim(x,y)→(a,b) f (x, y) = f (a, b).

  • 8/19/2019 Lecture2 Slides 2014

    7/37

  • 8/19/2019 Lecture2 Slides 2014

    8/37

    Functions of several variables    8

       

       

    Partial Derivatives

    Consider a set A ⊂ R2,  f   : A → R and (a, b)  an interior point of  A.Definition  6.   If   lim

    x→a

    f (x, b)− f (a, b)x− a   exists and is finite, we say that  f   admits a 

    partial derivative with respect to  x  at the point  (a, b)  and we write:

    limx→a

    f (x, b) − f (a, b)x − a   = f 

    x(a, b) =   ∂f ∂x

    (a, b).

    Definition  7.   If   limy→b

    f (a, y)− f (a, b)y − b   exists and is finite, we say that  f   admits a 

    partial derivative with respect to  y  at the point  (a, b)  and we write:

    limy→b

    f (a, y)

    −f (a, b)

    y − b  = f 

    y(a, b) =

      ∂f 

    ∂y(a, b).

  • 8/19/2019 Lecture2 Slides 2014

    9/37

    Functions of several variables    9

       

       

    Multivariate case  (n ≥ 2)

    If  A ⊂ Rn and a = (a1, a2, . . . , an) is an interior point of  A, then for every i  = 1, . . . , n

    limxi→ai

    f (a1, . . . , xi, . . . an) − f (a1, . . . , ai, . . . an)xi − ai = f 

    xi

    (a1, . . . , an) =  ∂f 

    ∂xi(a1, a2, . . . , an).

    If  f xi as  n-variable function of  (x1, x2, . . . , xn)  admits first order partial derivatives

    with respect to x

     j  at some point (a1

    , a2

    , . . . , an) ∈

    Rn

    , then

    (f xi)xj

    (a1, a2, . . . , an) = f xixj

    (a1, a2, . . . , an) =  ∂ 2f 

    ∂x j∂xi(a1, a2, . . . , an)

    is the second order partial derivative of function  f  calculated at (a1, a2, . . . , an).

    For a two-variable function f   : A → R with A ⊂ R2, if the applications f x, f y  : A → Rare defined at any point of  A and if they also admit partial derivatives with respect

    to  x and  y, then their partial derivatives are the second order partial derivatives and

    the following notations apply:  f x2

     = (f x)x,  f 

    xy  = (f 

    x)y,  f 

    yx  = (f 

    y)x,  f 

    y2

     = (f y)y.

  • 8/19/2019 Lecture2 Slides 2014

    10/37

    Functions of several variables    10

       

       

    Examples

    Example  2.  Find  f 

    x2,  f 

    y2,  f 

    xy,  f 

    yx  for the next two-variable functions:1.   f (x, y) = x3 + 2xy2 −   x

    y, y = 0;

    2.   f (x, y) = ln(1 + x2 + 2y2).

  • 8/19/2019 Lecture2 Slides 2014

    11/37

  • 8/19/2019 Lecture2 Slides 2014

    12/37

    Functions of several variables    12

       

       

    Differentiability, partial derivatives and continuity

    Next results establish the connection between differentiability, partial derivatives andcontinuity.

    Theorem  2.   If  A ⊂ R2 and  f   : A → R   is differentiable at  (a, b) ∈ A  then  f   admits  first order partial derivatives with respect to  x  and  y  at  (a, b)  and  f x(a, b) = λ,

    f y(a, b) = µ.

    Proof.   Consider y =  b, x = a  such as (x, b) ∈ A. As  f  is differentiable at (a, b)  wehavef (x, y) − f (a, b) = λ(x − a) + µ(y − b) + ω(x, y)ρ(x, y)

    ⇒   f (x, b) − f (a, b)x − a   = λ + ω(x, b)

    |x − a|x − a  .

    Since   limx→a,y→b

    ω(x, y) = 0  then

    limx→a

    f (x, b)− f (a, b)x − a   = λ  + limx→a ω(x, b)

    |x − a|x − a   = λ ⇒ f 

    x(a, b) = λ.

    Similarly,  f y(a, b) = µ.

  • 8/19/2019 Lecture2 Slides 2014

    13/37

    Functions of several variables    13

       

       

    Therefore, if the two variable function f  is differentiable at (a, b), then we have

    f (x, y) − f (a, b) = f x(a, b)(x − a) + f y(a, b)(y − b) + ω(x, y)ρ(x, y).

  • 8/19/2019 Lecture2 Slides 2014

    14/37

    Functions of several variables    14

       

       

    Differentiability, partial derivatives and continuity

    Theorem  3.   If  f   : A ⊂ R2 → R  is differentiable at  (a, b) ∈ A  then  f   is continuous at (a, b).

    Proof.   If  f  is differentiable at (a, b)  then there exists the two-variable function

    ω :  A → R continuous at (a, b)  with  ω(a, b) = 0  such thatf (x, y)

    −f (a, b) = f x(a, b)(x

    −a) + f y(a, b)(y

    −b) + ω(x, y)ρ(x, y).

    Since ω :  A → R is continuous at (a, b)  with  ω(a, b) = 0, we have   limx→a,y→b

    ω(x, y) = 0.

    Moreover   limx→a,y→b

    ρ(x, y) = limx→a,y→b

     (x − a)2 + (y − b)2 = 0  and so

    limx→a,y→b

    [f (x, y)−f (a, b)] = limx→a,y→b

    f x(a, b)(x − a) + f y(a, b)(y − b) + ω(x, y)ρ(x, y)

    = 0

    ⇒  limx→a,y→b

    f (x, y) = f (a, b), which is exactly the continuity of the function f  at the

    point (a, b).

    Next theorem will be presented without proof.

  • 8/19/2019 Lecture2 Slides 2014

    15/37

    Functions of several variables    15

       

       

    Theorem  4.  If the first order partial derivatives  f x, f y   of  f   : A ⊂ R2 → R, are 

    defined at any point in an open sphere centered at  (a, b),  S r(a, b) ⊂ A  and they are continuous at  (a, b), then  f   is differentiable at  (a, b).

  • 8/19/2019 Lecture2 Slides 2014

    16/37

    Functions of several variables    16

       

       

    The total differential

    Definition  9.  Consider  f   : A ⊂ R2

    → R and  (a, b)  an interior point of  A  such that f   is differentiable at  (a, b). Then the total differential of the function  f   at point 

    (a, b), denoted by  df (x, y; a, b)  or  df (a,b)(x, y)  is the two-variable function defined by 

    df (a,b)(x, y) = f x(a, b)(x − a) + f y(a, b)(y − b).

    Remark   1.  Consider the two-variable functions on  R2,  φ, ψ : R2 → R,φ

    (x, y

    ) = x, ψ

    (x, y

    ) = y

      that are differentiable on  R

    2

    and φx(x, y) = 1, ψy(x, y) = 1, φ

    y(x, y) = 0, ψ

    x(x, y) = 0  and so

    dφ(a,b)(x, y) = (x− a)  notation=   dx  and  dψ(a,b)(x, y) = (y − b)  notation=   dy.Therefore, if  f   is an arbitrary function,

    df (a,b)(x, y) = f x(a, b)dx + f 

    y(a, b)dy

    or df (a,b) =  f 

    x(a, b)dx + f 

    y(a, b)dy.

    The total differential of function  f  approximates the variation of  f   around  (a, b).

  • 8/19/2019 Lecture2 Slides 2014

    17/37

    Functions of several variables    17

       

       

    The second order total differential of the function  f  at the point  (a, b)   is 

    d2f (a,b)(x, y) = d(df )(a,b)(x, y) = f x2(a, b)dx

    2 + f y2(a, b)dy2 + 2f xy(a, b)dxdy.

  • 8/19/2019 Lecture2 Slides 2014

    18/37

    Functions of several variables    18

       

       

    Examples

    1. Find out the first and the second order partial derivatives of the followingfunctions:

    (a)   f   : A  = {(x, y) ∈ R2|y = 0} → R, f (x, y) = xy  +   xy

    (b)   f   : A  = R2 \ {(0, 0)} → R, f (x, y) =   x√ x2+y2

    (c)   f (x, y) = x3 + y3 + 3xy

    (d)   f (x, y) = x3 + 3xy2 − 12y − 15x(e)   f (x, y) = xy  +   50

    x  +   20

    y − 3,  x = 0, y = 0;

    (f)   f (x , y , z  ) = 2x2 + 2y2 + 2(xy + yz  + x + y + 3z );

    (g)   f (x , y , z  ) = x2 + y2 + z 2 − xy + x − 2z .2. Prove that f xy(0, 0) = f yx(0, 0)  for the function f   : R2 → R,

    f (x, y) =xy

    x2−y2x2+y2 ,   (x, y) = (0, 0)

    0,   (x, y) = (0, 0)(3)

    .

  • 8/19/2019 Lecture2 Slides 2014

    19/37

    Functions of several variables    19

       

       

    3. Using the definition, prove that the function f   : R2 → R,  f (x, y) = 3x + y2 isdifferentiable at (2, 1).

    4. Is the function f   : R2 → R(a)   f (x, y) = x3 + xy + y3 differentiable at (1, 1)?

    (b)   f (x, y) = 

    x2 + y2 differentiable at (0, 0)  ?

    (c)

    f (x, y) = xyx2−y2

    x2+y2 ,   (x, y) = (0, 0)0,   (x, y) = (0, 0)

    differentiable at (0, 0)?

    5. Consider the function f   : R× R→ R, f (x, y) = (x− 2)46(y − 3)44.Then

    ∂ 82

    ∂x42

    ∂y40

    f (26, 27)

    is equal to: a) 1650; b) 1560; c) 1272; d) 1722; e) 1982; f) 1892; g) 2700; h) 2070;

    i) 2256; j) 2526; k) 2450; l) 2540; m) none of the previous.

  • 8/19/2019 Lecture2 Slides 2014

    20/37

    Functions of several variables    20

       

       

    Optimization: Finding maxima and minima

    Consider f   : A ⊂ R2 → R and (a, b)  an interior point of  A. Assume that f   is  n-timesdifferentiable at (a, b)  and the mixed partial derivatives are equal.

    Definition  10.  Consider  f   : A ⊂ R2 → R and  (a, b) ∈ A. The point  (a, b)  is a  local maximum (minimum) for  f  if there exists  r > 0  such that  S r(a, b)

    ⊂A  and for every 

    (x, y) ∈ S r(a, b)  we have  f (a, b) ≥ f (x, y)  (respectively  f (a, b) ≤ f (x, y)).If  (a, b)  is a local maximum or a local minimum, then  (a, b)   is a local extreme point .

    In other words, a point is a local maximum if there are no nearby points at which f 

    takes a larger value. If we want to emphasize that a point (a, b)  is a max of  f  on the

    whole domain A, not just a local max, we call  (a, b)  a  global  max or an  absolute   max

    of  f   on  A.

  • 8/19/2019 Lecture2 Slides 2014

    21/37

    Functions of several variables    21

       

       

    Extreme points and partial derivatives

    Proposition 1.   If  (a, b) ∈ A ⊂ R2 is a local extreme point for the function f   : A → R and if  ∃r > 0  such that the partial derivatives  f x, f y  exist on  S r(a, b) ⊂ Aand are defined at any  (x, y)

    ∈S r(a, b), then  f 

    x(a, b) = 0, f 

    y(a, b) = 0.

    Proof.   Let (x, b) ∈ S r(a, b)  and consider the function φ(x) = f (x, b). As (a, b)  is alocal extreme point of  f , it comes that  x =  a  is a local extreme point for  φ. Because

    φ(a)  exists, by Fermat theorem we have φ(a) = 0  and so

    f x(a, b) = limx→a

    f (x, b) − f (a, b)x − a   = φ

    (a) = 0. Similarly, f y(a, b) = 0.

  • 8/19/2019 Lecture2 Slides 2014

    22/37

    Functions of several variables    22

       

       

    Stationary points and saddle points

    Definition  11.   An interior point  (a, b)  of  A, is called a  stationary point  of  f , if 

    f x(a, b) = 0  and  f 

    y(a, b) = 0.

    Any local extreme point (a, b), interior of  A, is a stationary point of  f (x, y). The

    reciprocal is not true: there are stationary points that are not extremes.

    Definition 12.  Stationary points that are not extreme points are called  saddle points .

  • 8/19/2019 Lecture2 Slides 2014

    23/37

    Functions of several variables    23

       

       

    Finding Extremes

    Theorem  5.  Consider a subset  A ⊂ R2,  f   : A → R and  (a, b)  a stationary point for the function  f . Assume that  ∃r > 0  such that the second order derivatives f x2

    , f y2

    , f xy, f yx  are continuous on  S r(a, b). Let  H (a, b) = (f 

    xixj

    (a, b))i,j=1,2  be the 

    hessian matrix and let  ∆1(a, b) = f x2(a, b),  ∆2(a, b) = det H (a, b). Then:

    •   if  ∆2(a, b) >  0,  (a, b)   is a local extreme point:–   if  ∆1(a, b) >  0  then  (a, b)  is a local minimum;

    –   if  ∆1(a, b) <  0  then  (a, b)  is a local maximum.

    •  if  ∆2(a, b) <  0, then  (a, b)   is not an extreme point, is a saddle point.

  • 8/19/2019 Lecture2 Slides 2014

    24/37

    Functions of several variables    24

       

       

    Finding extremes

    1. If  ∆2(a, b) = 0  we can conclude nothing and the investigation has to be

    continued some other way. For instance we might check the sign of 

    f (x, y) − f (a, b) on  S r(a, b).2. We note that when ∆2(a, b) >  0, the second order partial derivatives

    f x2

    (a, b), f y2

    (a, b)  have the same sign, since  f x2

    (a, b)f y2

    (a, b) >  0, so we could as

    well check whether f y2

     is positive or negative if that were easier.

  • 8/19/2019 Lecture2 Slides 2014

    25/37

    Functions of several variables    25

       

       

    Multivariate case  n ≥ 2

    Consider A ⊂ Rn,  f   : A → R,  a = (a1, a2, . . . , an) ∈ A  a stationary point for thefunction f  such as its second order partial derivatives are continuous on an open

    sphere S r(a). Then the Hessian matrix associated to f at  a ∈ A isH (a) = (f xixj(a))i,j=1,...,n.

    Consider the following determinants:

    ∆1(a) = f x21

    (a),

    ∆2(a) =

    f x21

    (a)   f x1x2(a)

    f x2x1(a)   f x22

    (a)

    = f x21(a)f x22(a) − f x1x2(a)f x2x1(a),. . . . . . . . .

    ∆n(a) = det H (a)and assume ∆i(a) = 0, ∀i = 1, . . . , n.

  • 8/19/2019 Lecture2 Slides 2014

    26/37

    Functions of several variables    26

       

       

    Multivariate case  n ≥ 2

    The matrix H (a)  is called positive definite   if  ∆1(a) >  0, ∆2(a) >  0, . . . , ∆n(a) >  0

    and negative definite  if  ∆1(a) <  0, ∆2(a) >  0, . . . , (−1)n∆n(a) >  0.Then if  H (a)  is

    •  positive definite, then x =  a  is a local minimum.•  negative definite, then x =  a  is a local maximum;•  indefinite (neither positive nor negative definite), then x =  a  is a saddle point.

  • 8/19/2019 Lecture2 Slides 2014

    27/37

    Functions of several variables    27

       

       

    Examples

    Find the local extreme points of the following functions:Example  3.   f   : R2 → R,  f (x, y) = x2 + y2

    −2

    −1

    0

    1

    2

    −2

    −1

    0

    1

    20

    2

    4

    6

    8

    x valuesy values

      z

      = 

       f   (  x ,  y

       )

    Figure 1:   f (x, y) = x2 + y2

  • 8/19/2019 Lecture2 Slides 2014

    28/37

    Functions of several variables    28

       

       

    Examples

    Example  4.   f   : R2 → R,  f (x, y) = x2 − y2

    −2−1

    01

    2

    −2

    −1

    0

    1

    2

    −4

    −2

    0

    2

    4

    x values

    y values

      z

      = 

       f   (  x ,  y   )

    Figure 2:   f (x, y) = x2 − y2

  • 8/19/2019 Lecture2 Slides 2014

    29/37

    Functions of several variables    29

       

       

    Examples

    Example  5.   f   : R2

    → R,  f (x, y) = xe−(x2+y2)

    −2

    −10

    12

    −2

    −1

    0

    1

    2−0.5

    0

    0.5

    x valuesy values

      z

      = 

       f   (  x ,  y

       )

    Figure 3:   f (x, y) = xe−(x2+y2)

  • 8/19/2019 Lecture2 Slides 2014

    30/37

    Functions of several variables    30

       

       

    Examples

    Example  6.   f   : R2

    → R,  f (x, y) = xye−(x2+y2)

    −2

    −1

    0

    1

    2

    −2

    −1

    0

    1

    2−0.2

    −0.1

    0

    0.1

    0.2

    x valuesy values

      z

      = 

       f   (  x ,  y

       )

    Figure 4:   f (x, y) = xye−(x2+y2)

  • 8/19/2019 Lecture2 Slides 2014

    31/37

    Functions of several variables    31

       

       

    Examples

    Find the local extreme points of the following functions:

    1.   f   : R2 → R,  f (x, y) = x3 + y3 + 3xy;

    2.   f   :R

    2

    → R,  f (x, y) = x3

    − y2

    − 4x;3.   f   : R2 → R,  f (x, y) = x3 + 3xy2 − 12y − 15x;4.   f (x, y) = xy  +   50

    x  +   20

    y − 3,  x = 0, y = 0;

    5.   f   : R3 → R,  f (x,y,z ) = 2x2 + 2y2 + 2(xy + yz  + x + y + 3z );6.   f   : R3

    →R,  f (x,y,z ) = x2 + y2 + z 2

    −xy + x

    −2z .

  • 8/19/2019 Lecture2 Slides 2014

    32/37

    Functions of several variables    32

       

       

    Least Squares Method

    •  The Least Squares Method (LSM) was first described by Gauss around 1794 andthe most important application of the LSM is in data fitting. The best fit in the

    least-squares sense minimizes the sum of squared residuals, a residual being the

    difference between an observed value and the fitted value according to a given

    model.

    •  Least squares problems fall into two categories: linear or ordinary least squaresand non-linear least squares, depending on whether or not the residuals are

    linear in all unknowns.

    •  Researchers studying the data from experiments are often interested indiscovering whether the variables under study are linearly related, or in finding

    the linear approximation which best fits the data points according to some

    specific criterion. This may help detecting any possible underlying patterns and

    also predict future values.

  • 8/19/2019 Lecture2 Slides 2014

    33/37

    Functions of several variables    33

       

       

    Least Squares Method

    Suppose the data points are (x1, y1), . . . , (xn, yn),  n ≥ 3.For any given line y  =  ax + b  we can measure the distance from any of these points

    to the line  yi =  axi + b, by

    d2i   = (yi − yi)2 = (yi − (axi + b))2.

    The line which minimizes the sum of squared residuals:

    S (a, b) =n

    i=1

    [yi − (axi + b)]2

    is called the least squares line.

    The corresponding method is called least squares method or ordinary least squares

    (OLS) and occurs in linear regression analysis.

    The values a∗ and  b∗ that minimize S (a, b)  are usually called least squares

    approximations (estimators) and under specific assumptions on the data generating

    process, they have important statistical properties.

  • 8/19/2019 Lecture2 Slides 2014

    34/37

    Functions of several variables    34

       

       

    Least Squares Method

    S a(a, b) = −2n

    i=1

    [yi − (axi + b)]xi

    S b(a, b) = −2n

    i=1

    [yi − (axi + b)].(4)

    a

    ni=1

    x2i  + bn

    i=1

    xi =n

    i=1

    xiyi

    a

    ni=1

    xi + nb =n

    i=1

    yi.

    (5)

    The equation system (5) is called Gauss normal equations system and it can be

    proved that it has a unique solution, which is the global minimum point for the sum

    of squared residuals, S (a, b).

  • 8/19/2019 Lecture2 Slides 2014

    35/37

    Functions of several variables    35

       

       

    Least Squares Method

    ∆ =

    ni=1 x

    2i

    ni=1 xin

    i=1 xi   n

    = nn

    i=1

    x2i −

      ni=1

    xi

    2= 0

    ∆a =n

    i=1 xiyin

    i=1 xini=1 yi   n

    = nn

    i=1

    xiyi −n

    i=1

    xi

    ni=1

    yi

    ∆b =

    n

    i=1 x2i

    ni=1 xiyi

    n

    i=1 xi n

    i=1 yi

    =n

    i=1

    x2i

    ni=1

    yi −n

    i=1

    xi

    ni=1

    xiyi

  • 8/19/2019 Lecture2 Slides 2014

    36/37

    Functions of several variables    36

       

       

    Least Squares Method

    a∗

    = ∆a

    ∆   =  nni=1 xiyi −

    n

    i=1 xini=1 yinn

    i=1 x2i − (ni=1 xi)2   (6)

    b∗ = ∆b

    ∆  =

    ni=1 x

    2i

    ni=1 yi −

    ni=1 xi

    ni=1 xiyi

    nn

    i=1 x2i − (

    ni=1 xi)

    2  (7)

  • 8/19/2019 Lecture2 Slides 2014

    37/37

    Functions of several variables    37

       

       

    Least Squares Method

    Example  7.  Find the line which best fits the data points:   (0, 4),  (3, 3),  (4, 2),  (3, 1),

    (5, 0).

    Answer:   5x + 7y = 29.

    Example 8.  Consider the following time series corresponding to the monthly sales of 

    some company:

    t 1 2 3 4 5 6 7 8 9 10  

    y(t) 10 12 12 12 14 15 15 15 17 18  

    i) Using the Least Squares Method, find parameters  a  and  b   such that equation 

    y(t) = a + bt  provides the best linear fit for the given data.

    ii) Using the result of (i), predict the sales for November (t=11) and December 

    (t=12).Answer:   a = 9, 6  and  b = 0, 8.