English

How to Solve QR Decomposition Matrix - Tutorial

How to Solve QR Decomposition Matrix - Definition, Formula, Example

Definition:

QR decomposition of a matrix is otherwise known as QR factorization, which is nothing but decomposition of a matrix into an orthogonal matrix i.e product A = QR, and an upper triangular matrix R.

Formula:

A = QR R = QT A Where A - square matrix Q - Q is an orthogonal matrix R - R is an upper triangular matrix
Example :

Consider 3 x 3 Matrix

A =
 12 -51 4 6 167 -68 -4 24 -41

Solution:
Step 1:

First, split the columns of the given matrix.

 V1 = 126-4 V2 = -5116724 V3 = -468-41
Step 2:

Let us calculate the values of R using Gram - Schmidt process.

u1 = v1

u2 = v2 - proju1 v2

. . .

uk = vk - proju1 vk - proju2 vk - ... - projuk-1 vk

Step 3:

projuj vk = (v,u) u /(u,u)

Substitute the values in Gram - Schmidt process,

 u1 = 126-4

u2 = v2 - proju1 v2
 u2 = -5116724 - proju1 v2 u2 = -5116724 - (v,u) u /(u,u) Finding (v,u) and (u,u) values (v,u) = -5116724 126-4 = (-612+1002-96) = 294 (u,u) = 126-4 126-4 = (144+36+16) = 196 u2 = -5116724 - (294/196)126-4 u2 = -5116724 - 1.5 126-4 u2 = -5116724 - 189-6 u2 = -6915830

Follow the same steps and calculate u3 matrix value,

U = (u1,u2,u3) =
12 -69 -11.6
6   158 1.2
-4   30 -33

Step 5:

Calculate the values of ||u1||, ||u2||, ||u3||

Q = (u1/||u1||, u2/||u2||, u3/||u3||)

||u1|| = √122 + 62 + (-4)2 = √196 = 14
||u2|| = √(-69)2 + 1582 + 302 = √30625 = 175
||u3|| = √(11.6)2 + 1.22 + 332 = √1225 = 35
Step 6:
Q = (u1/||u1||, u2/||u2||, u3/||u3||) =
12/14 -69/175 -11.6/35
6/14   158/175 1.2/35
-4/14   30/175 -33/35

Step 7:

Finally calculate the value of R

Q =
12/14 -69/175 -11.6/35
6/14   158/175 1.2/35
-4/14   30/175 -33/35

Q Transpose

Q T =
12/14     6/14     -4/14
-69/175   158/175 30/175
-11.6/35   1.2/35 -33/35

R = Q T x A
R =
12/14      6/14      -4/14
-69/175   158/175 30/175
-11.6/35   1.2/35 -33/35
x
12   -51   4
6  167 -68
-4   24 -41

R =
14   21   -14
0   175   -70
0     0     35