2 Linear Fcts
2 Linear Fcts
Affine approximation
Regression model
Example
f (x) = x1 + x2 − x23
Given the vector x = (1, 2, 3):
f (x) = 1 + 2 − 32
= −6
Why?
Consider the case with 3 terms: f (αx + βy + γz)
Well βy + γz is just a vector! And any arbitrary vector can be written in the
form of a scalar of 1 times a vector. Let w = βy + γz and δ = 1.
LHS = RHS
Therefore our function is linear because it satisfies the superposition property.
LHS = RHS
Therefore our function is linear because it satisfies the superposition property.
2: Linear functions 6/25
Superposition and linear functions
• f satisfies the superposition property if
f (αx + βy) = αf (x) + βf (y)
Another example: Consider the function f (z) = z1 + z22 . Does it satisfy the
superposition property?
! " # " #$ !" #$
x1 y1 αx1 + βy1
LHS: f (αx + βy) = f α +β =f
x2 y2 αx2 + βy2
= (αx1 + βy1 ) + (αx2 + βy2 )2
!" #$ !" #$
x1 y1
RHS: αf (x) + βf (y) = αf +β
x2 y2
= α(x1 + x22 ) + β(y1 + y22 )
= αx1 + βy1 + αx22 + βy22
LHS ∕= RHS
Therefore our function is not linear because it does not satisfy the
superposition property.
2: Linear functions 7/25
The inner product function
f (x) = aT x = a1 x1 + a2 x2 + · · · + an xn
% (
+ ( +.
x1 y1
& ) x2 , ) y2 ,/
& ) , ) ,/
LHS: f (αx + βy) = aT (αx + βy) = aT &α ) . , + β ) . ,/
' * .. - * .. -0
xn yn
%( + ( +. %( +.
αx1 βy1 αx1 + βy1
&) αx2 , ) βy2 ,/ &) αx2 + βy2 ,/
&) , ) ,/ &) ,/
= a & ) . , + ) . ,/ = a T
T
&) .. ,/
'* .. - * .. -0 '* . -0
αxn βyn αxn + βyn
= a1 (αx1 + βy1 ) + a2 (αx2 + βy2 ) + · · · + an (αxn + βyn )
= α(a1 x1 + a2 x2 + . . . an xn ) + β(a1 y1 + a2 y2 + · · · + an yn )
• suppose f : Rn → R is linear
• specifically: ai = f (ei )
• follows from
f (x) = f (x1 e1 + x2 e2 + · · · + xn en )
= x1 f (e1 ) + x2 f (e2 ) + · · · + xn f (en )
= x1 a1 + x2 a2 + · · · + xn an
LHS ∕= RHS
2: Linear functions 11/25
Affine functions
f (x) = aT x + b = a1 x1 + a2 x2 + · · · + an xn + b
α1 + α2 + · · · + αm = 1
Affine approximation
Regression model
10
fˆ(x′ )
∂f ∂f
= f (z) + (z)(x′ − z) h = (z)(x′ − z)
∂x′ ∂x′
f (z) 0
(x′ − z)
−10 x
−2 −1.5 −1 −0.5 0 0.5 1 1.5
z x′
2: Linear functions 18/25
Affine approximation
• suppose f : Rn → R
∂f ∂f
fˆ(x) = f (z) + (z)(x1 − z1 ) + · · · + (z)(xn − zn )
∂x1 ∂xn
• fˆ is an affine function of x
f (x1 , x2 ) = x1 − 3x22
Gradient " #
1
∇f (x) =
−6x2
Affine approximation
Regression model
ŷ = xT β + v
= β1 x 1 + · · · + βn x n + v
• x is a feature vector
• y is selling price of a house in $1000 (in some location, over some period)
• regressor is
ŷ
y
2: Linear functions 25/25