# • Definition of inner product

## Full text

(1)

2

2

(2)

### 1. Motivation

• For two vectors X=(x1,x2,x3), Y=(y1,y2,y3) in R3, the standard inner product of X and Y is defined as

• This definition is partly motivated by the desire to measure the length of a vector (Pythagorean theorem)

• If X is a unit vector, then is to measure the vector length of Y, i.e., the projection of Y on vector X.

3 3 2

2 1

1

### X = + +

X X x

x x

X ,

of

Length = 12 + 22 + 32 =

(3)

2

2

2

2

2

2

(4)

### 2 Definition of inner product

• For any dimension n, the two vectors

1

2

n

and

1

2

n

### )

,

the Euclidean inner product is

### ∑

=

= n

j

j j y x Y

X

1

,

• Complex form: Z and W are both complex vectors

=

= n

j

j jw z W

Z

1

,

(5)

### •If X=3+2i=(3,2i), then the length of X is:

2009/04/01 5

5 4

9 4

9 )

2 , 3 ( ) 2 , 3 (

, > = = + 2 = =

< X X i i i

Without conjugate (wrong):

With conjugate (correct):

13 4

9 4

9 )

2 , 3 ( ) 2 , 3 (

, > = = 2 = + =

< X X i i i

3 2i

(6)

2

2

### (1)

• Continuous form (連續型): L2

<

## }

= b

a f t dt

C b

a f

b a

L2([ , ]) :[ , ] ; | ( ) |2

The energy of a continuous function f in the interval is defined as:

The L2 inner product in the interval [a, b] of two continuous functions is defined as:

b

L

a

### ,

2

(f and g can be complex.)

(7)

## 能量的定義

•能量的定義，就是將每一個element平方後相加，也 就是向量長度的平方。

•Ex. The energy of a vector (or a signal) X=(3,4,5) is defined by:

•Ex. The energy of a vector (or a signal) X=(x1,x2,x3,…,xn) is defined by:

2

2

2

2 2

3 2

2 2

X x1 x x xn

X

(8)

2

2

### (2)

• Discrete form (離散型): l2

=

b

a i

i

l

i

### YX ,

2

The l2 inner product in the interval [a, b] of two discrete functions is defined as:

(X and Y can be complex.)

(9)

### 4 Schwarz inequalities

Schwarz inequality:

### | XY ≤ XY

X

Y X+Y

Equality holds if and only if X and Y are linear dependent.

If X and Y are linear independent, what happens?

||

||

||

||

cos

||

||

||

||

| ,

| X Y = X Y θ X Y

θ 1.

cos ,

180 or

0

If θ = θ = ° θ =

. 0 cos

, 270 or

0 9

If θ = ° θ = ° θ =

(10)

### Triangular inequalities

Triangle inequality:

### || X + Y ≤ X + Y

X

Y X+Y

Equality holds if and only if X or Y is a positive multiple of the other.

0 , >

= tY t X

X Y=2X

||

||

||

||

||

|| X + Y = X + Y

(11)

### 5 Orthogonality 正交性 (1)

The vectors X and Y are said to be orthogonal if

### 0 , Y = X

The vectors X and Y are said to be orthonormal if

(12)

Example:

]).

