# Cholesky decomposition: cholesky

### 5.49.1 Cholesky decomposition: cholesky

If M is a square symmetric positive definite matrix, the Cholesky decomposition is M=PTP, where P is a lower triangular matrix. The cholesky command finds the matrix P.

- cholesky takes one argument:
  M, a square symmetric positive definite matrix.
- cholesky(M) returns a symbolic or numeric matrix P given by the Cholesky decomposition.

#### Examples.

- Input:
  cholesky([[1,1],[1,5]])
  Output:

  ⎡
  ⎢
  ⎣

  1 | 0
  1 | 2

  ⎤
  ⎥
  ⎦

- Input:
  cholesky([[3,1],[1,4]])
  Output:

  ⎡
  ⎢
  ⎢
  ⎢
  ⎢
  ⎢
  ⎢
  ⎣

  √

  3

  0

  √

  3

  3

  √

  33

  3

  ⎤
  ⎥
  ⎥
  ⎥
  ⎥
  ⎥
  ⎥
  ⎦

- Input:
  cholesky([[1,1],[1,4]])
  Output:

  ⎡
  ⎢
  ⎢
  ⎢
  ⎣

  1 | 0

  1

  √

  3

  ⎤
  ⎥
  ⎥
  ⎥
  ⎦

Warning: If the matrix argument A is not a symmetric matrix, cholesky(A) does not return an error, instead cholesky(A) will use the symmetric matrix B of the the quadratic form q corresponding to the (non symmetric) bilinear form of the matrix A.

#### Example.

Input:

cholesky([[1,-1],[-1,4]])

or:

cholesky([[1,-3],[1,4]])

Output:

⎡
⎢
⎢
⎢
⎣

1 | 0

−1

√

3

⎤
⎥
⎥
⎥
⎦