You are on page 1of 20

VIETNAM NATIONAL UNIVERSITY – HO CHI MINH CITY

HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY


FACULTY OF APPLIED SCIENCES

LINEAR ALGEBRA
Project - Class CC11

Supervisors: Dr .Hoàng Hải Hà


Authors:
Trần Vũ Đức Hoàng - 1711419
Nguyễn Ngọc Khải - 2052130
Trương Cao Thiện - 2053456
Hoàng Quốc Duy - 2052053

June, 2021
CONTENTS

INTRODUCTION

PROBLEM

TOPIC 1: INNER PRODUCT


1. Theory
1.1.1 Introduction of Inner product
1.1.2 Definition of Inner product
1.1.3 The properties of inner product
1.2.1 Definition of vector projection.
2. Solve in matlab

TOPIC 2: THE ORTHOGONALITY


1. Theory
2.1.1 Introduction of orthogonality.
2.1.2 Definition of orthogonal.
2.1.3 The properties of orthorgonal.
2.2.1 Intoduction of Gram-Schmitd process
2.2.2 Definition of Gram-Schmitd process
2.2.3 The properties of Gram-Schmitd process
2. Solve in matlab

TOPIC 3: INVERSE OF A MATRIX


1. Theory
2.1.1 Introduction.
2.1.2 Definition of the inverse of a matrix.
2.1.3 The properties of the inverse of a matrix.
2. Solve in matlab

REFERENCES
INTRODUCTION
This report is a list of 3 problems that have been designed to understand
linear algebra in combination with Matlab programs that are customarily designed
to solve the problems

Linear algebra is a mathematical concept connected to linear equations,


linear functions and their representations through matrices and vector spaces. It is
essential for the definition of basic objects in modern geometry presentations, which
are used in most fields of engineering and science.

MATLAB is a programming platform designed specifically for engineers


and scientists. The heart of MATLAB is the MATLAB language, a matrix script that
allows the most natural expression of computational mathematics. Using MATLAB,
users can analyze data, develop algorithms or even create models.
PROBLEM
Problem 1: Write a program to find the reflection of an polygonal object in R3
with the inner product is given by

< x, y >= 4x1y1 + 3x2y2 − x2y3 − x3y2 + x3y3

about a given plane ax + by + cz = d.

Problem 2: Write a program to input any number of vector in R n and return the
orthogonal basis and orthonormal basis of the subspace spanned by these vectors.
(Use Gram - Schmidt process)

Problem 3: Write a program to find the inverse of a given matrix


TOPIC 1: INNER PRODUCT
1. Theory
1.1.1 Introduction of inner product

In mathematics, an inner product space or a Hausdorff pre-Hilbert space is


a vector space with a binary operation called an inner product. This operation
asociates each pair of vectors in the space with a scalar quantity know as the inner
product of the vector, often deoted using angle brackets. Inner product allow the
rigorous introduction of intuitive geometrical notions, such as the length of a
vector or the angle between 2 vectors. They also provide the means of defining
orthogonality between vectors( zero inner product). Inner product space generalize
Eculidean spaces (in which the inner product is the dot product, also known as the
scalar product) to vector spaces of any( possibly infinite) dimension, and are
studied in functional analysis. Inner product spaces over the field of complex
numbers are sometimes referred to as unitary spaces

A vector operation that allows us to define length and angle for vectors in
an arbitrary vector space. This operation is called the “inner product between two
vectors”, and is a generalization of the dot product that was introduced in the
Matrices lecture.

1.1.2 Definition inner product

An inner product on a real vector space V is a function that associates a real


number u, v with each pair of vectors in V in such a way that the following axioms
are satisfied for all vectors u, v, and w in V and all scalars k.

1. (u,v) = (v,u) [ Symmetry axiom ]

2. (u + v,w) = (u,w + v,w) [ Additivity axiom ]

3. (ku,v) = k(u,v) [ Homogeneity axiom ]

