![]()
MATH347DS L01: Vectors and Matrices
|
Quantitites
Vectors
Vector operations
Linear combinations
Matrix vector multiplication
Matrices
Matrix-matrix multiplication
![]()
Quantities
|
Numbers in mathematics
The set of natural numbers, , infinite and countable, ;
The set of integers, , infinite and countable;
The set of rational numbers , infinite and countable;
The set of real numbers, infinite, not countable, can be ordered;
The set of complex numbers, , infinite, not countable, cannot be ordered.
Numbers on a computer
The number types uint8, uint16, uint32, uint64 represent subsets of the natural numbers (unsigned integers) using 8, 16, 32, 64 bits respectively.
The number types int8, int16, int32, int64 represent subsets of the integers. One bit is used to store the sign of the number.
Computers approximate the real numbers through the set of floating point numbers. Floating point numbers that use bits are known as single precision, while those that use are double precision.
![]()
Vectors
|
Some quantities arising in applications can be expressed as single numbers, called “scalars”
Speed of a car on a highway mph
A person's height cm
Many other quantitites require more than one number:
Position in a city: “Intersection of 86 St and 3 Av”
Position in 3D space:
Velocity in 3D space:
![]()
Vector definition
|
Definition. A vector is a grouping of scalars
The scalars usually are naturals (), integers (), rationals (), reals (), or complex numbers ()
We often denote the dimension and set of scalars as , e.g.
Sets of vectors are denoted as
(1) |
A vector can also be interpreted as a function from a subset of to
![]()
Vector operations
|
Vector addition. Consider two vectors . We define the sum of the two vectors as the vector containing the sum of the components
∴ |
u=[1 2 3]; v=[-2 1 2]; u+v |
(2)
Scalar multiplication. Consider , . We define the multiplication of vector by scalar as the vector containing the product of each component of with the scalar
![]()
Linear combinations
|
Linear combination. Let , . Define a linear combination of two vectors by
Linear combination of vectors
![]()
Uses of linear combinations
|
"Start at the center of town. Go east 3 blocks and north 2 blocks. What is your final position?"
Linear combinations allow us to express a position in space using a standard set of directions. Questions:
How many standard directions are needed?
Can any position be specified as a linear combination?
How to find the scalars needed to express a position as a linear combination?
![]()
Matrices
|
Seek a more compact notation for the linear combination
Group the vectors together to form a “matrix”
Group the scalars together to form a vector
![]()
Matrix-vector multiplication = linear combination
|
Define matrix-vector multiplication
In general
![]()
Examples: linear combination
|
Construct linear combination of vectors , scaled by and , respectively
∴ |
u=[1 -1 2]; v=[2 1 -1]; alpha=2; beta=3; |
∴ |
alpha*u+beta*v |
(3)
Construct linear combination of vectors , scaled by and , respectively
∴ |
u=[1; -1; 2]; v=[2; 1; -1]; alpha*u+beta*v |
(4)
![]()
Examples: linear combination by matrix-vector combination
|
Construct linear combination of vectors , scaled by and , respectively
∴ |
u=[1; -1; 2]; v=[2; 1; -1]; alpha=2; beta=3; |
∴ |
A=[u v]; x=[alpha; beta]; A*x |
(5)
![]()
Matrices
|
Definition. An by matrix is a grouping of vectors,
where each vector has scalar components .
Notation conventions:
scalars: normal face, Latin or Greek letters, ,
vectors: bold face, lower case Latin letters,
matrices: bold face, upper case Latin letters,
![]()
Matrices
|
Matrix components
A real-valued matrix with lines and :
∴ |
A=[3 1 2; -1 0 1; 3 4 1] |
(6)
![]()
Matrix components
|
Instead of explicitly writing out components, it is often convenient to specify a matrix by a rule to construct each component
with indices taking values .
Example: A Hilbert matrix is defined as
∴ |
function hilb(m) H=ones(m,m) for i=1:m for j=1:m H[i,j]=1.0/(i+j-1.0) end end return H end; |
∴ |
hilb(3) |
(7)
Note that a vector is a matrix with a single column. The notation is a customary shorter form of .
![]()
Example: Column vectors of a matrix
|
∴ |
A=[3 1 2; -1 0 1; 3 4 1] |
(8)
∴ |
A[:,2] |
(9)
∴ |
![]()
Example: Row vectors of a matrix
|
∴ |
A=[3 1 2; -1 0 1; 3 4 1] |
(10)
∴ |
A[2,:]' |
(11)
∴ |
![]()
Example: Block within a matrix
|
∴ |
A=[3 1 2; -1 0 1; 3 4 1] |
(12)
∴ |
A[:,2:3] |
(13)
∴ |
![]()
Simple vectors, matrices, matrix addition and scaling
|
Single component vector is a scalar
Single column vector matrix is a vector
Vector addition carries over to matrices
Vector scaling carries over to matrices
Identity matrix
![]()
Swapping representations: from columns to rows through
transposition
|
Matrix transpose in terms of column vectors
Matrix transpose in terms of components
![]()
Matrix-matrix multiplication
|
Definition. Consider matrices , and The matrix product is a matrix with column vectors given by the matrix vector products
A matrix-matrix product is simply a set of matrix-vector products, and hence expresses multiple linear combinations in a concise way.
The dimensions of the matrices must be compatible, the number of rows of must equal the number of columns of .
A matrix-vector product is a special case of a matrix-matrix product when .
We often write in terms of columns as
![]()
Matrix multiplication example
|
∴ |
A=[1 0 3; 2 1 4; -1 0 3] |
(14)
∴ |
X=[1 -1 0; 1 1 1; 0 1 0] |
(15)
∴ |
A*X |
(16)
∴ |
[A*X[:,1] A*X[:,2] A*X[:,3]] |
(17)
∴ |
![]()
Matrix multiplication: componentwise
|
Definition. Consider matrices , and The matrix product is a matrix with components