, ([

L in orthogonal

are cos

) ( and sin

) ( function The

2 −π π

=

= t g t t

t f

Proof:

0

| ) 2 4 cos(

1

) 2 2 sin(

1

cos sin

,

=

= −

=

=

ππ

π

π

π

π

t

dt t

tdt t

g f

(13)

### 5 Orthogonality (3)

• Orthogonal projection

vectors of

collection l

orthonorma an

is } ,

, ,

{ev1 ev2 L evN

### ∑

=

α

= N

j

j j

N

e v

e e

e v

1

2

1, ,..., }, then, {

of space in the

lies If

v v

v v

v v

where

j

j

j

### vv

α j

Origin

).

,..., ,

( is coordinate its

and }

,..., ,

{

system coordinate

new a

in spanned be

can vector

: means That

2 1

2

1 e eN N

e

v

α α

v α v

v

v

(14)

Example:

z y

x v

z z

v

y y

v

x x

v

v

3

(15)

Example

3

x y

4 v=(3,4) x’

y’

5 /

) 1 , 2 ( '= x

5 /

) 2 , 1 ( '= −

y / 5 5/ 5 5

2 ) 1 4 , 3 (

4721 .

4 5 2 5 / 10 5

1 / ) 2 4 , 3 (

=

⎟⎟ =

⎜⎜

⎛−

=

=

⎟⎟ =

⎜⎜

? )

5 ( )

5 2 ( energy

25 16

9 4

3 energy

2 2

2 2

= +

=

= +

= +

= (x,y)-plane

(x’,y’)-plane

5 5 2

) 5 , 5 2

= ( v

(16)

## 矩陣表示

Example

3 4

5 5 2

⎟⎟

⎜⎜

⎟⎟

⎜⎜

=

⎟⎟

⎜⎜

=

⎟⎟

⎜⎜

4 3 1 0

0 1 4

3

2

1 v

x x

T T v v

v

⎟⎟

⎜⎜

⎟⎟

⎜⎜

=

⎟⎟

⎜⎜

=

⎟⎟

⎜⎜

4 3 5 / 2 5 / 1

5 / 1 5

/ 2 '

' 5

5 2

2

1 v

x x

T T v v

v

) 5 , 5 2

= ( v

v=(3,4)

⎟⎟

⎜⎜

=

5 / 1

5 / ' 2

x1

⎟⎟

⎜⎜

= ⎛−

5 / 2

5 / ' 1

x2

x1

x2

(17)

2009/04/01 17

Example:

### 用途﹕在找出多數向量的主軸(主軸分析)﹐資料壓縮

axis.

new a

|| is in which ||

system, coordinate

new a

Construct .

coordinate Cartison

in vector a

be ) 7 , 5 , 3 ( Let

v z v v

= v

v v v

0 ,

so

), 7 , 5 , 3 83 ( 1

||

and ||

) 2 , 1 , 3 14 ( Define 1

3 1

3 1

=

=

=

= e

e

v e v

e v

v v

v v v

0694 .

8 ) 1 1 4 , , 9 12 (17

12 . , 17

4 9 0

7 5

3

0 2

3

. 0 ,

and 0

, :

satisfies which

) , , ( Define

2

2 3 2

1 2

=

=

=

= +

+

=

+ = = =

e

z x

z z y

y x

z y

x

e e e

e z

y x ev

+

+

83 0 0 ) (

: form matrix

a in or

83 0

0 : as d represente be

can

system, coordinate

new in the

Therefore,

3 2 1

3 2

1

e , e , e

e e

e v

v v v

v v

v v

(18)

## 找出多數向量的主軸(主軸分析)

1.資料壓縮 2.降低維度

(19)

2009/04/01 19

f f f

### )

n

f = , , , n length = :

data D

1 1 2 K

( )

⎟⎟

⎜⎜

+ +

⎟⎟

⎜⎜

+

⎟⎟

⎜⎜

=

1 0 0 0

1 0

0 0 1 ,

, , D,

In 1 2 1 2 M

K M

K M v

n

n f f f

f f

f f

n

n n

n n

e e f e

e f e

e f f

f

R e

e e

v v v

v K v v

v v v

v

L v v

v

, ,

,

: form new

a in d represente be

can then

} , , , { : system coordinate

another is

there If

1 2

2 1 1

1 1

2 1

+ +

+

=

f e

e e g

f T

T n

T T

v vM

v v

v v 2

1

) (

×

=

= ( , , , , , , )

2

1 f e f en

e f

g v v

v K v v

v = v

(20)

### 6 Linear operators (1)

Definition:

.

V for

) ( )

( )

(

satisfies W which

V : T function a

is W space

vector a

and V

space vector

a between map)

(or operator

linear A

C a,b

u,v v

bT u

aT bv

au

T + = +

=

=

=

### ∑

n mn

m

n

i j ij j

j j j

x x

t t

t t

x t v

T

v x v

M L

M O

M v L

v

1

1

1 11

) (

: any vector

For matrix.

a as

d represente be

can T

then l,

dimensiona finite

are W and

V If

=

m

i ij j

j

1

(21)

### 6 Linear operators (2)

Example . angle an

for axis

- z respect to with

) 2 , 1 ( vector

a Rotate

θ v =

x z

⎟⎟ y

⎜⎜

⎟⎟

⎜⎜

θ θ

θ

= θ

2 1 cos

sin

sin ) cos

(v T

x y

(22)

### 6 Linear operators (3)

v=[1;2];

a=30/180*pi;

t=[cos(a) sin(a);-sin(a) cos(a)];

w=t*v;

figure(1); clf;

plot([0 v(1)],[0 v(2)],'r');

hold on;

plot([0 w(1)],[0 w(2)],'g');

axis equal;

Matlab program:

0 0.5 1 1.5 2

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

Result:

Red: Before rotation, Green: After rotation.

(23)

### 6 Linear operators (4)

v ) ( ,

w ,

satisfies that

: operator linear

the is of

spaces, product

inner o

between tw operator

linear a

is :

If

* w T

v w

T(v)

V W

T T

W V

T

*

=

=

= n

j x jv j

v 1

Let v v ( )

=1

= m

i ij i

j a w

v

T v v

Q

w w

c

w x

a v

T x v

x T

v T

m

i

i i

m i

n

j ij j i

n

j j j

n

j j j

v v

v v

v v

=

=

=

=

=

=

= =

=

=

1

1 1

1

1 ) ( ) ( )

( )

(

where =

n=

j ij j

i a x

c 1

### ∑

=

=

= n

j

j ij

i b v

w T

v w

T

1

*

*( ) , then let ( )

If v v v v

(24)

v v

b c

v b c w

T c w

c T

w T

n j

m i

j ij i

m i

n j

j ij i m

i i i

m

i i i

v v

v v

v v

=

=

=

=

=

= =

= = =

=

1 1

1 1

1

* 1

*

*( ) ( ) ( )

=

= n

j x jv j

v 1

v

Known v j

m

i

ij

ib x

c =

=1

=

= n

j ij j

i a x

c 1

Known

### ∑∑

= =

= m

i

n j

j ij ij

j a b x

x

1 1

(25)

2009/04/01

Matrix representation:

=

n n

x x v

v

vv v L v M1

1, ,

( ) w

c c w

w v

T

m m

M v L v

v

v =

=

1 1, ,

) (

( )

=

mj j m

j

a a w

w v

T v v L v M1

1, , )

(

( ) ( )

( )

=

=

=

n mn

m

n n

n n

n n

x x

a a

a a

w w

x x v

v T x

x v

v T v

T

M L

M O

M v L v L

v M v L

v M v L

v

1

1

1 11

1

1 1

1 1

, ,

) ,

, ( )

, , ( )

(

25

Let and

C=AX

(26)

Similarly

( )

=

m m

c c w

w

wv v L v M1

1, , ( )

=

ni i n

i

b b v

v w

T v v L v M1

1

*( ) , ,

(known) Let

( )

( )

=

=

=

n n

m nm

n

m n

x x v

v v

c c

b b

b b

v v

w T

v M v L

v

M L

M O

M v L v L

v

1 1

1

1

1 11

1

*

, , , , )

(

X=BC

X=BC=BAX BA=I

(27)

### • Motivation:

– 1. we often use least squares to develop a

procedure for approximating signals (or functions).

– 2. we often use least squares to get model parameters in a fitting problem.

(28)

### 7 Least squares (2)

Best line fitting problem (overdetermined problem)

) , (xi yi

) ,

(xi mxi +b

Error at xi is | yi (mxi +b)|

The best line fitting is to find the minimum total square error:

=

+

= N

i

i

i mx b

y E

1

))2