4. (v,v) ≥ 0 and (v,v) = 0 if and only if v = 0 [ Positivity axiom ]


1.1.3 The properties of inner product .

A real vector space V is called a real Euclidean inner product space if

〈·,·〉:V ×V →R
(x, y) −→ 〈x, y〉− which is called inner product of 2 vectors.
The following 4 axioms are satisfied

1.〈x,y〉=〈y,x〉, ∀x,y ∈V
2.〈x + y, z〉 = 〈x, z〉 + 〈y, z〉, ∀x, y, z ∈ V

3.〈αx,y〉= α〈x,y〉,∀x,y ∈V,∀α∈R.

4.〈x, x〉 > 0, x ≠ 0 and 〈x, x〉 = 0 ⇔ x = 0

*Remarkable: dot product is standard inner product n

(x,y)→<x,y> = ∑𝑛𝑖=1 𝑥𝑖𝑦𝑖 =x.yT

where x =(x1,x2,...,xn), y =(y1,y2,...,yn).

1.2.1 Definition vector projection

Let U be a subspace of an inner product space V . Any vector z in U can be


uniquely represented as z=x+y, x∈U, y∈U⊥.

1. X is called the vector projection/ vector resolution of z onto U. Denote :


prU(z).
2. Y is called the vector projection of z
3. The distance from z to U : d (z , U ) = ∥y ∥ = ∥z − prU (z )∥
1.3.1 Introduction of linear transformation

A linear transformation is a function from one vector space to another


that respects the underlying (linear) structure of each vector space. A linear
transformation is also known as a linear operator or map. The range of the
transformation may be the same as the domain, and when that happens, the
transformation is known as an endomorphism or, if invertible, an automorphism.
The two vector spaces must have the same underlying field.

Linear transformations are useful because they preserve the structure of a


vector space. So, many qualitative assessments of a vector space that is the domain
of a linear transformation may, under certain conditions, automatically hold in the
image of the linear transformation. For instance, the structure immediately gives
that the kerneland image are both subspaces (not just subsets) of the range of the
linear transformation.

1.3.2 Definition inner product

Let U,V be 2 vector spaces over the field K(R,C) f : U → V is called a


linear transformation if:

1. ∀u1,u2 ∈U,f(u1 +u2)=f(u1)+f(u2).


2. ∀u ∈ U, α ∈ K : f (αu) = αf (u).

Let f : U → V be a linear transformation. Let E = {e 1, e2, ..., en} and F = {f1, f2,
..., fm} be bases of U and V , respectively.An m × n matrix whose the i -th column
is the coordinate vector of f (ei ) with respect to the basis F is called the
transformation matrix of f with respect to E,F. Denote:

1. AEF = [f(e1)]F [f(e2)]F ... [f(en)]F


2. [f(x)]F =AEF[x]
1.3.3 The properties of matrix transformation

- If f: Rn → Rm : [ f (ei) ]F = F−1[f(ei)], then:


− − −
AEF =[𝐹 1[𝑓(𝑒1)] 𝐹 1[𝑓(𝑒2)] . . . 𝐹 1[𝑓(𝑒𝑛)] ] = F−1f(E).

- If f : Rm → Rn, E,F are two corresponding bases. Then:

AEF =F−1.f(E)

- If f : Rn → Rn, E is a basis of Rn. Then :

AE =E−1.f(E)

2. Solve in matlab

Problem : Write a program to find the reflection of an polygonal object in R3


with the inner product is given by

< x, y >= 4x1y1 + 3x2y2 − x2y3 − x3y2 + x3y3

about a given plane ax + by + cz = d.


Explain:

1: Clear command promt

2: Clear all value on workspace

12: Print on the screen

18: Solve the problem

20 => 21: Disp the result

Ex 1: Plan (P): x - 2y + 5z = 4
Answer the question:

Ex 2: Plan (P): 9x + 2y - z = -3

Answer the question:


Ex 3: Plan (P): -3x + y - 7z = 6

