Cholesky decomposition calculator

Number format
Solution comments
Without description (answer only)

a

b

c

d

x

y

z

clear

i

ab
x2
xn

Randomize

313131313135151515151583137
2
2510
=Solve

  About matrix Сholesky decomposition calculator

This is a free online matrix Сholesky decomposition calculator with complete, detailed, step-by-step description of solutions, that performs operations with matrices up to 99x99 in size with matrix elements of this type: decimal numbers, fractions, complex numbers, variables.

To start the calculation, you need to first enter the size of the matrix in the input field that you can find from the very top of the screen, also there you can choose the desired method of calculation.

A little below you will find a matrix window in which you need to enter matrix elements using the keyboard. The matrix control panel is also located here, which simplifies work with matrices and contains the following control elements:

  • The first element allows you to expand the matrix window. This can be especially useful in cases where you need to perform calculations with very large matrices that do not fit completely. If the matrix is still not visible after expanding the window, you can change the scale of the matrix using the + / - buttons;
  • The second element performs the function of copying the matrix input to the memory buffer. This can be useful in cases where you often use the same matrix for calculations, or if you need to move matrices between operations;
  • And the last element inserts the previously copied matrix, which allows you to speed up the process of entering the matrix to just a few clicks, instead of doing it manually;

And further down you will find a toolbar that allows you to customize the calculator and make it easier to work with it. It is visually divided into three parts, each of which is responsible for the following functionality:

  • The first allows you to select the number format when the solution result is displayed. Also, here you can turn off comments to the solution of the problem if you have already understood how to solve this problem, and you use the calculator to speed up or check your own calculations. Or you can turn off the step-by-step solution entirely if you only need the result of the solution;
  • The second contains buttons that allow you to change the type of the matrix input field, erase its elements or the entire matrix, and the largest button with an equal sign, which will take you to the screen with the solution of the problem. All these buttons are duplicated by keys on the keyboard. To find out which key on the keyboard to press, simply hover over one of the buttons and a tooltip will appear with the name of the key. You can also use the arrow keys on your keyboard to move the cursor between matrix input fields;
  • And the last one allows you to choose the number of digits after the decimal point for rounding non-integer numbers. Also, here you can immediately see an example of how rounded fractions will look;

  What is the Сholesky decomposition of a matrix?

Cholesky decomposition is the factorization of a symmetric positive definite matrix into a lower triangular matrix and the transpose of the lower triangular matrix, and the product of these matrices should give the original matrix. A matrix is symmetric if it is equal to its transpose matrix, and positive definite if all its upper-left sub-matrices are positive.

  How to perform the Сholesky decomposition of a matrix?

First, we need to make sure that the matrix is symmetric positive definite. Then the iterative process of finding the lower triangular matrix begins. There will be the same number of iterations as there are elements under the main diagonal of the original matrix, each element has its own iteration. And the result of each iteration will be one element of the lower triangular matrix. To find the elements of the lower triangular matrix, we need to use two formulas (1) and (2), see below. After all the elements of the lower triangular matrix are found, it just remains to transpose it.

  Example of Сholesky decomposition of a matrix

Write the initial matrix
A
:
A
=
4
2
2
2
5
1
2
1
3
Cholesky decomposition is representation of a symmetric positive definite matrix
A
in the form
A
=
L
*
L
T
0
;
A matrix is symmetric if it is equal to its transpose matrix:
A
=
A
T
0
;
A matrix is positive definite if all its upper-left sub-matrices are positive;
Before calculating the matrix
L
, check whether the matrix
A
is symmetric and positive definite;
2
Symmetric
To determine whether matrix
A
is symmetric, we find its transpose matrix and compare them:
A
T
0
=
4
2
2
2
5
1
2
1
3
A
=
A
T
0
=
4
2
2
2
5
1
2
1
3
=
4
2
2
2
5
1
2
1
3

Positive definite

