ON-Bases and Least Square Method
Artem Los (arteml@kth.se) February 21th, 2017
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 1 / 17
ON-Bases and Least Square Method Artem Los (arteml@kth.se) - - PowerPoint PPT Presentation
ON-Bases and Least Square Method Artem Los (arteml@kth.se) February 21th, 2017 Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 1 / 17 Overview Projections onto Subspaces 1 Orthogonal Complement 2
Artem Los (arteml@kth.se) February 21th, 2017
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 1 / 17
1
Projections onto Subspaces
2
Orthogonal Complement
3
Gram-Schmidt Method
4
Least Square Regression
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 2 / 17
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 3 / 17
Projection of vector b onto a plane π is the best approximation of b in π, defined as: projπ =
v1 || v1||2 v1 +
v2 || v2||2 v2
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 4 / 17
Projection of vector b onto a plane π is the best approximation of b in π, defined as: projπ =
v1 || v1||2 v1 +
v2 || v2||2 v2 We’ve assumed that π = span{ v1, v2}. The same pattern is applied to hyper planes, etc.
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 4 / 17
Problem. Find the projection of x = (2, 3, 5, 6) onto π = s(1, −1, −1, 1) + t(1, 2, 1, 2) : s, t ∈ R
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 5 / 17
Problem. Find the projection of x = (2, 3, 5, 6) onto π = s(1, −1, −1, 1) + t(1, 2, 1, 2) : s, t ∈ R Step 1: Find projπ( x) using the definition projπ =
v1 || v1||2 v1 +
v2 || v2||2 v2 =
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 5 / 17
Problem. Find the projection of x = (2, 3, 5, 6) onto π = s(1, −1, −1, 1) + t(1, 2, 1, 2) : s, t ∈ R Step 1: Find projπ( x) using the definition projπ =
v1 || v1||2 v1 +
v2 || v2||2 v2 = projπ x = (2, 3, 5, 6) · (1, −1, −1, 1) ||(1, −1, −1, 1)||2 (1, −1, −1, 1)+ +(2, 3, 5, 6) · (1, 2, 1, 2) ||(1, 2, 1, 2)||2 (1, 2, 1, 2) =
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 5 / 17
Problem. Find the projection of x = (2, 3, 5, 6) onto π = s(1, −1, −1, 1) + t(1, 2, 1, 2) : s, t ∈ R Step 1: Find projπ( x) using the definition projπ =
v1 || v1||2 v1 +
v2 || v2||2 v2 = projπ x = (2, 3, 5, 6) · (1, −1, −1, 1) ||(1, −1, −1, 1)||2 (1, −1, −1, 1)+ +(2, 3, 5, 6) · (1, 2, 1, 2) ||(1, 2, 1, 2)||2 (1, 2, 1, 2) = = 5 2, 5, 5 2, 5
ON-Bases and Least Square Method February 21th, 2017 5 / 17
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 6 / 17
Relationship with row space
For all matrices A, the null space of A is an orthogonal complement to the row space of A.
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 7 / 17
Relationship with row space
For all matrices A, the null space of A is an orthogonal complement to the row space of A. How about AT?
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 7 / 17
Problem. Find the basis of the orthogonal complement of S = span{(1, 2, −1)}, i.e. S⊥.
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 8 / 17
Problem. Find the basis of the orthogonal complement of S = span{(1, 2, −1)}, i.e. S⊥. Step 1: Transform into a plane.
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 8 / 17
Problem. Find the basis of the orthogonal complement of S = span{(1, 2, −1)}, i.e. S⊥. Step 1: Transform into a plane. S = span{(1, 2, −1)} means the equation of the plane is x1 + 2x2 − x3.
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 8 / 17
Problem. Find the basis of the orthogonal complement of S = span{(1, 2, −1)}, i.e. S⊥. Step 1: Transform into a plane. S = span{(1, 2, −1)} means the equation of the plane is x1 + 2x2 − x3. Step 2: Insert this into a matrix (interpret as row space) Since we want to find the null space, we solve x1 + 2x2 − x3 = 0.
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 8 / 17
Problem. Find the basis of the orthogonal complement of S = span{(1, 2, −1)}, i.e. S⊥. Step 1: Transform into a plane. S = span{(1, 2, −1)} means the equation of the plane is x1 + 2x2 − x3. Step 2: Insert this into a matrix (interpret as row space) Since we want to find the null space, we solve x1 + 2x2 − x3 = 0. Step 3: Use parametrisation to get the solution space (here it’s null space) s(−2, 1, 0) + t(1, 0, 1) s, t ∈ R
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 8 / 17
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 9 / 17
Goal. We want to find an orthonormal basis given { v1, v2, . . . , vk}. We will see later that this is useful.
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 10 / 17
Goal. We want to find an orthonormal basis given { v1, v2, . . . , vk}. We will see later that this is useful. Algorithm. Step1 : u1 = v1 Step2 : u2 = v2 −
v2· u1 || u1||2
u1 Step2 : u3 = v3 −
v3· u1 || u1||2
u1 −
v3· u2 || u2||2
u2 . . . r times
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 10 / 17
Problem. We are given a basis spanned by (1, 1, 1), (1, 1, 0), (1, 0, 0). Find an orthonormal basis.
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 11 / 17
Problem. We are given a basis spanned by (1, 1, 1), (1, 1, 0), (1, 0, 0). Find an orthonormal basis. Step 1: Find an orthogonal basis using Gram-Schmidt process.
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 11 / 17
Problem. We are given a basis spanned by (1, 1, 1), (1, 1, 0), (1, 0, 0). Find an orthonormal basis. Step 1: Find an orthogonal basis using Gram-Schmidt process. Step 2: Normalize the new vectors to get an orthonormal basis.
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 11 / 17
Problem. We are given a basis spanned by (1, 1, 1), (1, 1, 0), (1, 0, 0). Find an orthonormal basis. Step 1: Find an orthogonal basis using Gram-Schmidt process. Step 2: Normalize the new vectors to get an orthonormal basis. Example in Python
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 11 / 17
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 12 / 17
Least Square Method
The method of least squares is a standard approach in regression analysis to the approximate solution of overdetermined systems, i.e., sets of equations in which there are more equations than unknowns.
(From https://en.wikipedia.org/wiki/Least_squares) Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 13 / 17
Least Square Method
The method of least squares is a standard approach in regression analysis to the approximate solution of overdetermined systems, i.e., sets of equations in which there are more equations than unknowns.
(From https://en.wikipedia.org/wiki/Least_squares)
Examples of usage: Find the equation of straight line going through a set of points (eg. from an experiment). Fitting a curve to set of points
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 13 / 17
Let A be the matrix with more equations than unknowns (i.e.
x − b|| is the same as solving ATA x = AT
ATA x = AT b = ⇒
b
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 14 / 17
Problem. We want to fit y = a + bt2 and we are given five data points: (−2, 1), (−1, 1), (0, 2), (1, 3), (2, −2)
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 15 / 17
Problem. We want to fit y = a + bt2 and we are given five data points: (−2, 1), (−1, 1), (0, 2), (1, 3), (2, −2) Step 1: Find A 1 4 1 1 1 1 1 1 4
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 15 / 17
Problem. We want to fit y = a + bt2 and we are given five data points: (−2, 1), (−1, 1), (0, 2), (1, 3), (2, −2) Step 1: Find A 1 4 1 1 1 1 1 1 4 Step 2: Find ATA 1 1 1 1 1 4 1 1 4
1 4 1 1 1 1 1 1 4 = 5 10 10 34
ON-Bases and Least Square Method February 21th, 2017 15 / 17
Problem. We want to fit y = a + bt2 and we are given five data points: (−2, 1), (−1, 1), (0, 2), (1, 3), (2, −2)
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 16 / 17
Problem. We want to fit y = a + bt2 and we are given five data points: (−2, 1), (−1, 1), (0, 2), (1, 3), (2, −2) Step 3: Find AT b 1 1 1 1 1 4 1 1 4
1 1 2 3 −2 = 5
ON-Bases and Least Square Method February 21th, 2017 16 / 17
Problem. We want to fit y = a + bt2 and we are given five data points: (−2, 1), (−1, 1), (0, 2), (1, 3), (2, −2) Step 3: Find AT b 1 1 1 1 1 4 1 1 4
1 1 2 3 −2 = 5
b 5 10 10 34
5
ON-Bases and Least Square Method February 21th, 2017 16 / 17
Problem. We want to fit y = a + bt2 and we are given five data points: (−2, 1), (−1, 1), (0, 2), (1, 3), (2, −2) Step 3: Find AT b 1 1 1 1 1 4 1 1 4
1 1 2 3 −2 = 5
b 5 10 10 34
5
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 16 / 17
cup and time. How long time is the tea still drinkable?
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 17 / 17
cup and time. How long time is the tea still drinkable? Data can be found here
Artem Los (arteml@kth.se) ON-Bases and Least Square Method February 21th, 2017 17 / 17