Answer the question:


TOPIC 2 : THE ORTHOGONALITY

1. Theory
2.1.1 Introduction

Orthogonality can help us sove the problem of checking whether the angle
𝜋
between vectos is 2 . Accordingly, we make the following definition which is
applicable even if one or both of the vectorss is zero.

2.1.2 Definition orthogonal

A vector u is called orthogonal to a vector space U if it is orthogonal to


any vector v in U: (u,v) = 0,∀v ∈ U. If U = span{M}, then u ⊥ U ⇔ u ⊥ M, (u ⊥
U ⇔ u⊥ to the spanning set of U)

Two vector subspaces, A and B, of an inner product space V, are called


orthogonal subspaces if each vector in A is orthogonal to each vector in B. The
largest subspace of V that is orthogonal to a given subspace is its orthogonal
complement.
Given a module M and its dual M∗, an element m′ of M∗ and an element
m of M are orthogonal if their natural pairing is zero, i.e. ⟨m′, m⟩ = 0. Two sets S′
⊆ M∗ and S ⊆ M are orthogonal if each element of S′ is orthogonal to each
element of S.
A set of vectors in an inner product space is called pairwise orthogonal if
each pairing of them is orthogonal. Such a set is called an orthogonal set.

2.1.3 The properties of the orthogonal of a matrix

In an inner product space V, a basis E={e1,e2,...,en} is called an


orthogonal basis for V , if it is mutually orthogonal (ei ⊥ ej ∀i , j ).

In an inner product space V, a basis E={e1,e2,...,en} is called an


orthonormal basis for V, if it is orthogonal (ei ⊥ ej), and ∥ei∥ = 1, ∀i,j.
2.2.1 Introduction of Gram-Schmidt process

The Gram–Schmidt process gives the way to orthonormalize a set of


vectors in an inner product space, most commonly the Euclidean space Rn
equipped with the standard inner product. The Gram–Schmidt process takes a
finite, linearly independent set of vectors S = {v1, …, vk} for k ≤ n and generates
an orthogonal set S′ = {u1, …, uk} that spans the same k-dimensional subspace of
Rn as S.

The application of the Gram–Schmidt process to the column vectors of a


full column rank matrix yields the QR decomposition.

2.2.2 Definition Gram-Schmidt process

The projection operator is defined by:

〈u,v〉
proju(v) = 〈u,u〉

where 〈u, v〉 denotes the inner product of the vectors u and v. This operator projects
the vector v orthogonally onto the line spanned by vector u

The Gram–Schmidt process then allows:

uk
uk = Vk - ∑𝑘−1
𝑗=1 proju(vk) ek = ‖uk‖

2.2.3 The properties of the orthogonal of a matrix

In an inner product space V, E = {e1,e2,...,en} is a basis of V. We will


find an orthogonal basis F from E using Gram-Schmidt algorithm:

1. f1 = e1
(𝑒2,𝑓1)
2. f2=e2 − prf (e2)=e2− (𝑓1,𝑓1) f1
(𝑒3,𝑓1) (𝑒3,𝑓2)
3. f3=e3−prf (e3)−prf (e3)=e3− (𝑓1,𝑓1) f1− (𝑓2,𝑓2) f2
4. fn = en − prf1 (en) − prf2 (en) − ...prfn−1 (en)
2. Solve in matlab
Problem : Write a program to input any number of vector in R n and return the
orthogonal basis and orthonormal basis of the subspace spanned by these vectors.
(Use Gram - Schmidt process)
Explain: the codes have one biggest con that is it is unable to generate a set of
orthogonal or orthonormal vectors if the matrix has LD vectors. Therefore, the user
has to choose a matrix that its rank equals to the number of vectors.

Choosing a matrix that its rank equals to the number of vectors.

1=>15: Create a square matrix

16=>41: Apply Gram-Schmidt process’s formula

42=>46: Normalized the result

The following are examples of applying the codes to a square matrix, a