(

( N>>2

(29)

### ∑

=

+

= N

i

i

i mx b

y E

1

))2

( (

⎪⎪

=

+

=

=

+

=

=

= N

i

i i

i i

i N

i

b mx b y

E

x b

mx m y

E

1 1

0 ) 1 ))(

( (

2 0

0 ) ))(

( (

2 0

⎪⎪

=

=

=

= N

i

i i

N

i

i i

i i

b mx y

bx mx

x y

1 1

2

0 ) (

0 ) (

⎪⎪

+

=

+

=

∑ ∑ ∑

=

=

=

= = =

1 1

1

1 1 1

2

N

i N

i

i N

i i N

i

N

i

i N

i

i i

i

b mx

y

bx mx

x y

⎟⎟

⎜⎜

=

=

=

=

=

=

b m N

x

x x

y x y

N

i i

N

i i N

i i N

i i N

i

i i

1

1 1

2

1 1

Linear equations.

⎟⎟ =

⎜⎜

=

=

=

=

=

1 1 1

1

1 1

2

N

i i N

i

i i N

i i

N

i i N

i i

y x y N

x

x x

b m

(30)

### 7 Least squares (4)

Matlab program:

m=2.5; b=3.7;

x=rand(1,50)*50;

y=m*x+b+randn(1,50)*5;

sx=[min(x) max(x)];

sy=m*sx+b;

figure(1); clf; plot(x,y,'.'); hold on; plot(sx,sy,'r');

A=[sum(x.^2) sum(x);

sum(x) length(x)];

B=[sum(x.*y); sum(y)];

v=inv(A)*B ; m1=v(1)

b1=v(2)

y1=m1*sx+b1;

plot(sx,y1,'g');

(31)

### 7 Least squares (5)

Result

Red: Ground truth, Green: Estimation.

(32)

### •計算f長度,

f = sin t, | f |=

ππsin2 t dt

Updating...

## References

Related subjects :