3
M₁
4
2
2
2
5
1
2
1
3
=
4
=
4
;
4
>
0;
positive;
4
M₂
4
2
2
2
5
1
2
1
3
=
4
2
2
5
=
16
;
16
>
0;
positive;
5
M₃
4
2
2
2
5
1
2
1
3
=
4
2
2
2
5
1
2
1
3
=
32
;
32
>
0;
positive;
6
Matrix L
We checked that the matrix
A
is symmetric positive definite;
This means that Cholesky decomposition is possible;
Let's write the initial matrix
L
and mark the elements that we need to find as unknown:
L
=
×××
0
××
0
0
×
To calculate the elements of the matrix
L
, we will use two formulas:
The first formula (1) for elements placed on the main diagonal;
The second formula (2) is for all other elements;
l
0
i,i
=
a
0
i,i
-
i
- 1
k
= 1
l
2
i,k
(1)
Use this formula when
i = j
;
// where
i
is the row number
j
is the column number
k
is a variable counter, which for each element lᵢ,ᵢ will start with a value of 1, increase by 1 at each iteration, and end at a value of i - 1
a
is an element of matrix A
l
is an element of matrix L
Exclusion:
To calculate
l
0
1,1
we need an element under the index
i - 1
, which in this case is equal to 0, and therefore does not exist;
Therefore, in this case:
l
0
1,1
=
a
0
1,1
;
l
0
i,j
=
a
0
i,j
-
j
- 1
k
= 1
l
0
j,k
*
l
0
i,k
l
0
j,j
(2)
Use this formula when
i > j
;
// where
i
is the row number
j
is the column number
k
is a variable counter, which for each element lᵢ,ⱼ will start with a value of 1, increase by 1 at each iteration, and end at a value of j - 1
a
is an element of matrix A
l
is an element of matrix L
Exclusion:
To calculate
l
0
i
,1
we need an element under the index
j - 1
, which in this case is equal to 0, and therefore does not exist;
Therefore, in this case:
l
0
i
,1
=
a
0
i
,1
l
0
1,1
;
7
l₁,₁
i
= 1;
j
= 1;
Use the exclusion of formula
(1)
:
l
0
1,1
=
a
0
1,1
=
4
=
2
;
Write the calculated element in the matrix
L
:
L
=
2
××
0
××
0
0
×
8
l₂,₁
i
= 2;
j
= 1;
Use the exclusion of formula
(2)
:
l
0
2,1
=
a
0
2,1
l
0
1,1
=
2
2
=
1
;
Write the calculated element in the matrix
L
:
L
=
2
1
×
0
××
0
0
×
9
l₂,₂
i
= 2;
j
= 2;
k
= { 1 };
Use formula
(1)
:
l
0
2,2
=
a
0
2,2
-
l
2
2,1
=
5
-
1
2
0
=
2
;
Write the calculated element in the matrix
L
:
L
=
2
1
×
0
2
×
0
0
×
10
l₃,₁
i
= 3;
j
= 1;
Use the exclusion of formula
(2)
:
l
0
3,1
=
a
0
3,1
l
0
1,1
=
2
2
=
1
;
Write the calculated element in the matrix
L
:
L
=
2
1
1
0
2
×
0
0
×
11
l₃,₂
i
= 3;
j
= 2;
k
= { 1 };
Use formula
(2)
:
l
0
3,2
=
a
0
3,2
-
(
l
0
2,1
*
l
0
3,1
)
l
0
2,2
=
1
-
(
1
*
1
)
2
=
0
;
Write the calculated element in the matrix
L
:
L
=
2
1
1
0
2
0
0
0
×
12
l₃,₃
i
= 3;
j
= 3;
k
= { 1, 2 };
Use formula
(1)
:
l
0
3,3
=
a
0
3,3
-
(
l
2
3,1
+
l
2
3,2
)
=
3
-
(
1
2
0
+
0
2
0
)
=
1
41
100
;
Write the calculated element in the matrix
L
:
L
=
2
1
1
0
2
0
0
0
1
41
100
13
Matrix Lᵀ
We calculated all the elements of the matrix
L
;
Now, in order to complete the Cholesky decomposition, we just need to find its transpose matrix:
L
T
0
=
2
0
0
1
2
0
1
0
1
41
100
Answer
A = L · Lᵀ
L
=
2
1
1
0
2
0
0
0
1
41
100
L
T
0
=
2
0
0
1
2
0
1
0
1
41
100
SIZE3×3

  Sources