general matrix and a matrix that has linearly dependent vectors

Ex 1(Square matrix) : 3 vectors (1, 3, 5), (7, 9, 11), (13, 17, 19)

Answer the question :

Ex 2(General matrix) : 2 vector (1,3,5) and vector (7,9,1)

Answer the question:


Ex 3: The linearly dependent vector (1,2,3) and vector(3,4,6)

Answer the question : Your Matrix must be Linearly Independent


TOPIC 3: INVERSE OF A MATRIX
1. Theory
3.1.1 Introduction

In real arithmetic every nonzero number a has a reciprocal A−1(= 1/A) with
the property A.A−1 = A−1.A= 1
The number A−1 is sometimes called the multiplicative inverse of A. Our next
objective is to develop an analog of this result for matrix arithmetic. For this purpose
we make the following definition.

3.1.2 Definition the inverse of a matrix

If A is a square matrix ( n x n ), and if a matrix B of the same size can be


found such that BA = AB = I , then A is said to be invertible (or non-singular) and B
n

is called an inverse of A and is denoted by A . If no such matrix B can be found,-1

then A is said to be singular.

3.1.3 The properties of the inverse of a matrix

The relationship AB = BA = I is not changed by interchanging A and B, so


n

if A is invertible and B is an inverse of A, then it is also true that B is invertible, and


A is an inverse of B. Thus, when AB = BA = I we say that A and B are inverses of n

one another.

If A is an n × n matrix, then the following statements are equivalent:

1. A is invertible
2. A ⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗
Elementary Row Operations I n

3. r(A) = n

Inversion Algorithm:

(A|I) ⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗⃗
Elementary Row Operations (I|A ) En.En-1.....E2E1.A = I -1

-1
⇒ A = En.En-1.....E2E1.
Suppose that A,B are 2 invertible matrices of order n. We have :

1. The inverse if exist is unique


2. (𝐴−1 )−1 = A
3. (𝐴𝑇 )−1 = (𝐴−1 )𝑇
4. AB is invertible and (𝐴𝐵)−1 = 𝐵 −1 . 𝐴−1

2. Solve in matlab
Problem : Write a program to find the inverse of a given matrix

Explain:

1=>7: Create a square matrix

8=>9: If matrix cannot inverse => Print “ not invertable “ on the screen

10=>11: Solve output matrix

12=>13: Print all values on the screen.


1 2 3
Example 1: Find the invertable matrix of A=(4 5 6)
2 5 7

Answer the question


5 1
−1
3 3
−16 1
𝐴−1 = 3 3
2
10 −1
−1
( 3 3 )
1 2 3
Example 2: Find the invertable matrix of A=(4 5 6)
2 4 6

Answer the question

Matrix A not invertable


2 3 1 5
6 3 1 2
Example 3: Find the invertable matrix of A=( )
1 8 2 1
1 3 6 8

Answer the question


−0.0578 0.1952 −0.0491 −0.0065
0.0665 −0.036 0.132 −0.0491
𝐴−1 =( )
−0.3653 0.0829 0.0294 0.2039
0.2563 −0.0731 −0.0654 −0.0087
REFERENCES
1. “INNER PRODUCT” https://users.math.msu.edu/users/gnagy/teaching/05-
fall/Math20F/w9-F.pdf
2. “INNER PRODUCT SPACE”
https://en.wikipedia.org/wiki/Inner_product_space
3. “ORTHOGONALITY”
https://en.wikipedia.org/wiki/Orthogonality#Definitions
4. Book “Elementary Linear Algebra” – Howard Anton Chris Rorres
5. “Gram-Schmitd Process”https://en.wikipedia.org/wiki/Gram–
Schmidt_process#Properties
6. “LINEAR TRANSFORMATION” https://brilliant.org/wiki/linear-
transformations/
7. Teaching slide of lecture Phan Thị Khánh Vân
8. Teaching slide of lecture Hoàng Hải Hà

You might also like