Professional Documents
Culture Documents
Lecture-1 Slides PDF
Lecture-1 Slides PDF
Department of Mathematics
Indian Institute of Technology Guwahati
1 / 17
The Vector Space Rn
Topics:
The vector space Rn
Inner product, length and angle
2 / 17
The Vector Space Rn
Topics:
The vector space Rn
Inner product, length and angle
Linear combination
Matrices and matrix-vector multiplication
2 / 17
The vector space Rn
We define Rn to be the set of all ordered n-tuples of real numbers.
Thus an n-tuple v ∈ Rn is of the form
v1
row vector: v = [v1 , . . . , vn ] or column vector: v = ...
vn
3 / 17
The vector space Rn
We define Rn to be the set of all ordered n-tuples of real numbers.
Thus an n-tuple v ∈ Rn is of the form
v1
row vector: v = [v1 , . . . , vn ] or column vector: v = ...
vn
3 / 17
The vector space Rn
We define Rn to be the set of all ordered n-tuples of real numbers.
Thus an n-tuple v ∈ Rn is of the form
v1
row vector: v = [v1 , . . . , vn ] or column vector: v = ...
vn
>
v1 v1
Transpose: [v1 , . . . , vn ]> = ... and ... = [v1 , . . . , vn ].
vn vn
3 / 17
Algebraic properties of Rn
Define addition and scalar multiplication on Rn as follows:
u1 v1 u1 + v1 u1 αu1
.. .. .. . .
. + . = and α .. = .. for α ∈ R.
.
un vn un + vn un αun
4 / 17
Algebraic properties of Rn
Define addition and scalar multiplication on Rn as follows:
u1 v1 u1 + v1 u1 αu1
.. .. .. . .
. + . = and α .. = .. for α ∈ R.
.
un vn un + vn un αun
4 / 17
Algebraic properties of Rn
Define addition and scalar multiplication on Rn as follows:
u1 v1 u1 + v1 u1 αu1
.. .. .. . .
. + . = and α .. = .. for α ∈ R.
.
un vn un + vn un αun
5 / 17
The vector space Rn
The set Rn equipped with vector addition “+” and scalar
multiplication “·” is called a vector space.
Exercise: Let u, v, x be vectors in R3 .
(a) Simplify 3u + (5v − 2u) + 2(u − v)
(b) Solve 5x − u = 2(u + 2x) for x.
Length and angle: Length, distance and angle can all be described
by using the notion of inner product (dot product) of two vectors.
Definition: If u := [u1 , . . . , un ]> and v := [v1 , . . . , vn ]> are vectors
in Rn then the inner product hu, vi is defined by
hu, vi := u1 v1 + u2 v2 + · · · + un vn .
5 / 17
The vector space Rn
The set Rn equipped with vector addition “+” and scalar
multiplication “·” is called a vector space.
Exercise: Let u, v, x be vectors in R3 .
(a) Simplify 3u + (5v − 2u) + 2(u − v)
(b) Solve 5x − u = 2(u + 2x) for x.
Length and angle: Length, distance and angle can all be described
by using the notion of inner product (dot product) of two vectors.
Definition: If u := [u1 , . . . , un ]> and v := [v1 , . . . , vn ]> are vectors
in Rn then the inner product hu, vi is defined by
hu, vi := u1 v1 + u2 v2 + · · · + un vn .
6 / 17
Length and angle
Theorem: Let u, v, and w be vectors in Rn and let α ∈ R. Then
1 hu, ui ≥ 0 and hu, ui = 0 ⇐⇒ u = 0.
2 hu, vi = hv, ui
3 hu, v + wi = hu, vi + hu, wi
4 hαu, vi = αhu, vi.
Definition: The norm (or length) of a vector v := [v1 , . . . , vn ]> in
Rn is a nonnegative number kvk defined by
p q
kvk := hv, vi = v12 + · · · + vn2 .
6 / 17
Length and angle
Theorem: Let u, v, and w be vectors in Rn and let α ∈ R. Then
1 hu, ui ≥ 0 and hu, ui = 0 ⇐⇒ u = 0.
2 hu, vi = hv, ui
3 hu, v + wi = hu, vi + hu, wi
4 hαu, vi = αhu, vi.
Definition: The norm (or length) of a vector v := [v1 , . . . , vn ]> in
Rn is a nonnegative number kvk defined by
p q
kvk := hv, vi = v12 + · · · + vn2 .
7 / 17
Length and angle
Theorem: Let u and v be vectors in Rn and let α ∈ R. Then
1 Positive definite: kuk = 0 ⇐⇒ u = 0
2 Positive homogeneity: kαuk = |α| kuk
3 Triangle inequality: ku + vk ≤ kuk + kvk.
Unit vector: A vector v in Rn is called a unit vector if kvk = 1. If u
1
is a nonzero vector then v := kuk u is a unit vector in the direction
of u. Here v is referred to as normalization of u.
Example: The vectors e1 := [1, 0, 0]> , e2 := [0, 1, 0]> and
e3 := [0, 0, 1]> are unit vectors in R3 . These vectors are called
standard unit vectors.
7 / 17
Length and angle
Theorem: Let u and v be vectors in Rn and let α ∈ R. Then
1 Positive definite: kuk = 0 ⇐⇒ u = 0
2 Positive homogeneity: kαuk = |α| kuk
3 Triangle inequality: ku + vk ≤ kuk + kvk.
Unit vector: A vector v in Rn is called a unit vector if kvk = 1. If u
1
is a nonzero vector then v := kuk u is a unit vector in the direction
of u. Here v is referred to as normalization of u.
Example: The vectors e1 := [1, 0, 0]> , e2 := [0, 1, 0]> and
e3 := [0, 0, 1]> are unit vectors in R3 . These vectors are called
standard unit vectors.
Distance: The distance d(u, v) between two vectors
u := [u1 , . . . , un ]> and v := [v1 , . . . , vn ]> in Rn is defined by
q
d(u, v) := ku − vk = (u1 − v1 )2 + · · · + (un − vn )2 .
7 / 17
Angle and orthogonality
Let u and v be nonzero vectors in Rn . Consider the triangle with
sides u, v and u − v. Let θ be the angle between u and v. Then the
low of cosines applied to the triangle yields
ku − vk2 = kuk2 + kvk2 − 2kuk kvk cos θ.
8 / 17
Angle and orthogonality
Let u and v be nonzero vectors in Rn . Consider the triangle with
sides u, v and u − v. Let θ be the angle between u and v. Then the
low of cosines applied to the triangle yields
ku − vk2 = kuk2 + kvk2 − 2kuk kvk cos θ.
Expanding ku − vk2 = kuk2 − 2hu, vi + kvk2 gives us
hu, vi
hu, vi = kuk kvk cos θ =⇒ cos θ = .
kuk kvk
8 / 17
Angle and orthogonality
Let u and v be nonzero vectors in Rn . Consider the triangle with
sides u, v and u − v. Let θ be the angle between u and v. Then the
low of cosines applied to the triangle yields
ku − vk2 = kuk2 + kvk2 − 2kuk kvk cos θ.
Expanding ku − vk2 = kuk2 − 2hu, vi + kvk2 gives us
hu, vi
hu, vi = kuk kvk cos θ =⇒ cos θ = .
kuk kvk
8 / 17
Angle and orthogonality
Let u and v be nonzero vectors in Rn . Consider the triangle with
sides u, v and u − v. Let θ be the angle between u and v. Then the
low of cosines applied to the triangle yields
ku − vk2 = kuk2 + kvk2 − 2kuk kvk cos θ.
Expanding ku − vk2 = kuk2 − 2hu, vi + kvk2 gives us
hu, vi
hu, vi = kuk kvk cos θ =⇒ cos θ = .
kuk kvk
8 / 17
Angle and orthogonality
Let u and v be nonzero vectors in Rn . Consider the triangle with
sides u, v and u − v. Let θ be the angle between u and v. Then the
low of cosines applied to the triangle yields
ku − vk2 = kuk2 + kvk2 − 2kuk kvk cos θ.
Expanding ku − vk2 = kuk2 − 2hu, vi + kvk2 gives us
hu, vi
hu, vi = kuk kvk cos θ =⇒ cos θ = .
kuk kvk
8 / 17
Matrices
Definition: A matrix is an array of numbers called entries or
elements of the matrix. The size of a matrix A is a description of
the number of rows and columns of the matrix A. An m × n
matrix A has m rows and n columns and is of the form
a11 a12 · · · a1n
a21 a22 · · · a2n
A= . .. .
. ..
. . ··· .
am1 am2 · · · amn
9 / 17
Matrices
Definition: A matrix is an array of numbers called entries or
elements of the matrix. The size of a matrix A is a description of
the number of rows and columns of the matrix A. An m × n
matrix A has m rows and n columns and is of the form
a11 a12 · · · a1n
a21 a22 · · · a2n
A= . .. .
. ..
. . ··· .
am1 am2 · · · amn
9 / 17
Matrices
Definition: A matrix is an array of numbers called entries or
elements of the matrix. The size of a matrix A is a description of
the number of rows and columns of the matrix A. An m × n
matrix A has m rows and n columns and is of the form
a11 a12 · · · a1n
a21 a22 · · · a2n
A= . .. .
. ..
. . ··· .
am1 am2 · · · amn
Am
9 / 17
Linear combination
Let u and v be vectors in Rn . Let α and β be scalars. Adding αu
and βv gives the linear combination αu + βv.
Example: Let u := [1, 1, −1]> , v := [2, 3, 4]> and w := [4, 5, 2]> .
Then w = 2u + v. Thus w is a linear combination of u and v.
10 / 17
Linear combination
Let u and v be vectors in Rn . Let α and β be scalars. Adding αu
and βv gives the linear combination αu + βv.
Example: Let u := [1, 1, −1]> , v := [2, 3, 4]> and w := [4, 5, 2]> .
Then w = 2u + v. Thus w is a linear combination of u and v.
10 / 17
Linear combination
Let u and v be vectors in Rn . Let α and β be scalars. Adding αu
and βv gives the linear combination αu + βv.
Example: Let u := [1, 1, −1]> , v := [2, 3, 4]> and w := [4, 5, 2]> .
Then w = 2u + v. Thus w is a linear combination of u and v.
10 / 17
Matrix times vector
combination x1 a1 + · · · + xn an using a
We rewrite the linear
matrix. Set A := a1 · · · an and x := [x1 , . . . , xn ]> . We
define the matrix A times the vector x to be the same as the
combination x1 a1 + · · · + xn an .
11 / 17
Matrix times vector
combination x1 a1 + · · · + xn an using a
We rewrite the linear
matrix. Set A := a1 · · · an and x := [x1 , . . . , xn ]> . We
define the matrix A times the vector x to be the same as the
combination x1 a1 + · · · + xn an .
Definition: Matrix-vector multiplication
x1
Ax = a1 · · · an ... = x1 a1 + · · · + xn an .
xn
11 / 17
Matrix times vector
combination x1 a1 + · · · + xn an using a
We rewrite the linear
matrix. Set A := a1 · · · an and x := [x1 , . . . , xn ]> . We
define the matrix A times the vector x to be the same as the
combination x1 a1 + · · · + xn an .
Definition: Matrix-vector multiplication
x1
Ax = a1 · · · an ... = x1 a1 + · · · + xn an .
xn
11 / 17
Matrix times vector
A row vector ai1 · · · ain is a 1 × n matrix. Therefore
x1
.
ai1 · · · ain .. = ai1 x1 + · · · + ain xn .
xn
12 / 17
Matrix times vector
A row vector ai1 · · · ain is a 1 × n matrix. Therefore
x1
.
ai1 · · · ain .. = ai1 x1 + · · · + ain xn .
xn
12 / 17
Matrix-vector multiplication
More
generally
a11 · · · a1n x1 a11 a1n
.. .. .. . .
= x1 .. + · · · + xn ..
. ··· . .
a · · · amn xn a a
m1 m1 mn
a11 x1 + · · · + a1n xn a11 · · · a1n x
= .. ..
= .
. .
am1 x1 + · · · + amn xn am1 · · · amn x
13 / 17
Matrix-vector multiplication
More
generally
a11 · · · a1n x1 a11 a1n
.. .. .. .. ..
= x1 . + · · · + xn .
. ··· . .
a · · · amn xn a a
m1 m1 mn
a11 x1 + · · · + a1n xn a11 · · · a1n x
= .. ..
= .
. .
am1 x1 + · · · + amn xn am1 · · · amn x
A1
..
Now represent A := a1 · · · an by its rows: A = . .
Am
Then we have
a11 x1 + · · · + a1n xn A1 x
Ax = x1 a1 + · · · + xn an = .. ..
= . .
.
am1 x1 + · · · + amn xn Am x
13 / 17
Matrices and Vectors in Data Mining
Problem: Given a few key words, retrieve relevant information
from a large database.
14 / 17
Matrices and Vectors in Data Mining
Problem: Given a few key words, retrieve relevant information
from a large database.
14 / 17
Matrices and Vectors in Data Mining
Problem: Given a few key words, retrieve relevant information
from a large database.
14 / 17
Matrices and Vectors in Data Mining
Problem: Given a few key words, retrieve relevant information
from a large database.
The key words or terms are colored blue. The set of terms is
called a Dictionary. Counting the frequency of terms in each
document, we obtain a term-document matrix.
14 / 17
Term-document matrix
15 / 17
Term-document matrix
15 / 17
Query vector
16 / 17
Query vector
16 / 17
Query vector
16 / 17
Query matching (use of dot product)
Query matching is the process of finding all documents that
are relevant to a particular query v. The cosine of angle
between two vectors is often used to determine relevant
documents:
hAej , vi
cos θj := > tol
kvk kAej k
where Aej is the j-th column of A and tol is a predefined
tolerance. Thus cos θj > tol ⇒ Aej is relevant.
17 / 17
Query matching (use of dot product)
Query matching is the process of finding all documents that
are relevant to a particular query v. The cosine of angle
between two vectors is often used to determine relevant
documents:
hAej , vi
cos θj := > tol
kvk kAej k
where Aej is the j-th column of A and tol is a predefined
tolerance. Thus cos θj > tol ⇒ Aej is relevant.